Title: Show Posts in last 3 days
Last modified: August 19, 2016

---

# Show Posts in last 3 days

 *  [josephgene](https://wordpress.org/support/users/josephgene/)
 * (@josephgene)
 * [17 years, 8 months ago](https://wordpress.org/support/topic/show-posts-1/)
 * How do i have wordpress show posts from a date range, say, the last 3 days, as
   opposed to the last 3 posts?
 * Can this happen?
 * -Joe!

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [MichaelH](https://wordpress.org/support/users/michaelh/)
 * (@michaelh)
 * [17 years, 8 months ago](https://wordpress.org/support/topic/show-posts-1/#post-873509)
 * This code in [your loop](http://codex.wordpress.org/The_Loop) will print ‘this
   post is within my date limit’ if the post date is within the last 3 days:
 *     ```
       <?php
       $mylimit= 3 * 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 [josephgene](https://wordpress.org/support/users/josephgene/)
 * (@josephgene)
 * [17 years, 8 months ago](https://wordpress.org/support/topic/show-posts-1/#post-873638)
 *     ```
       <div id="container">
       <div id="main-col">
       <h3 class="blog-title"><a href="<?php echo get_option('home'); ?>/"><em><?php bloginfo('name'); ?></em></a></h3>
       <span class="logo-spacer"></span>
       <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
       	<div class="post" id="post-<?php the_ID(); ?>">
           	<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>
               <div class="date"><span class="year"><?php the_time('Y') ?></span> <?php the_time('F') ?> <span class="day"><?php the_time('jS') ?></span></div>
               <div class="comments"><span class="comment-count"><?php comments_popup_link('0', '1', '%'); ?></span> Comments</div>
               <br clear="all" />
               <div class="excerpt"><?php the_content('Read the rest of this entry &raquo;'); ?></div>
           </div>
           <div class="filed">Filed under <?php the_category(', ') ?> by <?php the_author() ?> on <?php the_time('F jS, Y') ?> @ <?php the_time() ?> </div>
           <span class="spacer"></span>
       <?php endwhile; else: ?>
       <p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
       <?php endif; ?>
           </div>
       ```
   
 * So if this is my loop on home.php – then the code goes where?
 *  Thread Starter [josephgene](https://wordpress.org/support/users/josephgene/)
 * (@josephgene)
 * [17 years, 8 months ago](https://wordpress.org/support/topic/show-posts-1/#post-873666)
 * bump^^?
 *  Thread Starter [josephgene](https://wordpress.org/support/users/josephgene/)
 * (@josephgene)
 * [17 years, 8 months ago](https://wordpress.org/support/topic/show-posts-1/#post-873680)
 * Double bump?^^

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Show Posts in last 3 days’ is closed to new replies.

## Tags

 * [date](https://wordpress.org/support/topic-tag/date/)
 * [day](https://wordpress.org/support/topic-tag/day/)
 * [posts](https://wordpress.org/support/topic-tag/posts/)
 * [range](https://wordpress.org/support/topic-tag/range/)

 * 4 replies
 * 2 participants
 * Last reply from: [josephgene](https://wordpress.org/support/users/josephgene/)
 * Last activity: [17 years, 8 months ago](https://wordpress.org/support/topic/show-posts-1/#post-873680)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
