WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. ndisdabest
    Member
    Posted 1 year 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>
    </div>
    <?php }?>
  2. esmi
    Forum Moderator
    Posted 1 year ago #

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

  3. alchymyth
    Forum Moderator
    Posted 1 year 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