Skip to content

Instantly share code, notes, and snippets.

@cdils
Created April 8, 2014 15:12
Show Gist options
  • Save cdils/10140168 to your computer and use it in GitHub Desktop.
Save cdils/10140168 to your computer and use it in GitHub Desktop.
Add (in category) post navigation to the bottom of single posts and throw some Genesis styles around it.
<? //remove this line
// Add Prev/Next post navigation within a single category
add_action( 'genesis_after_entry', 'cd_prev_next_posts_nav' );
function cd_prev_next_posts_nav() {
//bail if we're not on a single post
if ( ! is_single() ) {
return;
}
echo '<div class="archive-pagination">';
// build links to prev/next post in same category
$prev_link = previous_post_link( '<div class="pagination-previous alignleft">%link</div>', '&laquo; Previous Post', TRUE );
$next_link = next_post_link( '<div class="pagination-next alignright">%link</div>', 'Next Post &raquo;', TRUE );
echo '</div>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment