Display posts in 3 days chunk

I want to display posts from the past 3 days, ordered by meta_value_num. Then when you reach the final page, I want to loop through another 3 days and show those posts. So navigation never ends, the user can browse through every published post…

How can I do this? My WP_Query() arguments are:

$args = array(
    'post_status' => 'publish',
    'posts_per_page' => 5,
    'paged' => $paged,
    'order' => 'DESC',
    'orderby' => 'meta_value_num',
    'meta_key' => '__votes',
    'date_query' => array(
        array(
            'after' => '3 days ago'
        )
    )
);

That shows posts from last 3 days. 

1 Answer
1

It may be that you could use some sort of lazy loading plugin. This could be done in a custom way using admin_ajax and adding user events but there are a number of plugins available that may be able to help out.

This plugin – https://wordpress.org/plugins/ajax-load-more/ – allows for the implementation of the lazy loading of posts and may be what you require.

Leave a Comment