Archived topic
Pagination at bottom of page
7 replies · Started by Paul on April 20, 2022
Pagination seems to be working fine but is showing at the top of the pages only, mainly archive/taxonomy pages.
How do I get it to show at the top and the bottom?
Hi Paul,
To have a better understanding of the issue, may you kindly provide a link to a page in your site where this issue is visible?
You may use the private information field for this: https://docs.generatepress.com/article/using-the-premium-support-forum/#private-information
Hope to hear from you soon. :)
Hi Fernando.
Here is a good example (In private info box)...
Hi Paul,
How are you adding the table?
With your structure now, you can try adding this CSS in Appearance > Customize > Additional CSS:
body.archive .site-main{
display:flex;
flex-direction:column;
}
nav#nav-below {
order:1;
}
Kindly let us know. :)
Hi Fernando
The table is simply started in the archive-posttype which calls in a content-archiveposttype template with rows and columns for the loop.
That CSS moved the pagination to the bottom which is great but if I wanted to also add a second one at the top is that possible?
Thanks!
Hi there,
you can add this PHP Snippet to hook in another paging navigation:
add_action( 'generate_before_main_content', 'lh_move_pagination', 0 );
function lh_move_pagination() {
if ( is_archive() ) {
echo '<nav id="nav-below" class="paging-navigation top-navigation" aria-label="Archive Page">';
the_posts_pagination( array(
'end_size' => 2,
'mid_size' => apply_filters( 'generate_pagination_mid_size', 1 ),
'prev_text' => apply_filters( 'generate_previous_link_text', __( '← Previous', 'generatepress' ) ),
'next_text' => apply_filters( 'generate_next_link_text', __( 'Next →', 'generatepress' ) ),
) );
echo '</nav>';
}
}
See if that works to add a second nav, and then we can talk about re-ordering the various elements.
Hi David
Thanks for that. I now have both nav at top and bottom.
Glad to hear that!