Display Custom Taxonomy

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.

Read More

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.

Related posts

Leave a Reply

1 comment

  1. 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();
    }