WordPress.org

Support

Support » Plugins and Hacks » Taxonomy Images II » ciii_category_images won't work outside the loop

ciii_category_images won't work outside the loop

  • I’m using the ciii_category_images tag to output an image for a single category outside the loop and it comes back with an empty src. Oddly enough, it recognizes the right category and outputs the correct alt tag, but it just won’t show the img src.

    Can anyone tell me what I’m doing wrong?

    <?php
    		$layouts = get_categories('child_of=23');
        		foreach($layouts as $subcat) {
        			echo '<h3>' . $subcat->cat_name . '</h3>';
    			ciii_category_images( 'category_ids=22' );
        			echo '<ul>';
        			$subcat_posts = get_posts('cat=' . $subcat->cat_ID . '&orderby=title&order=ASC');
    
    			foreach($subcat_posts as $subcat_post) {
            			$postID = $subcat_post->ID;
    				echo '<li>';
    				echo '<a href="' . get_permalink($postID) . '">';
    				echo get_the_title($postID);
    
    				echo '</a></li>';
    			}
    
    			echo '</ul>';
    		} ?>
Viewing 3 replies - 1 through 3 (of 3 total)
  • I’m having the same problem, since I need this done right now, i made the function

    function imagen_categoria( $cat )
    {
    	$wp_upload_dir = wp_upload_dir();
    	$base_url = $wp_upload_dir[ 'baseurl' ];
    	// Append our subdir
    	$url = $base_url . '/category-images-ii';
    
    	$fileurl = $url."/".$cat.".original.jpg";
    
    	if (file_exists($wp_upload_dir[ 'basedir' ]. '/category-images-ii' ."/".$cat.".original.jpg"))
    	{
    		echo '<img src="'.$fileurl.'" />';
    	}
    }

    Placed it on my functions.php

    Usage:

    <?php imagen_categoria( $category->cat_ID ); ?>

    Hope this helps until the developer fixes it

    Plugin Author Simon Wheatley

    @simonwheatley

    Try version 1.31… is that better for you?

    Try version 1.31… is that better for you?

    I cannot find out version 1.31 here:
    http://wordpress.org/extend/plugins/category-images-ii/download/

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘ciii_category_images won't work outside the loop’ is closed to new replies.
Skip to toolbar