Forums › Forums › Search & Filter Pro › Issue with getting previous posts
Tagged: pagination, previous link
- This topic has 4 replies, 2 voices, and was last updated 4 years, 6 months ago by Ross.
-
Anonymous(Private) May 20, 2020 at 11:22 am #245088
Hello,
I am having some trouble setting up the pagination on my results page.
For some reason “previous_posts_link” is not outputting an “a href”, any solutions to this?
I got the pagination code out of the plugin template folder.Ajax Pagination Setup in filter:
Pagination type: Normal
Pagination selector: .pagination aURL where problem is situated:
https://cordacampus.dev.expliciet.be/corda-companies/Code used for pagination:
https://pastebin.com/UjgU3X5DRoss Moderator(Private) May 20, 2020 at 3:15 pm #245145Hi Thomas
It looks like you are uinsg
display method
=shortcode
?That uses a
$query
for the results – otherwise known as a “custom query”.The function
previous_posts_link
andnext_posts_link
apparently support custom queries if you addmax_num_pages
as the second parameter (I didn’t test this):https://stackoverflow.com/a/15567906
Alternatively, you can use the code provided in the
results.php
template file in our plugin:
https://searchandfilter.com/documentation/search-results/using-a-shortcode/#customising-the-resultsThanks
Anonymous(Private) May 22, 2020 at 12:05 pm #245464Hello Ross,
I have converted my code to a custom WP Query.
Code now: https://pastebin.com/gLrvSCHSPreviously I used the code provided in the results.php, but that did not work either…
Ross Moderator(Private) May 25, 2020 at 9:54 am #245685Hi Thomas
I’m not sure why that wouldn’t work – if you use display method “shortcode” and then use our template “results.php” you will see it working?
Do you have a link I could look at?
Thanks
-
AuthorPosts