pre_get_posts and pagination (1 post)

  1. MadysonDesigns
    Posted 3 years ago #

    I can not for the life of me get a modified main query and pagination working together.

    Desired outcome:

    On home template, custom query (with new wp_query) and main query both running. Custom query grabs one post and main query grabs the rest (with offset)

    What I have:

    if ( $query->is_home() && $query->is_main_query() ) { // Run only on the homepage
    	$query->set('offset', 1);

    The offset works correctly only on the main loop on the home page but pagination is broken.

    If I remove the 'is_main_query' function, pagination works correctly but the offset runs on all queries including the wp_query custom one.

    Grabbing the $paged query vars and adding them to the query does not help.


Topic Closed

This topic has been closed to new replies.

About this Topic

  • RSS feed for this topic
  • Started 3 years ago by MadysonDesigns
  • This topic is not resolved
  • WordPress version: 3.4.2