WordPress.org

Ready to get started?Download WordPress

Forums

Taxonomy Images
Taxonomy Image on Archive Page (5 posts)

  1. kmg1016
    Member
    Posted 1 year ago #

    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/

  2. kmg1016
    Member
    Posted 1 year ago #

    MIchael, just checking in to see if you've got any suggestions for how to do what I'm trying to do...

  3. Michael Fields
    Themer
    Plugin Author

    Posted 1 year ago #

    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' );
    }
  4. kmg1016
    Member
    Posted 1 year ago #

    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...

  5. Rand HOPPE
    Member
    Posted 1 year ago #

    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?

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic