Custom Post Type Pagination Doesn’t Work in WordPress 3.4
Use get_query_var(‘page’) instead of get_query_var(‘paged’). Related ticket: #21028
Use get_query_var(‘page’) instead of get_query_var(‘paged’). Related ticket: #21028
You are going about this the hard way, and the less efficient way. You already have a Loop on the page. You should be able to use that and that alone. if (have_posts()) { while (have_posts()) { the_post(); if (6 < $wp_query->current_post) { // formatting for your first six posts } else { // formatting … Read more
Hi @banesto: I think the simple answer may be that you need your paged URL to be specified before your shorter URL, but since I didn’t test it I’m not 100% sure. That said, I’ve always run into a lot of trouble with the ‘generate_rewrite_rules’ hook. I’m sure a better developer than me could make … Read more
This is the default WordPress behaviour for pagination when using a custom query (where you feed in the paged value yourself) or in the index.php as it doesn’t realize there isn’t content to display on the XXXth page until it has already loaded the template, and then tries to run the WP_Query. You can try … Read more
Though all of the arguments are optional, paginate_links doesn’t necessarily do anything if there are no arguments. Take a look at the example at the example in the Codex. global $wp_query; $big = 999999999; // need an unlikely integer echo paginate_links( array( ‘base’ => str_replace( $big, ‘%#%’, esc_url( get_pagenum_link( $big ) ) ), ‘format’ => … Read more
There where one or two problems with the code that I sorted out Big changes $number_of_terms = count( get_terms( ‘100list’ ) ); is replaced by $number_of_terms = wp_count_terms( ‘100list’ );. The reason is that wp_count_terms is already there to return the term count natively get_categories is replaced by get_terms as get_terms accepts the offset parameter … Read more
You’re referencing the global $wp_query object in your function which you’ve reset using wp_reset_query(). You can resolve the pagination by passing your custom $loop WP_Query object to the function. I also changed wp_reset_query to wp_reset_postdata Also you’re making the call to your pagination function in the while loop instead of after it. Your function should … Read more
Unfortunately, there is no way to do this just with native functions: WP is … request agnostic and produces always links to the current page (nav manus, list pages …). Also, you cannot use a filter, because wp_link_pages() has no appropriate filter. In my themes, I use an own function, based on this code. It … Read more
I’ve experienced this with several plugins of my own, while trying to display a numerical pagination for my custom post types and custom taxonomies. It’s my understanding that by using WP_Query to fetch posts from the database in your own custom way (other than the default) will prevent you from using such functions as expected. … Read more
you could paginate your page by simply adding /page/n to the end of the URL, where n is the desired page number. creating your next/prev links will be a manual affair though. the page number will then be accessible via get_query_var(‘paged’). then use the number argument for get_terms to select 40 at a time, use … Read more