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;
}
Reference: genesis/lib/structure/post.php
Thanks so much Sridhar!
This works perfectly. My only issue is that I misspoke. I need this pagination on my blog page which I thought was the same as a post archive. Is there a way to include this pagination also on the blog page (which lists, or begins to list and link to all my posts)? Thanks!
This problem you are talking about is the very reason why using a Blog Page Template is NOT recommended on the
Blog
page.https://www.billerickson.net/dont-use-genesis-blog-template/
In general, you need to create two empty Pages called say,
Home
andBlog
and set them as static front page and Posts page respectively at Settings > Reading.If you can send me a copy of the Epik theme to me via https://sridharkatakam.com/contact I will give the above a try and confirm if it works in that theme as well.
Received your email.
Follow these steps:
1) Take a full backup of your site using BackupBuddy or AIO Migration.
2) Create two empty Pages called say,
Home
andBlog
and set them as static front page and Posts page respectively at Settings > Reading.3) Rename
home.php
tofront-page.php
.Thank you for pointing out Bill Erikson’s article. I needed to read that for sure.
Your solution works perfectly, thanks so much!
Is it valid for metro pro theme. In metro pro don´t show the pagination.