Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

This comment has been minimized.

Copy link

@stevejenkins stevejenkins commented Oct 13, 2012

Excellent. Works like a charm! Thanks.

@nettime

This comment has been minimized.

Copy link

@nettime 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