Support » Plugins and Hacks » Override Posts Per Page

  • Resolved Daven

    (@daven)


    I’m trying to create some custom category archive pages for my site, and one thing that is happeneing that I don’t want happening is that they are obeying the default “Posts per page” that I have set at 10.

    I want only 10 posts displaying on my front page (index.php) and on these new category-xx.php pages I want just a list of links, say 40 of them per page before it goes to another page.

    Is there a code snippet to do this, or am I going to have to live with having only 10 links on the category-xx pages?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Nevermind, found it. Went hunting on Google. This is what I found:

    * Either edit your category.php file, or if it doesn’t exist, copy your index.php file to category.php.
    * look for this line:
    < ?php get_header(); ?>
    and change it to the following:
    < ?php get_header(); query_posts( ‘posts_per_page=-1&cat=’ . $cat ) ?>
    * That’s all, your finished. The -1 in posts_per_page lets WordPress know you want all posts to be shown and it overrides the setting in your options.

    Think I’ll go try it out.

    Worked like a dream. Replaced it at the top of the page, and now I have all the links on one page that I can direct people to in my site.

    Thanks WordPress! LOL

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Override Posts Per Page’ is closed to new replies.