1

How do I display different number of posts on the home page and archive pages, the archive pages can use the value set in the admin, but I want a custom number of posts to be displayed on the home page with pagination. Thanks.

1 Answer 1

2

This can be done with a very short plugin.

function posts_on_home_page( $posts_per_page ) {
    if ( is_home() )
        return 5;
    return $posts_per_page;
}

add_filter( 'pre_option_posts_per_page', 'posts_on_home_page' );

This is actually pretty close to the Codex example for pre_option_(option_name).

1
  • But is there a way to distinguish home.com from home.com/page/2/
    – bodesam
    Commented Oct 29, 2014 at 22:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.