Skip to content

Instantly share code, notes, and snippets.

@billerickson
Created August 30, 2012 14:47
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save billerickson/3529963 to your computer and use it in GitHub Desktop.
Save billerickson/3529963 to your computer and use it in GitHub Desktop.
<?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