Created
June 19, 2012 04:51
-
-
Save syamilmj/2952342 to your computer and use it in GitHub Desktop.
Fix pagination error on homepage WP3.4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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' ); |
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
Excellent. Works like a charm! Thanks.