Conditional tag for if a post has a certain tag
-
Short version: I need a way to say (in single.php) “if (tag=breaking)”. I can take it from there.
Long version: I’m working on a newspaper website for my college. I’m really excited about and I’m sure this won’t be my first post in the support forums. What my issue is right now is this: I don’t want to display the time something was published (since we’re a weekly, there’s no sense in putting the time). I still want the date, of course, and I know how to code that easily. What I want to do is put a time (XX:XX XM) if a post has the tag, “breaking.” Meaning, for breaking stories, I want the time the post was last updated. I’m using a plugin to show the post updated, but I can’t figure out how to code single.php to display the post_updated when its a breaking story, and just the regular date when it’s not.
I found the “is_tag()” conditional tag, but then I realized that’s for if the post is being displayed on the tags own archive page.
FYI: Here’s the code I’m using right now:
<span class="time"> <?php ***if-is-tag=breaking*** { echo "This breaking story was last updated on"; post_updated('F jS, Y \at h:i:s A', 0, '', ''); } else { the_time('F jS, Y'); } ?> </span>
Obviously, that *’ed part is what I’m asking for.
Thanks for all the help!
- The topic ‘Conditional tag for if a post has a certain tag’ is closed to new replies.