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 am using custom post types in a theme optimized for web radios (custom theme). I added a custom post type called "Radio Shows" and registered two custom taxonomies: one hierarchical (like default "categories", I named it GENRE) and the other is not (like "tags", I named it INSTRUMENTS).

I've managed to get that custom post type's posts displayed in index.php with the rest of the default post type's posts and also created a page template that displays only the custom post type's posts (Radio Shows).
It works fine, I can see them being displayed normally, in correct order etc. What's not being displayed in both pages (index & template page dedicated to custom post type) is the custom taxonomies.

In default posts, inside the loop are being displayed:

  1. CATEGORIES
  2. TITLE
  3. THUMBNAILS
  4. CONTENT
  5. TAGS.

What I want to achieve is to get GENRE & INSTRUMENT custom taxonomies displayed in the place that CATEGORIES & TAGS do in default post types.

Normally I should tell you what I have tried so far... well, I tried at least 20 ways I found on several tutorial websites so it's difficult to list them. None of them worked for me.

share|improve this question
    
What is the exact name you used to register the post type and the taxonomies? –  toscho Apr 20 '13 at 21:16
    
radio_show is the name of the post type and genre/instruments for the taxonomies –  ArgGeo Apr 20 '13 at 21:27

1 Answer 1

up vote 1 down vote accepted

Use the_terms():

the_terms( $id, $taxonomy, $before = '', $sep = ', ', $after = '' )

So in your loop:

if ( 'radio-shows' === get_post_type() )
{
    the_terms( get_the_ID(), 'genre' );
    the_terms( get_the_ID(), 'instruments' );
}
else
{
    the_category();
    the_tags();
}
share|improve this answer
    
Toscho thanks for the answer. Unfortunately only the ELSE works as it should in default post type posts. I get nothing in custom post type posts. EDIT: WORKS LIKE A CHARM! GOD BLESS YOU TOSCHO! THANKS A LOT!!! –  ArgGeo Apr 20 '13 at 21:15

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.