Pagination with target?
-
My home page is a whole bunch of stuff and then at the bottom is a list of posts. It is created by making a regular page with content, and using a template that incorporates posts from certain categories. I am using Pagination at the bottom of this list of posts to get to a list of Older/Newer posts. It all works just fine, but…
When going to each previous or next page, it starts at the top of the Home page, showing all the same content that you have to scroll through to get to the list of posts. The drawback is that it makes it look like it just reloaded the home page, rather than changed pages. What I would like to do is create a target link to the start of the posts list.
Simply put, something like
href="Older_Posts#PostsList"
but all I have in my template is
<?php decode_paging_nav(); ?>
(decode being the parent theme) and that directs to functions.php:function decode_paging_nav() { // Don't print empty markup if there's only one page. if ( $GLOBALS['wp_query']->max_num_pages < 1 ) { return; } ?> <nav class="navigation paging-navigation" role="navigation"> <h1 class="screen-reader-text"><?php _e( 'Posts navigation', 'decode' ); ?></h1> <div class="nav-links"> <?php if ( get_next_posts_link() ) : ?> <div class="nav-previous"><?php next_posts_link( __( ' Older posts', 'decode' ) ); ?></div> <?php endif; ?> <?php if ( get_previous_posts_link() ) : ?> <div class="nav-next"><?php previous_posts_link( __( 'Newer posts ', 'decode' ) ); ?></div> <?php endif; ?> </div><!-- .nav-links --> </nav><!-- .navigation -->
Is it possible to somehow add #PostsList somewhere in there? If so, how/where?
Thank you!
- The topic ‘Pagination with target?’ is closed to new replies.