Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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
1  
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

3 Answers 3

@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

Try

wp_list_categories('taxonomy=operating_system'); 
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

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

Your Answer

 
discard

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.