conditional tag for terms
-
I’m using terms like Limburg, Noord-Brabant etc. in the taxonomy called Region. I’m listing these terms with specific links. But I only want the links to show up if the term is active (Actually selected in the post). so far this is the code I’m using.
<?php if (term_exists('limburg')): ?><a href="https://www.somedomain.com/?eventtype=sport®io=limburg" title="Limburg">Limburg</a><?php endif; ?> <?php if (term_exists('noord-brabant')): ?><a href="https://www.somedomain.com/?eventtype=sport®io=noord-brabant" title="Noord-Brabant">Noord-Brabant</a><?php endif; ?>
The problem with “term_exist” is that it makes the link appear when the term is present but doesn’t check whether it has posts that use it. Anyone know how to solve this?
Viewing 13 replies - 1 through 13 (of 13 total)
Viewing 13 replies - 1 through 13 (of 13 total)
- The topic ‘conditional tag for terms’ is closed to new replies.