WordPress.org

Forums

Post Date (4 posts)

  1. ezs1
    Member
    Posted 6 years ago #

    How to show posts where post date >= date('n',current_time('timestamp')) ?

  2. ezs1
    Member
    Posted 6 years ago #

    Anybody knows how to do it?

  3. Fill in the Blank
    Member
    Posted 6 years ago #

    I do this

    <?php $recent = new WP_Query("orderby=post_date&order=desc"); while($recent->have_posts()) : $recent->the_post();?>
    <?php if ( (current_time(timestamp) - get_the_time('U') - (get_settings('gmt_offset') * 3600) ) < (3*(60*60*24))) { ?>
    <!-- content -->
    <?php } endwhile; ?>

  4. Fill in the Blank
    Member
    Posted 6 years ago #

    sorry, this:

    <?php $recent = new WP_Query("orderby=post_date&order=desc"); while($recent->have_posts()) : $recent->the_post();?>
    <?php if ( (current_time(timestamp) - get_the_time('U') - (get_settings('gmt_offset') * 3600) ) < (3*(60*60*24))) { ?>
    <!-- content -->
    <?php } endwhile; ?>

    But I do find that it is a little finiky if you do it twice in one php page... but have at it!

    (3*(60*60*24))) is the time...
    it is in seconds (60 sec * 60 min * 24 hours) * 3 days

Topic Closed

This topic has been closed to new replies.

About this Topic