Last active
December 17, 2015 05:09
-
-
Save JiveDig/5555889 to your computer and use it in GitHub Desktop.
Add previous/next links to single posts
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
// Previous/Next post title links to single posts | |
add_action ('genesis_entry_footer', 'post_navigation'); | |
function post_navigation() { | |
if ( is_singular(array('portfolio','post') ) ) { | |
echo '<div class="post-nav">'; | |
previous_post_link('<div class="previous">‹ %link</div>'); | |
next_post_link('<div class="next">%link ›</div>'); | |
echo '</div>'; | |
} | |
} | |
//* Add single post navigation with custom display to single posts | |
add_action ('genesis_entry_footer', 'post_navigation'); | |
function post_navigation() { | |
if ( is_single() ) { | |
echo '<div class="post-nav">'; | |
previous_post_link( '<div class="previous">%link</div>', __( '<i class="fa fa-chevron-left"></i>' ) ); | |
next_post_link( '<div class="next">%link</div>', __( '<i class="fa fa-chevron-right"></i>' ) ); | |
echo '</div>'; | |
} | |
} | |
// CSS to display cleanly | |
.post-nav .previous, | |
.post-nav .next { | |
width: auto; | |
} | |
.post-nav .previous { | |
float: left; | |
} | |
.post-nav .next { | |
float: right; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment