WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to display taxonomies instead of categories on the homepage of my blog. What can I do to achieve this?

share|improve this question
If you want a good answer, you are going to have to explain yourself a little better. Where are the categories currently displayed? How are they displayed? What code are you using right now to display the categories? – Jared Jan 19 '12 at 10:56

I think what you are looking for is this: http://codex.wordpress.org/Function_Reference/get_terms

Example of how to get all my_taxonomy terms and echo them in an unordered list.

 $terms = get_terms( "my_taxonomy" );
 $count = count( $terms );
 if ( $count > 0 ){
     echo "<ul>";
     foreach ( $terms as $term ) {
       echo "<li>$term->name</li>";
     echo "</ul>";
share|improve this answer
i dont want to display taxonomy in list format. i want to display in the form of post. – neha Jan 17 '12 at 10:55
@neha Well, you can use the $terms variable for anything, I was just giving you an example of how to grab all of the terms from a custom taxonomy and do something with them. :) I don't know exactly what you are trying to do with the terms so that is as specific as anyone can get. – Jared Jan 17 '12 at 11:35
i exactly want to display post by term of taxonomy instead of categories. will u guide me if u know the exact code .if u know then please tell me also in which exact file i replace your code. – neha Jan 18 '12 at 5:49
@neha The problem is I don't know exactly what you are trying to do, so I wouldn't know where you need to put the code. I suggest if you don't know much about PHP and WordPress to not go about trying to code things yourself. If you insist on coding it yourself anyways without prior PHP knowledge, you are going to have to play around with the code I posted above until it works how you want it, as it is the function you are looking for. – Jared Jan 18 '12 at 8:18
i know PHP and wordpress but problem is that i want the suitable code for my query.actually my boss doesnt want the taxonomy in list format . i used this code already thats y i want new code to fulfill boss requirement. – neha Jan 18 '12 at 9:04

@neha In the code posted by Jared, please look at this line --> echo "<li>$term->name</li>

That's what made the output into a list.

For anyone to suggest the code, you should've mentioned how would you like to have it output?

Say, for a big title --> echo "<h1>$term->name</h1>
Or, into a blockquote --> echo "<blockquote>$term->name</blockquote> Or, as a regular paragraph --> echo "<p>$term->name</p>

How exactly would you like it to be displayed?

share|improve this answer


share|improve this answer
what's this what do u want to say?? In which file i replace this code?? i want to display post in terms of taxonomy instead of categories. – neha Jan 18 '12 at 5:50

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.