0

I've trying to search high and low for this but am having a really hard time.

Essentially, I have a custom post type called locations with taxonomies. The posts in "locations" are categorized under several taxonomies called markets, products, size, country, etc."

I just need to know how I can get it so my custom post type on the front end displays what taxonomies the post is categorized into. Does anyone know how I can do that?

To clarify, I just basically need to emulate this page to a tee (which is a drupal site) where you can see what categories the post if under.

http://www.playtime.com/Acadiana-Mall-Lafayette-LA

Would greatly appreciate ANY guidance or feedback.

2 Answers 2

0

As there's multiple Taxonomies, you will need to loop through all of the assigned taxonomies of that post type. get_object_taxonomies is the function which returns array of post type taxonomies.

global $post;
foreach ( get_object_taxonomies( $post ) as $tax_name ){
    $taxonomy = get_taxonomy( $tax_name );
    $label = $taxonomy->labels->name;

    the_terms( $post->ID, $tax_name, $label . ': ', ', ' );
}
1
  • AWESOME! That helped so much and got what I needed. You're a rockstar. Thank you. Aug 13, 2014 at 1:59
1

I think this is what you are looking for the_terms

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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