By the way, Kayapati’s first code (same with mine) is working if you give smaller value, e.g: 1, for “Blog pages show at most” on reading settings. But it’s not the case because user may want to use a “plugin” and the plugin can be using the number. I think it’s a bug! What do you think guys?
Hi there,
I have almost the same problem as kayapati i hope somebody could help me. I found little diferent query for my custom post type but i’m newby in php and i don’t know how to aply the solution you guys post here to my case.
Here is my code:
<?php $recent = new WP_Query('post_type=pronun&posts_per_page=4'); while($recent?>have_posts()) : $recent->the_post();?>
// some content
<?php endwhile; ?>
<div class="post-nav">
<div class="previous"><?php previous_posts_link('‹ Previous Page') ?></div>
<div class="next"><?php next_posts_link('Next Page ›') ?></div>
</div>
That’s it. I’ll appreciate some help… thanks.
- Bought between 10 and 49 items
- Exclusive Author
- Has been a member for 3-4 years
- Referred between 100 and 199 users
Hi All,
I am having problem not on the custom post type template page. But on the single page of that custom post type i created single post page for my custom type but the next_post_link() and previous_post_link() not displaying anything.
Thanks Neel
- Envato Staff
- Reviewer
- Community Moderator
- Venezuela
- Has been a member for 4-5 years
- Repeatedly Helped protect Envato Marketplaces against copyright violations
- Microlancer Beta Tester
- Sold between 10 000 and 50 000 dollars
- Exclusive Author
Hey guys a little help here please, I have the same issue with custom post types and the pagination (404 error) – ”>http://pastie.org/1178764-
Ok my bad, 2 minutes after I posted this I resolved the issue with this post http://wordpress.org/support/topic/pagination-with-custom-post-type-getting-a-404?replies=1#post-1616810
Hello!
There are several issues with custom post types and pagination. One of them can be solved by adding a post_type var to the url vars.
Example: example.com/category/books/page/2/?post_type=novels
Use this in your functions.php:
function custom_request($qv) {
if(isset($qs['category_name'])){
$qs['post_type'] = get_post_types($args = array(
'public' => true,
'_builtin' => false
));
array_push($qs['post_type'],'post');
}
return $qs;
}
add_filter('request', 'custom_request');
It also works for Author’s Archive, Feeds, and other places where you need the custom post types to appear.
VagrantRadio said
Haven’t tried it in WP 3 .0 yet, but try this: http://snipplr.com/view/32185/wordpress-paginated-wpquery/
This just saved me hours of pulling my hair out
'paged' => get_query_var( 'paged' );to the query posts arguments array

matyo said
VagrantRadio saidThis just saved me hours of pulling my hair out <3 thanks!
Haven’t tried it in WP 3 .0 yet, but try this: http://snipplr.com/view/32185/wordpress-paginated-wpquery/
How did this help you @matyo?
How/Where do I throw in the post_type?
