WordPress.org

Support

Support » Requests and Feedback » [Resolved] restrict no. of posts (outside a template)

[Resolved] 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).

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] restrict no. of posts (outside a template)’ is closed to new replies.
Skip to toolbar