Skip to content

Instantly share code, notes, and snippets.

@syamilmj
Created June 19, 2012 04:51
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save syamilmj/2952342 to your computer and use it in GitHub Desktop.
Save syamilmj/2952342 to your computer and use it in GitHub Desktop.
Fix pagination error on homepage WP3.4
//Fix for home page navigation error on WP 3.4
function aq_query_for_homepage( $query ) {
global $paged;
if(get_option('lp_include_reviews') == "true") { $include_reviews = "reviews"; }
if(get_option('lp_include_videos') == "true") { $include_videos = "videos"; }
if(get_option('lp_include_screenshots') == "true") { $include_screenshots = "screenshots"; }
if( $query->is_main_query() && $query->is_home() ) {
$query->set( 'post_type', array( 'post', $include_reviews, $include_videos, $include_screenshots ) );
}
}
add_action( 'pre_get_posts', 'aq_query_for_homepage' );
@stevejenkins
Copy link

Excellent. Works like a charm! Thanks.

@nettime
Copy link

nettime commented Mar 5, 2013

Much thanks for this!! Would have been a complete show stopper.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment