Forums › Forums › Search & Filter Pro › Numeric Pagination with results.php
Tagged: pagination, wp-pagenavi
- This topic has 4 replies, 2 voices, and was last updated 7 years, 9 months ago by Trevor.
-
Anonymous(Private) February 8, 2017 at 11:23 pm #89027
I have poked around the forums and documentation to try to find an answer to this, but could not find anything – please direct me to and former posts that I have overlooked!
I have the Search & Filter Pro plugin set up, and have a search form set up that loads results with ajax. I am using the shortcode method, so I have the form shortcode in a sidebar widget, and the results shortcode in the body of my page. Everything works great, I really like this plugin!
I am overriding results.php in my_theme/search-filter/results.php which works. The theme I am using is a child of _tk (by theme kraft). The theme has its own bootstrap numeric pagination function built in, which works great on my regular site search results page (using the theme’s search.php template), but when I attempt to call that function into the results.php template, nothing shows up. Here is my code in results.php:
if ( $query->have_posts() ) { ?> Found <?php echo $query->found_posts; ?> Results <br/> <?php while ($query->have_posts()) { $query->the_post(); ?> <div> <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2> <p><br /><?php the_excerpt(); ?></p> <?php if ( has_post_thumbnail() ) { echo '<p>'; the_post_thumbnail("small"); echo '</p>'; } ?> </div> <hr /> <?php } ?> Page <?php echo $query->query['paged']; ?> of <?php echo $query->max_num_pages; ?><br /> <div class="pagination"> <div class="numeric"><?php _tk_pagination($query->max_num_pages); ? </div> <?php } else { echo "No Results Found"; }
Any thoughts on why this might not be working? I can provide the url if that is needed. I can also provide the theme’s pagination function code if that is needed.
Anonymous(Private) February 9, 2017 at 1:05 am #89040I ended up resolving this on my own using wp-pagenavi plugin and some minor js hacks! This can be closed!
The code (for anyone interested):
<?php /* example code for using the wp_pagenavi plugin */ if (function_exists('wp_pagenavi')) { echo "<br />"; wp_pagenavi( array( 'query' => $query, 'wrapper_class' => 'pagination pge-search', 'wrapper_tag' => 'ul' ) ); } ?>
-
AuthorPosts