I have a wordpress site where my most recent post is displayed on the home page larger than my other posts. Starting at post number 2, the posts are displayed in a grid. I have pagination for 6 posts per page except for the first page, I need seven posts because of the fact that the most recent post is the largest and takes up two grid spaces. I am able to accomplish this with the plugin Custom Post Limits but I want to know if there is a way to do it without relying on a plugin. I have tried pre_get_posts, but don't know how to specify 7 posts on page 1 and 6 posts on every page after that.

I've tried something along these lines, but it doesn't work. Please help!

function custom_posts_per_page($query) {
    if ($query->is_home() && $query->is_main_query()) {
       $query->set('posts_per_page', '7');

    if (!$query->is_home() && !$query->is_main_query()) {
       $query->set('posts_per_page', '6');

add_action('pre_get_posts', 'custom_posts_per_page');

1 Answer 1


You should take another approach. On home page, you have to make 2 queries:

one for latest post with parameters post_per_page=1 to display the latest post;

and second query with parameters post_per_page=6&offset=1 to display other posts (except latest) with pagination: 6 posts per page.

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.