• Hello.

    Is there a way to make a conditional about the post “age”? Let’s say I want to display something only if the post is not older than two days.

    Thanks in advance.

    Justine

Viewing 2 replies - 1 through 2 (of 2 total)
  • Such as:

    posts that are so may days old date (in this case 46 days)

    <?php
    $mylimit=46 * 86400; //days * seconds per day
    $post_age = date('U') - get_post_time('U');
    if ($post_age < $mylimit) {
    echo 'this post is within my date limit ';
    }
    ?>

    Thread Starter Justyna Ratajczak

    (@jusi)

    Thank you very much!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Conditional tag for post “age”?’ is closed to new replies.