Skip to content

Instantly share code, notes, and snippets.

@topleague
Created August 24, 2019 14:12
Show Gist options
  • Save topleague/1352a3c8fe9a2bdcb30b66e2b02cacb8 to your computer and use it in GitHub Desktop.
Save topleague/1352a3c8fe9a2bdcb30b66e2b02cacb8 to your computer and use it in GitHub Desktop.
Previous/Next Post in Genesis
// 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', '&#x000AB; Previous Post: %title' );
echo '</div>';
echo '<div class="pagination-next alignright">';
next_post_link( '%link', 'Next Post: %title &#x000BB;' );
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