• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WP SITES

2665

Original Genesis Tutorials & 5000+ Guaranteed Code

Snippets

  • Support
  • Newsletter
  • Videos
  • Log in

Premium Member? - Request custom code

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.

Register for full access

pre_get_posts

Reader Interactions

Comments

  1. HEM111703 says

    December 21, 2016 at 11:34 am

    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?

    Log in to Reply
    • Brad Dalton says

      December 21, 2016 at 4:03 pm

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

      Log in to Reply

Leave a Reply Cancel reply

You must be logged in to post a comment.

Primary Sidebar

PHP Code

template_include

get_body_class

if else

array

class_exists

foreach

sprintf

add_action

printf

variable

Advertise · WPEngine · Genesis · Log in

  • How Premium Membership Works
  • Sign Up
  • Support
  • Subscription Details/Invoice
  • Tagged Tutorials
  • Access-Download Problems