117 posts
  • Bought between 1 and 9 items
  • Exclusive Author
  • Greece
  • Has been a member for 3-4 years
  • Sold between 100 and 1 000 dollars
fAntasticmE says
'has_archive' => false
shouldnt this be true?
147 posts
  • Bought between 10 and 49 items
  • Elite Author
  • Exclusive Author
  • Has been a member for 3-4 years
  • Referred between 10 and 49 users
  • Sold between 250 000 and 1 000 000 dollars
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. ;)

2024 posts
  • Elite Author
  • Author had a Free File of the Month
  • Has been a member for 4-5 years
  • Austria
  • Exclusive Author
  • Interviewed on the Envato Notes blog
  • Envato Studio (Microlancer) Beta Tester
+3 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
  • Bought between 1 and 9 items
  • Dominican Republic
  • Exclusive Author
  • Has been a member for 2-3 years
  • Sold between 100 and 1 000 dollars
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