Forums › Forums › Search & Filter Pro › Pagination with search results not letting me click on or back to page 1
- This topic has 14 replies, 3 voices, and was last updated 8 years, 3 months ago by Ross.
-
Anonymous(Private) July 7, 2016 at 6:42 pm #50496
Hi,
I’ve run into an issue where the pagination for my search results is not letting me click on page 1, and the ‘previous’ arrow works up until page 2, and then will not take me back to page 1 from there. This only seems to be an issue with the first page; it works just fine for the last page. Trevor sent me a new version of the plugin, wondering if there was a fix for this afterwards, or if you could help us implement a fix for this until the new version comes out. Please let me know.We are using WordPress’s default twentysixteen theme.
Thanks,
TinaAnonymous(Private) July 14, 2016 at 4:17 pm #51196Hi Trevor,
Here is an example of the pagination code we have:Within our index.php page: // Previous/next page navigation. the_posts_pagination( array( 'mid_size' => 2, 'prev_text' => __( 'Previous page', 'twentysixteen' ), 'next_text' => __( 'Next page', 'twentysixteen' ), 'before_page_number' => '<span class="meta-nav screen-reader-text">' . __( 'Page', 'twentysixteen' ) . ' </span>', ) ); Within link-template.php: function get_the_posts_pagination( $args = array() ) { $navigation = ''; // Don't print empty markup if there's only one page. if ( $GLOBALS['wp_query']->max_num_pages > 1 ) { $args = wp_parse_args( $args, array( 'mid_size' => 1, 'prev_text' => _x( 'Previous', 'previous post' ), 'next_text' => _x( 'Next', 'next post' ), 'screen_reader_text' => __( 'Posts navigation' ), ) ); // Make sure we get a string back. Plain is the next best thing. if ( isset( $args['type'] ) && 'array' == $args['type'] ) { $args['type'] = 'plain'; } // Set up paginated links. $links = paginate_links( $args ); if ( $links ) { $navigation = _navigation_markup( $links, 'pagination', $args['screen_reader_text'] ); } } return $navigation; } /** * Display a paginated navigation to next/previous set of posts, * when applicable. * * @since 4.1.0 * * @param array $args Optional. See {@see get_the_posts_pagination()} for available arguments. * Default empty array. */ function the_posts_pagination( $args = array() ) { echo get_the_posts_pagination( $args ); }
-
AuthorPosts