Skip to content

Instantly share code, notes, and snippets.

@JonCatmull
Created February 23, 2015 10:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JonCatmull/90866c80fe64cb1d1327 to your computer and use it in GitHub Desktop.
Save JonCatmull/90866c80fe64cb1d1327 to your computer and use it in GitHub Desktop.
Code for completely custom wordpress next and previous buttons
<?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