WordPress.org

Support

Post Date

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

Viewing 3 replies - 1 through 3 (of 3 total)
  • Anybody knows how to do it?

    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; ?>

    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

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Post Date’ is closed to new replies.
Skip to toolbar