117 posts
  • 4 Years of Membership
  • Author Level 2
  • Collector Level 1
  • Exclusive Author
+1 more
fAntasticmE
says
'has_archive' => false
shouldnt this be true?
147 posts
  • 4 Years of Membership
  • Affiliate Level 2
  • Author Level 9
  • Collector Level 2
+3 more
FlexiPress
says

Your question is not clear for me… Is it for your “post type” archive page or for single “post type” page page?

For archive page, archive-yourposttype.php, or your custom page template to show your custom post type, you have to use next_posts_link and previous_posts_link inside the loop.

References:
http://codex.wordpress.org/Function_Reference/next_posts_link
http://codex.wordpress.org/Function_Reference/previous_posts_link

For single post page, single-yourposttype.php, you have to use next_post_link and previous_post_link inside the loop.

References:
http://codex.wordpress.org/Function_Reference/next_post_link
http://codex.wordpress.org/Function_Reference/previous_post_link

Note: we use them on one of our theme and it works. ;)

2280 posts
  • Top Monthly Author
  • Weekly Top Seller
  • Community Superstar
  • Industrious API Inventor
+15 more
revaxarts
says

Thanks to all who helped me but the solution is quite different!

I didn’t get the mentioned links because I changed the post status from ‘published’ to ‘finished’ and the get_adjacent_post() function in the link-template.php file generates a SQL statement with post_status = ‘publish’. Fortunately it provides a filter hook so this code solves my problem:

add_filter('get_previous_post_where', 'my_get_post_where');
add_filter('get_next_post_where', 'my_get_post_where');

function my_get_post_where($sql) {
    return str_replace("'publish'", "'finished'", $sql);
}

I think the register_post_status is not implemented well in the whole WP core

9 posts
  • Exclusive Author
  • 3 Years of Membership
  • Author Level 2
  • Collector Level 1
+1 more
oidoperfecto
says

This is more simple and clean:

<div class="entry-post-nav group">
    <?php $prev_post = get_previous_post(); ?>

    <?php if ( !empty( $prev_post ) ) : ?>  
        <div class="post-prev">
            <a href="<?php echo get_permalink( $prev_post->ID ); ?>">? Prev Posts</a>
            <h4><a href="<?php echo get_permalink( $prev_post->ID ); ?>"><?php echo $prev_post->post_title; ?></a></h4>
        </div>
    <?php endif; ?>

    <?php $next_post = get_next_post(); ?>

    <?php if ( !empty( $next_post ) ) : ?>  
        <div class="post-next">
            <a href="<?php echo get_permalink( $next_post->ID ); ?>">Next Posts ?</a>
            <h4><a href="<?php echo get_permalink( $next_post->ID ); ?>"><?php echo $next_post->post_title; ?></a></h4>
        </div>
    <?php endif; ?>
</div>
by
by
by
by
by
by