Forums

If post is older than x days (2 posts)

  1. poil11
    Member
    Posted 1 month ago #

    I want to do an if statement where, if post is newer than this date do this, but if post is older than this date do that

    Anyone have any ideas?

  2. poil11
    Member
    Posted 1 month ago #

    <?php
    $today = date("r");
    $articledate = get_the_time('r');
    $difference = round((strtotime($today) - strtotime($articledate))/(24*60*60),0);

    if ($difference >= 25) {
    Do Stuff Here
    }else{
    Do Stuff Here
    }
    ?>

Reply

You must log in to post.

About this Topic

Tags