Display list of taxonomies, but only if other taxonomy is specific.
-
I have a custom post-type that has 2 custom taxonomies.
I want a list one of those taxonomies (containing posts), but only if the other taxonomy for the same post is set to a specific value.What I have is:
<?php $taxA= get_terms("taxA"); ?> <?php foreach ($taxA as $A): ?> <?php echo $A->name; ?> <?php endforeach; ?>
Suppose I have 3 posts as follows:
Post-1 : TaxA = “alpha”, TaxB = “green”
Post-2 : TaxA = “beta”, TaxB = “red”
Post-3 : TaxA = “gamma”, TaxB = “green”The above code will list: alpha, beta, gamma. But I only want to list when TaxB is green, so the list should be: alpha, gamma.
I hope this makes sense? Does anyone know how to do this?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Display list of taxonomies, but only if other taxonomy is specific.’ is closed to new replies.