0

I have a Custom Post Type named companion. Via Companion I create articles which are then associated with my custom taxonomy issueCompanion. Imagine issueCompanion as a publication which is released periodically, like a magazine. I have another custom Taxonomy called 'topic' which acts like categories, and is associated with each article in companion.

I display this on the front-end via taxonomy-issueCompanion.php. On this page, I have to display the topic of each article, next to each article. The articles are easy to pull in because they come with the regular wordpress loop (if have_posts(), while have_posts()), but I can't seem to get to the topic taxonomy of each displayed article.

How do I display each article's corresponding issue? In other words, how do I display a custom taxonomy (topic) on a custom post type's post (companion)? I feel like I've done this 100 times but it doesn't seem to work for me this time.

Thank you for any input

0

Inside of your loop on the taxonomy-issueCompanion.php template file you can retrieve the terms of the taxonomy that are attached to the post.

// Inside of your while loop 
$post_topics = get_the_terms($post->ID, 'topic');

// And then you can do as you wish with your topics!

  • I had this backwards... Thanks for setting my head straight, I need a break now. – Hewe Jun 24 at 18:48

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.