Created
August 24, 2019 14:12
-
-
Save topleague/1352a3c8fe9a2bdcb30b66e2b02cacb8 to your computer and use it in GitHub Desktop.
Previous/Next Post in Genesis
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
// ADD NEXT/PREV POST | |
// https://sridharkatakam.com/add-links-previous-post-next-post-single-posts-genesis/ | |
add_action( 'genesis_after_entry', 'custom_adjacent_entry_nav', 9 ); | |
function custom_adjacent_entry_nav() { | |
if ( !is_singular( 'post' ) ) { | |
return; | |
} | |
genesis_markup( array( | |
'open' => '<div %s>', | |
'context' => 'adjacent-entry-pagination', | |
) ); | |
echo '<div class="pagination-previous alignleft">'; | |
previous_post_link( '%link', '« Previous Post: %title' ); | |
echo '</div>'; | |
echo '<div class="pagination-next alignright">'; | |
next_post_link( '%link', 'Next Post: %title »' ); | |
echo '</div>'; | |
genesis_markup( array( | |
'close' => '</div>', | |
'context' => 'adjacent-entry-pagination', | |
) ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment