Created
February 23, 2015 10:07
-
-
Save JonCatmull/90866c80fe64cb1d1327 to your computer and use it in GitHub Desktop.
Code for completely custom wordpress next and previous buttons
This file contains 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_post = get_adjacent_post(false,'',true); | |
$next_post = get_adjacent_post(false,'',false); | |
if ( !empty( $prev_post ) ) | |
{ | |
echo '<a href="'.get_permalink($prev_post).'" class="btn arrow-left" title="'.$prev_post->post_title.'" rel="prev">Previous</a>'; | |
} | |
else | |
{ | |
echo '<span class="btn arrow-left disabled">Previous</span>'; | |
} | |
if ( !empty( $next_post ) ) | |
{ | |
echo '<a href="'.get_permalink($next_post).'" class="btn arrow-right" title="'.$next_post->post_title.'" rel="next">Next</a>'; | |
} | |
else | |
{ | |
echo '<span class="btn arrow-right disabled">Next</span>'; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment