Created
March 18, 2015 00:44
-
-
Save metinsaylan/35b46fb203149cb9a1ce to your computer and use it in GitHub Desktop.
Bootstrap pager links for WordPress single.php template
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 | |
// This template can be included in your single.php template to display <Previous-Next> links below your post. | |
// It uses aligned pager template stated here > http://getbootstrap.com/components/#aligned-links | |
?> | |
<nav> | |
<ul class="pager"> | |
<?php | |
$post_permalink = get_permalink(); | |
$previous_post = get_permalink(get_adjacent_post(false,'',false)); | |
$next_post = get_permalink(get_adjacent_post(false,'',true)); | |
if( $post_permalink != $previous_post ): | |
?> | |
<li class="previous"><a href="<?php echo $previous_post; ?>"><span aria-hidden="true">←</span> Previous</a></li> | |
<?php endif; ?> | |
<?php if( $post_permalink != $next_post ): ?> | |
<li class="next"><a href="<?php echo $next_post; ?>">Next <span aria-hidden="true">→</span></a></li> | |
<?php endif; ?> | |
</ul> | |
</nav> | |
<?php /* EOF */ ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment