Display only the posts published in a specific period
-
Hello everyone
I am having to create a custom loop to display posts published within a specific timeframe on a non-index, static page. I searched through the web for a clue with no luck.
So far, I wrote the following script:
<?php
global $wp_query, $paged;
$paged = ( get_query_var( ‘paged’ ) ) ? get_query_var( ‘paged’ ) : 1;
$args = array(
‘category_name’ => ‘property-detail’,
‘post_type’ => ‘post’,
‘posts_per_page’ => 3,
‘paged’ => $paged
);$catquery = new WP_Query($args);
while($catquery->have_posts()) : $catquery->the_post();echo “HTML mark-up”;
?>
<?php endwhile;
echo ‘<nav class=”pagination”>’.pagination_bar( $catquery ).'</nav>’;
wp_reset_postdata();
?>I want the loop to iterate through the fourth latest post to the sixth latest post only. Could someone please teach me how that can be done?
Thank you in advance,
Ead
- The topic ‘Display only the posts published in a specific period’ is closed to new replies.