Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

The same old problem and not sure if its even possible.

Pagination on a single.php custom post type, is it possible?

This works fine until i turn permalinks to /%postname%/ then it just reloads the same page when click on the previous/next links,

<?php 
  $temp = $wp_query; 
  $wp_query = null; 
  $wp_query = new WP_Query(); 
  $wp_query->query('showposts=1&orderby&menu_order&post_type=press-round'.'&paged='.$paged); 

  while ($wp_query->have_posts()) : $wp_query->the_post(); 
?>


  <?php the_title(); ?>

<?php endwhile; ?>

<nav>
<?php previous_posts_link('&laquo; Newer') ?>
<?php next_posts_link('Older &raquo;') ?>
</nav>

<?php $wp_query = null;  $wp_query = $temp;?>

I've refreshed the permalinks, removed the htaccess, made sure a page is not the same name everything that you'd usually do.

Is it just not possible to have permalinks on for pagination on a single custom post type page?

share|improve this question
add comment

2 Answers

up vote 1 down vote accepted

The problem is you're using next_posts_link() etc... note the plural form 'posts'.

To link to previous and next single posts you need to use next_post_link() and previous_post_link().

Basically change 'posts' to 'post' in the function names.

share|improve this answer
1  
+1. Also: what is the need for the custom query? It's not necessary for displaying the single-post page for a custom post type. WordPress handles custom post type queries out-of-the-box. –  Chip Bennett Aug 30 '12 at 16:35
    
Thanks, i was being stupid. –  user4630 Aug 31 '12 at 15:13
    
No worries, easily done :) –  sanchothefat Sep 3 '12 at 11:00
add comment

I would use a plugin like this http://wordpress.org/extend/plugins/wp-pagenavi/ or you can use your own function like the one here http://wp-snippets.com/pagination-without-plugin/

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.