Hiding Next/Previous Post If There Is No Next/PreviousPost (Post Types Order)
-
I have a question in relation to the ability to hide next / previous post links by detecting if you’re currently on the first / last post. To recap the solution to the original question:
<?php if(get_adjacent_post(false, '', true)) { ?> <a href="<?php echo get_permalink(get_adjacent_post(false,'',true)); ?>">Previous Post</a> <?php } ?> <?php if(get_adjacent_post(false, '', false)) { ?> <a href="<?php echo get_permalink(get_adjacent_post(false,'',false)); ?>">Next Post</a> <?php } ?>
Problem
This original question has already been answered before and the solution works fine, but a problem arises when I install and use a plugin to reorder the posts (Post Types Order).Description
The first post’s previous link links back to the second post (behaving as though it’s the second post in the loop) instead of hiding the previous link, as it would normally do without the plugin.I understand that using Post Types Order is obviously the problem here, but it’s of tremendous benefit to be able to reorder posts and I’m wondering if anyone else has encountered this problem and if they have any suggestions.
Thanks.
- The topic ‘Hiding Next/Previous Post If There Is No Next/PreviousPost (Post Types Order)’ is closed to new replies.