• Skip to primary navigation
  • Skip to main content

Genesis Community

Resources for Genesis WordPress Theme Users

  • Facebook
  • Twitter
  • Slack
  • Wiki
  • Login
You are here: Home / Wikis / Genesis / Add links to previous and next posts on single posts

Add links to previous and next posts on single posts

add_action( 'genesis_after_entry', 'custom_adjacent_entry_nav' );
/**
 * Displays links to previous and next entry.
 *
 * @since 2.3.0
 *
 * @return void Return early if not singular or post type doesn't support `genesis-adjacent-entry-nav`.
 */
function custom_adjacent_entry_nav() {

    if ( ! is_singular() ) {
        return;
    }

    genesis_markup( array(
        'open'    =&gt; '<div>',
        'context' =&gt; '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'    =&gt; '</div>',
        'context' =&gt; 'adjacent-entry-pagination',
    ) );

}
Add links to previous and next posts on single posts
Source: https://sridharkatakam.com/add-links-previous-post-next-post-single-posts-genesis/
Notes:

To confine the next and previous links to posts only, use this code: ... if (is_singular('post')) { ...

Posted by: Sridhar Katakam Category: Genesis

« Don’t load deprecated Genesis functions
Stop archives from using first attached image as fallback when no featured image is set »

Copyright © 2026 · Genesis Sample on Genesis Framework · WordPress · Log in