Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Adjusts homepage query if the "Magazine" template is used as the homepage.
if ( ! function_exists( 'woo_modify_magazine_homepage_query' ) ) {
function woo_modify_magazine_homepage_query ( $q ) {
if ( ! is_admin() && $q->is_main_query() && ( 0 < $q->query_vars['page_id'] ) && ( $q->query_vars['page_id'] == get_option( 'page_on_front' ) ) && ( 'template-magazine.php' == get_post_meta( intval( $q->query_vars['page_id'] ), '_wp_page_template', true ) ) ) {
$settings = woo_get_dynamic_values( array( 'magazine_limit' => get_option( 'posts_per_page' ) ) );
$q->set( 'posts_per_page', intval( $settings['magazine_limit'] ) );
$q->set( 'paged', intval( $q->query_vars['page'] ) );
$q->parse_query();
}
return $q;
} // End woo_modify_magazine_homepage_query()
}
add_filter( 'pre_get_posts', 'woo_modify_magazine_homepage_query' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.