0

I have a custom post type called 'camps', which has tags associated with it, registered as 'camps_tag'

I have managed to list all of the posts from a certain category within the 'camps' cpt, but how can I list the tags associated with the post?

Any help would be greatly appreciated.

1 Answer 1

2

You want to look into the_terms or its big brother get_the_terms. It's how you display custom taxonomies on the front end -- similar to the_category or the_tags.

Example:

<?php
// somewhere in a template file, inside the loop
the_terms(
    $post->ID, // object ID
    'camps_tag', // your custom taxonomy
    '<p><strong>Tags: </strong></p>', // before the list
    ', ', // between list items
    '</p>' // after the list
);
1
  • Thank you, I wasn't sure if I was supposed to be looking at tags or taxonomy documentation. Will give that a go
    – Chris
    Nov 20, 2012 at 16:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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