WordPress.org

Forums

Taxonomy Images
Display taxonomies without an image attached (1 post)

  1. Rachel McCollin
    Member
    Posted 3 years ago #

    I am using the plugin to list the taxonomy images and titles for a custom post type.

    At the moment it is only displaying those items which have an image attached. Can anyone help me work out how to also display items with no image? Then I can use CSS to dimply an empty box with the taxonomy title overlaid, which would be consistent to the way I'm displaying those items with an image.

    The code I'm using is:

    $terms = apply_filters( 'taxonomy-images-get-terms', '', array('taxonomy' => 'collections', 'term-args' => array('having_images'=> 0 ,)) );
    	if ( ! empty( $terms ) ) {
        		echo '<ul class="collection-listing">';
        			foreach( (array) $terms as $term ) {
    				echo '<li>';
            			echo '<a title="'.$term->name.'" class="taxonomy-image" href="' . esc_url( get_term_link( $term, $term->taxonomy ) ) . '">' . wp_get_attachment_image( $term->image_id, 'thumbnail' ) . '</a>';
    				echo '<p class="taxonomy-title"><a title="'.$term->name.'" href="' . esc_url( get_term_link( $term, $term->taxonomy ) ) . '">' . $term->name . '</a></p>';
    				echo '</li>';
        				}
        			echo '</ul>';
    			}

    Thanks.

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

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

About this Topic

  • RSS feed for this topic
  • Started 3 years ago by Rachel McCollin
  • This topic is not resolved
  • WordPress version: 3.3.1