Pagination not working after updating WordPress 4.4?
-
Hi,
I’ve faced pagination problem in my theme after updating WordPress 4.4 version.
Here is my code :
// Pagination $paged global $post, $paged; if( get_query_var( 'paged' ) ) $my_page = get_query_var( 'paged' ); else { if( get_query_var( 'page' ) ) $my_page = get_query_var( 'page' ); else $my_page = 1; set_query_var( 'paged', $my_page ); $paged = $my_page; } // Query $args = array( 'paged' => esc_attr($my_page), 'post_type' => 'post', 'order' => $blog_order, 'orderby' => $blog_orderby, 'offset' => (int)$blog_offset ); $wpbp = new WP_Query( $args ); // Output if ($wpbp->have_posts()) : while ($wpbp->have_posts()) : $wpbp->the_post(); get_template_part( 'content', get_post_format() ); echo my_theme_paging_nav(); endwhile; else : get_template_part( 'content', 'none' ); endif;
And my_theme_paging_nav() function at functions.php file.
if ( ! function_exists( 'my_theme_paging_nav' ) ) { function my_theme_paging_nav() { global $wp_query; $big = 999999999; if($wp_query->max_num_pages == '1' ) { } else { echo ""; } echo paginate_links( array( 'base' => str_replace( $big, '%#%', get_pagenum_link( $big ) ), 'format' => '?paged=%#%', 'prev_text' => __( 'OLDER POSTS', 'text-domain' ), 'next_text' => __( 'NEWER POSTS', 'text-domain' ), 'current' => max( 1, get_query_var('paged') ), 'total' => $wp_query->max_num_pages, 'type' => 'list' )); if($wp_query->max_num_pages == '1' ) { } else { echo ""; } } }
Can you please let me know the changes in WordPress 4.4 from this code?
Thanks! ??
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
- The topic ‘Pagination not working after updating WordPress 4.4?’ is closed to new replies.