WordPress.org

Ready to get started?Download WordPress

Forums

Taxonomy Images II
ciii_category_images won't work outside the loop (4 posts)

  1. kamrankhan
    Member
    Posted 2 years ago #

    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>';
    		} ?>
  2. peachepe
    Member
    Posted 2 years ago #

    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

  3. Simon Wheatley
    Code for the People
    Plugin Author

    Posted 2 years ago #

    Try version 1.31… is that better for you?

  4. thedayforlove
    Member
    Posted 2 years ago #

    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/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic