Disable “previous link” in last post and “next link” in first post
-
Hi all!
I’m using this for my next/previous link instead of the standard next_post_link/previous_post_link because I needed to style the link:
<div id="post-nav-next"><a href="<?php $nextPost = get_next_post(true); echo get_permalink($nextPost->ID); ?>#post-content"></a></div> <div id="post-nav-previous"><a href="<?php $prevPost = get_previous_post(true); echo get_permalink($prevPost->ID); ?>#post-content"></a></div>
The problem with this is that the previous link still shows up in the last post and likewise the next link is there in the first post. How do I disable or hide this? I presume it involves the “if” php function but I’m still no good with php yet.
Any help would be appreciated. Thanks!
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Disable “previous link” in last post and “next link” in first post’ is closed to new replies.