I’ve already shown you how to add next and previous post links in themes which include a single.php file.
Update: You’ll find more solutions with this more recent post titled Different Ways To Add Post Navigation (Pagination) In Genesis
Genesis child themes don’t include single.php files which you can use for this purpose so you need to write a custom function.
You’ll also need to hook it into the location you want to display the post navigation links.
To do this we’ll use one of the Genesis action hooks. Can’t use the Genesis Simple Hooks plugin for this because the links would then display on the archives pages which isn’t a good look. Unless you add a conditional tag to display the links on single posts only.
add_action( 'genesis_entry_content', 'custom_single_post_nav', 12 );
function custom_single_post_nav() {
if ( ! is_singular( 'post' ) )
return;
echo '<div class="pagination-previous alignleft">';
previous_post_link('%link', 'Previous Post', FALSE);
echo '</div>';
echo '<div class="pagination-next alignright">';
next_post_link('%link', 'Next Post', FALSE);
echo '</div>';
}
Linking Specific Custom Post Type
What if you use a custom post type for a portfolio or something like that? How do you add links only for the posts assigned to that type? Here’s a tutorial about how to add next and previous links only for posts assigned to one specific custom post type.
Leave a Reply
You must be logged in to post a comment.