Support » Plugin: Taxonomy Images » [Plugin: Taxonomy Images] Taxonomy Image on Archive Page

  • Hi Michael, thanks for creating this plug-in!

    I’m trying to use it as a tool to accentuate “new” posts on a website, such that a “new” icon would appear alongside the title of the new posts on the archive page if the post is associated to a “new” category.

    I’ve inserted this code into archive.php, but I cannot get it to work:

    <?php print apply_filters( ‘taxonomy-images-queried-term-image’, ” ); ?>

    I’m wondering if there might be something simple I’m missing. Please note that I don’t want any icon to appear for the posts that aren’t in the “new” category, but if the plugin requires it, I can associate a transparent PNG with the other categories.

    Thanks for your help!

    ~Kevin

    http://wordpress.org/extend/plugins/taxonomy-images/

Viewing 4 replies - 1 through 4 (of 4 total)
  • MIchael, just checking in to see if you’ve got any suggestions for how to do what I’m trying to do…

    Plugin Contributor Michael Fields

    (@mfields)

    This is the wrong filter to use. This is helpful to display one image at the top of a term archive template. to display a single image alongside each post in the loop, you will need to use something like this (untested):

    $categories = apply_filters( 'taxonomy-images-get-the-terms', array() );
    $new_icon = '';
    foreach( $categories as $category ) {
    	if ( 'new' == $category->slug )
    		$new_icon = wp_get_attachment_image( $category->image_id, 'thumbnail' );
    }

    Thanks, Michael.

    Unfortunately, I don’t know quite enough about PHP to do anything with the code you’ve provided here. Into what PHP command should it be included? By itself, it doesn’t work, and when I inserted it into the single-quotes of the PHP print command above, that didn’t work either (please see below, I eliminated the < from the beginning and the > from the end just in case the code would otherwise cause technical problems):

    ?php $categories = apply_filters( ‘taxonomy-images-get-the-terms’, array() );
    $new_icon = ”;
    foreach( $categories as $category ) {
    if ( ‘new’ == $category->slug )
    $new_icon = wp_get_attachment_image( $category->image_id, ‘thumbnail’ ); ?

    Thanks for your help with this…

    This pretty much my issue, as well. Would like to have the tag image appear next to each post in a category/archive/search page. Using a Twenty Twelve child theme, I’ve been trying to figure out what to place in content.php, with no success. Any ideas?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: Taxonomy Images] Taxonomy Image on Archive Page’ is closed to new replies.