Display DIV only if post is in most recent specific category (3 posts)

  1. ndisdabest
    Posted 3 years ago #

    I want to display a DIV atop a post, but only if said post is the most recent in a specific category. In this case, the name of that category is "episodes". Below is my code... what do I need to bolt onto my IF-statement to make this function properly?

    Thanks in advance!

    <?php if(in_category('episodes')){ ?>
    <div id="latest-ep" class="latest-ep">
    <p>Latest Episode</p>
    <?php }?>
  2. esmi
    Forum Moderator
    Posted 3 years ago #

    I can't see anything wrong with the code you posted above.

  3. Michael
    Forum Moderator
    Posted 3 years ago #

    where in what template of your theme are you using that code?

Topic Closed

This topic has been closed to new replies.

About this Topic