Title: taxonomy-$taxonomy.php template issues
Last modified: August 21, 2016

---

# taxonomy-$taxonomy.php template issues

 *  Resolved [Dan](https://wordpress.org/support/users/danrip/)
 * (@danrip)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/taxonomy-taxonomyphp-template-issues/)
 * Giving myself grey hairs over this one. Much appreciated if anyone can help out.
 * I have a custom post type – Locations. It has a custom taxonomy – Triptypes. 
   The taxonomy has 8 terms in it. The 8 terms are assigned to their relevant posts.
 * What query / content do I need to put in the ‘taxonomy-triptypes.php’ file for
   it to render just those 8 terms on a page (NOT the posts assigned to them)?
 * The posts in the terms display fine with ‘taxonomy-triptypes-term-name.php – 
   but I can’t seem to hit on a solution to display the terms themselves (and I’ve
   tried more than a few…)
 * What am I missing?
 * Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [Predrag – WPMU DEV Support](https://wordpress.org/support/users/wpmudev-support1/)
 * (@wpmudev-support1)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/taxonomy-taxonomyphp-template-issues/#post-4370572)
 * Hi [@dan](https://wordpress.org/support/users/dan/),
 * Have you tried using [get_terms()](http://codex.wordpress.org/Function_Reference/get_terms)
   function as following.
 *     ```
       $terms = get_terms("triptypes");
        $count = count($terms);
        if ( $count > 0 ){
            echo "<ul>";
            foreach ( $terms as $term ) {
              echo "<li>" . $term->name . "</li>";
   
            }
            echo "</ul>";
        }
       ```
   
 * Kind Regards,
 *  Thread Starter [Dan](https://wordpress.org/support/users/danrip/)
 * (@danrip)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/taxonomy-taxonomyphp-template-issues/#post-4370576)
 * Ahh, thank you WPMU DEV!! You rock!
 * Actually, I had used get_terms(), but I can see now that I’d dropped the crucial‘
   $term->name’ in my attempts to merge the query into the way the rest of the page
   is displayed, namely:
 *     ```
       $triptype_featured_images = wp_get_attachment_image_src( get_post_thumbnail_id( ), 'triptype-big-featured' );
       			echo '<article class="' . implode( ' ', get_post_class() ) . '" itemtype="http://schema.org/ItemList" itemscope="itemscope">';
       				echo '<h2 class="entry-title"><a href="'. get_permalink() .'" title="'. get_the_title() .'">'. get_the_title() .'</a></h2>';
       				echo '<a href="'. get_permalink() .'" title="'. get_the_title() .'" class="location-hover">';
       					the_excerpt();
       				echo '</a>';
       				echo '<img class="aligncenter" src="'. $triptype_featured_images[0] .'" alt="'. get_the_title() .'"></a>';
       			echo '</article>';
       }
       }
       }
       ```
   
 * Can I ask – where would I drop $term->name into this? I’m using it from elsewhere
   in the site, and want to keep the layout uniform.
 * Thank you
 *  [Predrag – WPMU DEV Support](https://wordpress.org/support/users/wpmudev-support1/)
 * (@wpmudev-support1)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/taxonomy-taxonomyphp-template-issues/#post-4370577)
 * Hi [@dan](https://wordpress.org/support/users/dan/),
 * You are most welcome.
 * You can add it anywhere in between opening and closing <article> tag.
    Example:
 *     ```
       $triptype_featured_images = wp_get_attachment_image_src( get_post_thumbnail_id( ), 'triptype-big-featured' );
       echo '<article class="' . implode( ' ', get_post_class() ) . '" itemtype="http://schema.org/ItemList" itemscope="itemscope">';
       	echo '<h2 class="entry-title"><a href="'. get_permalink() .'" title="'. get_the_title() .'">'. get_the_title() .'</a></h2>';
       	echo '<a href="'. get_permalink() .'" title="'. get_the_title() .'" class="location-hover">';
       		the_excerpt();
       	echo '</a>';
       	echo '<img class="aligncenter" src="'. $triptype_featured_images[0] .'" alt="'. get_the_title() .'"></a>';
       	$terms = get_terms("triptypes");
       	$count = count($terms);
       	if ( $count > 0 ){
       		echo "<ul>";
       		foreach ( $terms as $term ) {
       		echo "<li>" . $term->name . "</li>";
   
       		}
       		echo "</ul>";
       	}
       echo '</article>';
       ```
   
 * Cheers.
 *  Thread Starter [Dan](https://wordpress.org/support/users/danrip/)
 * (@danrip)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/taxonomy-taxonomyphp-template-issues/#post-4370588)
 * FIXED! 🙂 *happy-dance* You definitely put me on the right road with that one–
   thank you so much!
 * Once I’d found get_term_link too, it all started coming together. Here’s where
   I ended up:
 *     ```
       $terms = get_terms('triptypes');
       	foreach ($terms as $term) {
       	$term_link = get_term_link( $term, 'triptypes' );
       	if( is_wp_error( $term_link ) )
               continue;
       	$triptype_featured_images = wp_get_attachment_image_src( get_post_thumbnail_id( ), 'triptype-big-featured' );
       	echo '<article class="' . implode( ' ', get_post_class() ) . '"  itemtype="http://schema.org/ItemList" itemscope="itemscope">';
       	echo '<h2 class="entry-title"><a href="'. $term_link .'" title="'. $term->name .'">'. $term->name .'</a></h2>';
       	echo '<a href="'. $term_link .'" title="'. $term->name .'" class="location-hover">';
       		the_excerpt();
       	echo '</a>';
       	echo '<img class="aligncenter" src="'. $triptype_featured_images[0] .'" alt="'. get_the_title() .'"></a>';
       	echo '</article>';
       ```
   
 * ..and once I’d flushed the permalinks, voila!
 * Thanks again, your help was invaluable!

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘taxonomy-$taxonomy.php template issues’ is closed to new replies.

## Tags

 * [custom taxonomy](https://wordpress.org/support/topic-tag/custom-taxonomy/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 2 participants
 * Last reply from: [Dan](https://wordpress.org/support/users/danrip/)
 * Last activity: [12 years, 6 months ago](https://wordpress.org/support/topic/taxonomy-taxonomyphp-template-issues/#post-4370588)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
