I want to display a text with a specific tag in wordpress.
Ex: I have 2 tags: car and boat, and 2 text: “I have car and i want one bike”, “I have boat and i am happy”
I want to display in header specific text when exist tag.
I try using tem exist in header.php but display text in all pages, not just in page where exist tag.
Ex:
<?php
$boat = term_exists('boat', 'post_tag');
if ($boat !== 0 && $boat !== null) {
echo "I have boat and i am happy!";
}
?>
If you have only two tags this will do.