Set Different Amount of Posts Per Page For Each Archive

This code enables you to set a different amount of posts per archive page, otherwise use the default WordPress Reading settings.

The example snippet in this tutorial sets a specific amount of posts per page for any number of categories, otherwise it uses the posts per page limit set in your WordPress Reading settings.

On top of this, it also includes a specific limit for search results pages and the home page.

To use this code, simply swap out the conditional tags for any type of archive and use your own I.D’s for each archive type.

Note for Genesis users: To set the posts per page for any pages using the Blog Page template, use the Genesis > Theme Settings > Blog Page Template settings as seen in the following image:

genesis-blog-page-template

Here’s the code for logged in members, you can simply paste in your functions file. Works in any theme.


Comments

2 responses to “Set Different Amount of Posts Per Page For Each Archive”

  1. HEM111703 Avatar

    Hello – I only want to set the number of posts for my archive page called ‘Portfolio’. I want the blog page and everything else to remain the same. How should this code be altered to change just the archive page posts?

    1. Brad Dalton Avatar
      Brad Dalton

      Using a code editor, please add this code to your functions file

Leave a Reply

Join 5000+ Followers

Get The Latest Free & Premium Tutorials Delivered The Second They’re Published.