restrict no. of posts (outside a template)
-
I have this code on the start page of a site:
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
“><?php the_title(); ?>
<?php endwhile; else: ?>
<?php _e(‘Sorry, no posts matched your criteria.’); ?>
<?php endif; ?>
which does what it’s meant to do: it shows the titles of recent posts as links.
Now I want to restrict the number of posts to maybe 5 (the most recent ones, whatever category they may belong to) without limiting the no. of posts shown on the category pages (or elsewhere).
How can I achieve this goal? (NB: I have searched the archives but all the solutions mentioned there didn’t help me at all. Or maybe I’m just a bit too dumb).
- The topic ‘restrict no. of posts (outside a template)’ is closed to new replies.