WordPress.org

Ready to get started?Download WordPress

Forums

Date Question - brain fart (2 posts)

  1. abrazell
    Member
    Posted 8 years ago #

    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?

  2. Kafkaesqui

    Posted 8 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic