Last active
January 12, 2018 02:26
-
-
Save dospuntocero/14889e3af231eb75c627059755052fe2 to your computer and use it in GitHub Desktop.
get only the next and prev URL instead of full anchor. useful when you need extensive markup styling
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$prev = get_permalink(get_adjacent_post(false,'',false)); | |
$next = get_permalink(get_adjacent_post(false,'',true)); | |
?> | |
<a href="<?php echo $prev; ?>">Previous Post</a> | |
<a href="<?php echo $next; ?>">Next Post</a> | |
<?php //What if there isn’t a previous or next post? ?> | |
<php if ($prev != get_permalink()) : ?> | |
<a href="<?php echo $prev; ?>">Previous Post Only Displaying If Available</a> | |
<?php endif ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment