Site pagination issue
Question
The site wont go past the first page it redirects back to page 1 this is the code for the template used
-
Blog Pagination
*/
function ptp_blog_pagination_bar() {
global $blog_query;$total_pages = $blog_query->max_num_pages;
if ($total_pages > 1){
$current_page = max(1, get_query_var(‘paged’));echo paginate_links(array( 'base' => get_pagenum_link(1) . '%_%', 'format' => 'page/%#%', 'current' => $current_page, 'total' => $total_pages, ));
}
}
/**
- Pagination
*/
function ptp_numeric_posts_nav() {
global $ptp_query;
/** Stop execution if there's only 1 page */
if( $ptp_query->max_num_pages <= 1 )
return;
$paged = get_query_var( 'paged' ) ? absint( get_query_var( 'paged' ) ) : 1;
$max = intval( $ptp_query->max_num_pages );
/** Add current page to the array */
if ( $paged >= 1 )
$links[] = $paged;
/** Add the pages around the current page to the array */
if ( $paged >= 3 ) {
$links[] = $paged - 1;
$links[] = $paged - 2;
}
if ( ( $paged + 2 ) <= $max ) {
$links[] = $paged + 2;
$links[] = $paged + 1;
}
echo '<div class="num-nav"><ul>' . "n";
/** Previous Post Link */
if ( get_previous_posts_link() )
printf( '<li>%s</li>' . "n", get_previous_posts_link() );
/** Link to first page, plus ellipses if necessary */
if ( ! in_array( 1, $links ) ) {
$class = 1 == $paged ? ' class="active"' : '';
printf( '<li%s><a href="%s">%s</a></li>' . "n", $class, esc_url( get_pagenum_link( 1 ) ), '1' );
if ( ! in_array( 2, $links ) )
echo '<li>…</li>';
0
2 months
0 Answers
11 views
0
Leave an answer
You must login or register to add a new answer .