I have setup two custom taxonomies for a custom post type that I have created. The post type is called beer, and the two taxonomies are country and brewers.
I would like to list them like this.
Country
-->Brewers
----->Beers
I can pull the countries using this code.
$terms_country = get_terms('country');
foreach ($terms_country as $term_country) {
echo "<h3 class="country-heading" id="".$term_country->slug."">";
echo '<a href="/beers/country/' . $term_country->name . '">' . $term_country->name . '</a>';
echo "</h3>";
I need to query the country term to list the Brewers that have that taxonomy attached to the post as well.
NOTE: This answer is supposed to be in addition to the answer here
The function used returns an array of all the items, so the best way to display them is to use a foreach loop. As a usage example
In case you changed the
get_col
toget_results
to query more details about the terms, the foreach loop changes just a little