• I’m looking for a way to pull up taxonomy terms that are featured in the same posts together.

    For example, I have a template which is taxonomy-character.php

    I have a piece of code in the template which will grab the name of the character:

    <div class="visited"><?php $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); echo $term->name; ?> has visited:</div>

    After the “has visited” I’d like it to display a list of terms from a taxonomy called “Planets”, if those planets are mentioned in any of the same posts as the character.

    So assuming all posts have their respective terms entered in their respective taxonomies, if the character were Luke Skywalker, and his name were tagged in a post that mentions the planet Bespin, and in another post about him growing up on Tatooine, it would say:

    Luke Skywalker has visited: Bespin, Tatooine

    Pulling up the name of the character was no problem, but getting those associated terms from other taxonomies seems to be tricky. Any help would be appreciated.

    Thank you for your time.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Displaying taxonomy terms that appear in the same posts together?’ is closed to new replies.