it has been requested before on Wordpress forums, but no solutions labored for me personally, I have totally reset the permalinks, etc. with no success. I really hope everyone possess the answer. This really is my setup:
I've got a custom publish type known as ted_venue, and 2 templates, single-ted_venue.php (single venue particulars) and page-venues.php (for exhibiting a listing of venues). Permalink structure is site.com/venues/venue-slug for venue detail and.orgOrlocations for venues list.
This is actually the pagination code on listing of venues:
$paged = get_query_var('paged') ? get_query_var('paged') : 1; $wp_query = new WP_Query(array('post_type' => 'ted_venue', 'paged' => $paged, 'posts_per_page' => 30) ); if ($wp_query->have_posts()): ?> <ul> <?php while ($wp_query->have_posts()): $wp_query->the_post(); ?> ...
Then at the end I give a couple of pagination links. Basically visit site.com/venues/page/2 it brings a 404 error.
Then, basically totally reset permalinks to default after which to current, venue-list pagination works OK but single venue detail does not. So, essentially when pagination works single venue does not and viceversa.
Does anybody possess a clue on which might be happening or at best are you able to point me for an article or live working example?
Ok, here's why it isn't working:
You are tugging in 'paged' while WordPress still thinks it's on the static page, therefore paged will be 1. Regrettably, there is no method of doing what for you to do the way in which you are doing the work at this time, but you will find other solutions.
You will find essentially two methods to fix this: First, you can override the rewrite rules your publish type is producing yourself (this is actually the easiest way, but the most complicated, and would involve times of work just determining the way the rewrite engine works). The 2nd way (the easiest way which transpires with work perfectly but simply is not always the easiest way) is by using Matt Wiebe's 'Smarter Custom Publish Types' code found here:
'order_by' => 'menu_order', as that's the only real difference I can tell together with your code and others who have custom post pagination working (second post).