• Resolved silvermerc

    (@silvermerc)


    I have found a similar post to this but the thread was declared resolved without giving any real explanation of how to do this.

    I want to be able to display 2 posts on my home page and 10 when using catergories in the archives page. At the moment I can only set the generic number of posts to be displayed which sets it for the whole site.

    Can anyone point me in the right direciton or feedback with a workable solution?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Custom Query String Reloaded plugin will do that.

    Or something like this in your archive template:

    <?php
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    $args=array(
      'showposts'=>10,
      'paged'=>$paged
       );
    global $wp_query;
    query_posts(array_merge($args,$wp_query->query)
    );
    ?>
    
    <?php //your loop etc starts here
    while (have_posts()) : the_post();
    ?>

    Thread Starter silvermerc

    (@silvermerc)

    I appreciate the quick response.

    I might be being a little dim but I can’t find that plugin?

    Thread Starter silvermerc

    (@silvermerc)

    got it now

    Many thanks – looks perfect for the job

    I have two archive templates one that shows 18 post and the other 5 posts.
    My site is setup with 6 parent categories and 1 parent category with 5 sub categories.

    The archive template that shows 5 posts will paginate to the second page, but if i could to the third page, it sends me to my 18 post archive template blank. The sub categories however don’t even make it past the first page of pagination. Any clues?

    Hope I’ve made myself clear, it’s a bit confusing to sort out.

    Never mind, I found a work around. I basically just added the code you provided to my archive template with the 18 posts and change my global posts per page to 5. Thanks.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Can I customize number of displayed posts per page’ is closed to new replies.