170 posts
  • Power Elite Author: Sold more than $1M on Envato Market
  • Has been part of the Envato Community for over 5 years
  • Sells items exclusively on Envato Market
  • Made it to the Authors' Hall of Fame
+4 more
stmcan says

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?

1 post
  • Has been part of the Envato Community for over 4 years
jzarto says

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('&lsaquo; Previous Page') ?></div>
    <div class="next"><?php next_posts_link('Next Page &rsaquo;') ?></div>
</div>

That’s it. I’ll appreciate some help… thanks.

11 posts
  • Has been part of the Envato Community for over 5 years
  • Has referred 100+ members
  • Has collected 10+ items on Envato Market
  • Sells items exclusively on Envato Market
neel says

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

4327 posts ThemeForest Reviewer
  • Has referred 1+ members
  • Has sold $40,000+ on Envato Market
  • Has collected 50+ items on Envato Market
  • Member of the Envato Team
+12 more
Ivor Envato team says

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

1 post
  • Has been part of the Envato Community for over 3 years
  • Has collected 1+ items on Envato Market
soroaga says

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.

1 post
  • Has been part of the Envato Community for over 3 years
  • Has collected 1+ items on Envato Market
matyo says

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

364 posts Onuro
  • Has referred 100+ members
  • Has sold $75,000+ on Envato Market and is now an Elite Author
  • Has collected 10+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+4 more
ThemeKioken says
Just remember adding the
'paged' => get_query_var( 'paged' );
to the query posts arguments array :)
2 posts
  • Has been part of the Envato Community for over 7 years
  • Has collected 10+ items on Envato Market
hoss9009 says


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 <3 thanks!

How did this help you @matyo? How/Where do I throw in the post_type?

by
by
by
by
by
by