0

I'm not having much luck trying to find anything to help with this...

I have a custom taxonomy('XYZ') archive all the posts in this archive also have an other common custom taxonomy('ABC').

I'm looking for a way to echo the other custom taxonomy similar to <?php single_term_title(); ?> something like <?php single_term_title_ABC(); ?>

Does this make sense?

0

1 Answer 1

1

To get the terms applied to a post from a certain taxonomy, use wp_get_post_terms. Inside the loop add:

$abcterms = wp_get_post_terms( $post->ID, 'ABC');
foreach($abcterms as $abc) echo $abc->name;
2
  • Can I push my luck and ask if you know of a way to echo nothing/blank if the custom taxonomy has more than 1 term on the archive page?
    – Pete
    Jan 4, 2018 at 1:10
  • are the terms passed in the query? and display blank for what? your question is not clear, it would be better if you created a new qs with details.
    – inarilo
    Jan 4, 2018 at 15:25

Your Answer

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

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