Displaying Default Tag Image
-
<?php $posttags = get_the_tags(); if ($posttags) { foreach($posttags as $tag) { echo '<img src="https://hateyourway.org/log/tags/' . $tag->term_id . '.png" alt="' . $tag->name . '" />'; }} ?>
What I am wanting to do is add some sort of else statement stating if that there is no tag selected it displays text in place of the original image.
Meaning…if I tag my sister, it’ll display a picture corresponding to that number on the tag. If I tag no one in the post; I want it to display: No One Was Tagged. How would I go about this? Every time I try to add an else statement it gives me a string (unexpected) error.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Displaying Default Tag Image’ is closed to new replies.