117 posts
  • Has been part of the Envato Community for over 3 years
  • Has sold $100+ on Envato Market
  • Has collected 1+ items on Envato Market
  • Sells items exclusively on Envato Market
+1 more
fAntasticmE says
'has_archive' => false
shouldnt this be true?
147 posts
  • Has been part of the Envato Community for over 4 years
  • Has referred 10+ members
  • Has sold $250,000+ on Envato Market
  • Has collected 10+ items on Envato Market
+2 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. ;)

2196 posts
  • Located in Europe
  • Made it to the Authors' Hall of Fame
  • Had an item featured on Envato Market
  • Participated in a focus group or interview to improve the user experience on Envato Market
+10 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
  • Sells items exclusively on Envato Market
  • Has been part of the Envato Community for over 2 years
  • Has sold $100+ on Envato Market
  • Has collected 1+ items on Envato Market
+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>

Helpful Information

  • Please read our community guidelines. Self promotion and discussion of piracy is not allowed.
  • Open a support ticket if you would like specific help with your account, deposits or purchases.
  • Item Support by authors is optional and may vary. Please see the Support tab on each item page.

Most of all, enjoy your time here. Thank you for being a valued Envato community member.

Post Reply

Format your entry with some basic HTML. Read the Full Details, or here is a refresher:

<strong></strong> to make things bold
<em></em> to emphasize
<ul><li> or <ol><li> to make lists
<h3> or <h4> to make headings
<pre></pre> for code blocks
<code></code> for a few words of code
<a></a> for links
<img> to paste in an image (it'll need to be hosted somewhere else though)
<blockquote></blockquote> to quote somebody

:grin: :shocked: :cry: Complete List of Smiley Codes

by
by
by
by
by
by