How to add Next and Previous navigation in Genesis Framework WordPress

Tag: |   Category:

If you want to add Next and Previous at the bottom of your blog post in Genesis Framework, you can paste below snippets in your theme's function.php file.

OPTION 1


//* Add previous and next post links
add_action( 'genesis_entry_footer', 'genesis_prev_next_post_nav' );

OPTION 2


//* Add previous and next post links
function ja_prev_next_post_nav() {
    if ( is_singular( 'post' ) ) {
        echo '<div class="prev-next-navigation">';
            previous_post_link( '<div class="post_previous">Previous article: %link</div>', '%title' );
            next_post_link( '<div class="post_next">Next Post: %link</div>', '%title' );
        echo '</div>';
    }
}
add_action( 'genesis_before_comments', 'ja_prev_next_post_nav' );

For the above Option 2, you can style your css like this...


.post_previous        {
    float:left;
}
.post_next        {
    float:right;
}

Copyright © 2024 Siam Naulak.
magnifiercrossmenu