• Hi,

    Thanks for this plugin, very useful, even if I couldn’t enjoy it so far ??
    I used it this way: ciii_term_images( 'brands' ) where brand is a custom taxonomy.
    It returns an image tag as expected in my template, with a “alt” normally filled with the “brands” term (so the plugin does return the correct term), but there is no source to the image !
    <img src alt="my-brand-term" />

    Thanks for helping !

Viewing 15 replies - 1 through 15 (of 16 total)
  • Thread Starter Pierre Pernix

    (@pierrepernix)

    Bump !

    I’m having the same problem.

    Thread Starter Pierre Pernix

    (@pierrepernix)

    I noticed the plugin stores images in “wp-content/uploads/category-images-ii/”, using the ID of the custom taxonomy term to name the image, this way : [term_id].thumb.[extension].

    So, even if it looks a bit crappy, I use the piece of code below as an alternative to get the image associated with a specific custom taxonomy term (in my case, the term ‘My brand’ from the ‘brands’ taxonomy) :

    $term_data = get_term_by( 'name', 'My brand', 'brands' );
    $term_id = $term_data->term_id;
    $upload_dir = wp_upload_dir();
    
    $path = '/category-images-ii/' . $term_id . '.thumb';
    $url = $upload_dir[baseurl];
    $dir = $upload_dir[basedir];
    if( $filename = glob( $dir . $path . '.*' ) ) {
       $extension = substr( $filename[0], -4 );
       echo '<img src="' . $url . $path . $extension . '" />';
    }

    I managed to get images to show (wp 3.2.1) by altering the code in term-images.php.

    Adding a print_r($term); somewhere within the foreach loop I noticed that $term[ 'image' ] was emtpy, which is why the img src is empty. I changed this to $term[ 'thumb' ] and it worked.

    Not sure why $term[ 'image' ] is empty. Also not sure why term-images.php is being used and not category-images.php

    Btw, I made these changes to a version of the file copied to my theme folder to avoid editing the original plugin files.
    i.e. copy:
    wp-content/plugins/category-images-ii/view/category-images-ii/
    To:
    wp-content/themes/mytheme/view/category-images-ii/

    Plugin Author Simon Wheatley

    (@simonwheatley)

    Try v1.31 and see if this fixes the issue for you.

    We have the same issue, even after upgrading to 1.31. We are using the ciii_category_archive_image variable in category.php, but the file term-images.php is the one that’s beeing used. If we delete this file, the correct file (category-images.php) is used. Is this a bug?

    Plugin Author Simon Wheatley

    (@simonwheatley)

    Not a bug, but possibly not very well thought through by me. term-images.php is now the preferred name of the template file… if you rename your template in the theme you might find things working? Let me know.

    So what is category-images.php used for? Under Other notes, you are saying “Then copy the template files view/category-images-ii/category-images.php from the plugin directory into your theme directory and amend as you need.” This is confusing.

    Plugin Author Simon Wheatley

    (@simonwheatley)

    @anders – I think the latest version, 1.33 may solve the template issue for you. term-images.php is the preferred template name (now we’re dealing with custom taxonomies as well I wanted to be more generic). If you have category-images.php in your theme, then I am attempting to pick that template up too.

    Hello. I’m having same issue. I just changed a bit the code (for display archive images) in term-images.php from this:

    <img src="<?php
    	echo $term[ 'image' ]; ?>" alt="<?php echo $term[ 'name' ]; ?>" />

    to this:

    <img src="<?php
    	echo $term[ 'thumbnail' ]; ?>" alt="<?php echo $term[ 'name' ]; ?>" />

    Hope this help.

    ps: sorry for my english.

    Plugin Author Simon Wheatley

    (@simonwheatley)

    @chavo – DId you have the problem of it not working (before you edited the template) in the latest version of the plugin (v1.33).

    You will find that your template will now only output thumbnail sized images, and you cannot use the size parameter to specify using either the ‘original’ size or the ‘thumbnail’ size (this might not be a problem for you, though).

    Example template tag code below to output the unlinked original size images, with no description, for the ‘outlet’ taxonomy:

    <?php ciii_term_images( 'outlet', 'size=original&link_images=0&show_description=0' ); ?>

    Hi Simon. Thanks for your reply. I’m using lastest version of the plugin. I just want to use the plugin as referred in the “Other notes” section.

    For example, I want to be able to call category icons via ID but instead I tried with all te code posibilities, I cant’ get it to work, so I came with this hack for categories IDs https://www.ads-software.com/support/topic/ciii_category_images-wont-work-outside-the-loop?replies=3 (It is a little limited because of the file extension. I edited the code to show .gif). In this way I get what I looking for.

    I don’t understand at all how taxonomies works (maybe because I never created new ones on my admin), but like I said, I tried with the code just like is referred in the plugin page but can’t get it working. The plugin is really useful (It would be nice if WordPress came with this utility by default). Maybe I’m doing something wrong…

    Once again, thanks!

    ps: sorry for my english.

    I’m having the same problem, seems as is not taking the IDs. I’ve solved it whith “pierrepernix” script.
    hope you can solve it soon to be more polite on my script.

    Thread Starter Pierre Pernix

    (@pierrepernix)

    Hi there,

    I uploaded the last version (1.33) and it works fine.
    Thanks for the support !

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘ciii_term_images() return image with no source’ is closed to new replies.