Support » Plugin: Taxonomy Images » [Plugin: Taxonomy Images] Display taxonomies without an image attached

  • 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>';


  • The topic ‘[Plugin: Taxonomy Images] Display taxonomies without an image attached’ is closed to new replies.