Limit the number of posts via wpquery
We suppose that a category has 1000 posts, we can use the following code to show 10 posts per page and the wp pagenavi would present 100 pages with links of above 1000 posts.
?php query_posts($query_string."showposts=10orderby=dateorder=ASC") ?
Is there any way that I show only 100 recent posts and hide remaining 900 posts because they may be too old? I used the numberpost but it did not work. My code is as follows:
?php query_posts($query_string."showposts=10numberposts=100orderby=dateorder=ASC") ?
?php
$mypage = (get_query_var('paged')) ? get_query_var('paged') : 1;
$ppp = get_query_var('posts_per_page');
$counter = ($mypage * $ppp) - $ppp;
while(have_posts()) : the_post();
$counter++; // that pushes the zero based counter up one ?
span class="num"?php edit_post_link('♪'); ??php echo $counter;?. /span
?php echo get_the_title(); ?
?php endwhile; ?
Thanks
Topic plugin-wp-pagenavi wp-query Wordpress
Category Web