Taxonomy Images
Remove link from image terms? (4 posts)

  1. bento
    Posted 4 years ago #

    Thanks for this wonderful plugin.

    I am outputting all category images (in my case icons) which are used/checked for a post (within the category.php template) with this code:

    <?php print apply_filters( 'taxonomy-images-list-the-terms', '', array(
     'image_size' => 'Fullsize',
     'before' => '<ul class="pins">',
     'after' => '</ul>'
     ) ); ?>

    Is there any way to remove the link from the images?
    I simply would like a UL list without the links.

    Many thanks for any hints!


  2. Michael Fields
    Plugin Contributor

    Posted 4 years ago #

    Hi Bento!

    Thanks for the kind words! Glad you enjoy the plugin :) Here's something that should work for you (untested):

    $terms = apply_filters( 'taxonomy-images-get-the-terms', '' );
    if ( ! empty( $terms ) ) {
    	print '<ul class="pins">';
    	foreach( (array) $terms as $term ) {
    		if ( ! isset( $term->image_id ) )
    		$image = wp_get_attachment_image( $term->image_id, 'fullsize' );
    		if ( ! empty( $image ) )
    			$output .= '<li>' . $image .'</li>';
    	print '</ul>';
  3. bento
    Posted 4 years ago #

    Hi Michael,

    Thanks a lot for the sample code, however it did not output anything on my end...

    Any ideas?

  4. leap
    Posted 4 years ago #

    Hi Michael,

    First great plug-in, I am using it with the WP e-commerce plug-in to add images to the variations and I was skepticle as to it working but it worked with little to no hassle.

    I have the same issue with the links that bento has mentioned above and tried the code you supplied and it showed nothing for me also.

    I did do some digging and found that the terms in the $terms variable are just the images wrapped (by default) in an unordered list. Then when you cast it into an array you just get an array with one index that contains the unordered list.

    So the following line where you check if the $term->image_id is empty will always fail:
    if ( ! isset( $term->image_id ) )

    Do you or anyone have any ideas to help?
    Thanks very much

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Taxonomy Images
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic