Support » Fixing WordPress » Date Question – brain fart

  • I’ve been sick so please forgive the stupid question… How is it again that I would check (in the Loop) as to if the date of an entry is greater than 30 days old and display a block of code accordingly?

Viewing 1 replies (of 1 total)
  • I recently posted this (but can’t locate the thread…):

    <?php
    $days_since = floor((date('U') - get_the_time('U')) / 86400);
    if($days_since >= 30) :
    ?>
    ~ This displays if post 30 days or older ~
    <?php endif; ?>

    Change:

    if($days_since >= 30) :

    to:

    if($days_since > 30) :

    For just ‘greater than’ 30 days.

Viewing 1 replies (of 1 total)
  • The topic ‘Date Question – brain fart’ is closed to new replies.