WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to output on the homepage the posts from the lastest 3 days.

Like this:


    post 1
    post 2
    post 3


    post 1
    post 2
    post 3


    post 1
    post 2
    post 3

I tried:

On 30/03/12 I have 5 posts

On 29/03/12 I have 4 posts

On 28/03/12 I have 3 posts

So the 3rd day is missing now 2 posts.

Also I want to use this on the archive page.

3 days a page.

On page 2 the next 3 days.

Here is my loops file

<div id="post-<?php the_ID(); ?>" class="entry-box">
<?php $embed = get_post_meta(get_the_ID(), 'tj_video_embed', TRUE); ?>
<?php if($embed && (get_option('videoplus_fancybox_enable') == 'on')){
    $embed_url = '';
    $mode = '~http://[\d\w\s:/.]*~iS';
<a href="<?php echo $embed_url[0];?>" rel="bookmark" class="various fancybox.iframe">
<?php } else { ?>
    <a href="<?php the_permalink(); ?>" rel="bookmark">
<?php } ?>
    <?php if(has_post_thumbnail()){?>
        <?php the_post_thumbnail('entry-thumb', array('class' => 'entry-thumb')); ?>
    <?php } else { ?>
    <?php $img_url = get_post_meta(get_the_ID(), 'tj_video_img_url', TRUE); ?>
        <?php if($img_url != null) { ?><img src="<?php echo $img_url; ?>" alt="<?php the_title(); ?>" class="entry-thumb"/><?php } ?>
    <?php } ?>

    <?php if($embed) { ?>
        <div class="video-flag"></div>
    <?php }?>
<div class="entry-meta">
    <?php the_time('M j, Y'); ?> &middot; by <?php the_author_posts_link(); ?>
    <span class="entry-comment">
        <?php comments_popup_link( __( '0', 'theme junkie' ), __( '1', 'theme junkie' ), __( '%', 'theme junkie' ) ); ?>
</div><!-- .entry-meta -->
<h2 class="entry-title"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
<div class="entry-content">
    <p><?php the_excerpt(); ?></p>
</div><!-- .entry-content -->
</div><!-- #post-<?php the_ID(); ?> .entry-box -->
share|improve this question
Where are you excluding posts based on dates? – fdsa Jun 8 '12 at 2:33

Not a bad idea for display of a blog home page and I would be interested in what you came up with, but thinking through the idea for implementation beyond the first page would be problematic:

Pagination - If it is just the blog home then you can easily set an offset for starting on page 2, but if each page has a variable number of posts on it (could be one, could be 20 in the past 3 days?)

Archive home - Archives cover a lot of areas including tags, categories, date archives and others. I am not sure that this display would work for anything but the home page of each of these.

share|improve this answer
+1 for pagination issues. Variable amount of posts per page (and case of zero posts in page) would be complicated to neatly implement and possibly prohibitively expensive to compute. – Rarst Oct 15 '12 at 22:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.