Created
August 30, 2012 14:47
-
-
Save billerickson/3529963 to your computer and use it in GitHub Desktop.
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
<?php | |
/** | |
* Fix Numeric Nav | |
* | |
* The numeric nav uses the current posts-per-page to | |
* calculate how many pages there are. If your homepage | |
* displays a different number than inner pages, there | |
* will be more pages listed on the homepage. This fixes it. | |
* | |
*/ | |
function be_fix_numeric_nav() { | |
if( get_query_var( 'paged' ) ) | |
return; | |
global $wp_query; | |
$grid_args = be_grid_loop_pagination(); | |
$max = ceil ( ( $wp_query->found_posts - $grid_args['features_on_front'] - $grid_args['teasers_on_front'] ) / ( $grid_args['features_inside'] + $grid_args['teasers_inside'] ) ) + 1; | |
$wp_query->max_num_pages = $max; | |
} | |
add_filter( 'genesis_after_endwhile', 'be_fix_numeric_nav', 5 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment