How to add an additional pagination to the top of archives in Genesis

In the members-only forum, a user asked:

I would like to see a tutorial on how to add pagination (in my case, specifically numeric) to the top of a post archive. To be clear I don’t want to move or loose the pagination at the bottom of the archive. I just need to duplicate it at the top of the page like in the genesis_before_entry area. I’m guessing on the hook location.

We could hook the function that outputs the archive pagination per Genesis theme settings i.e., genesis_posts_nav to genesis_before_loop to make the pagination also appear above the list of posts on content archives in Genesis.

While the tutorial has been written for Genesis Sample, it should work with a few adjustments in any Genesis theme.

Step 1

Add the following in child theme’s functions.php:

// Show archive pagination in a format dependent on chosen setting above the posts on content archives.
add_action( 'genesis_before_loop', 'genesis_posts_nav' );

There is no need to do a check for non-archives i.e., singular pages and aborting early because both the functions (only one will run depending on the theme setting) inside genesis_posts_nav() do that.

Step 2

Add the following in child theme’s style.css:

.archive-pagination {
    margin-top: 0;
}

.entry + .archive-pagination {
    margin-top: 40px;
}
This site uses cookies to offer you a better browsing experience. By browsing this website, you agree to our use of cookies.