I want to be able to navigate (back - forward) through all pages within a certain search. If I use the standard WP option it just navigates through all pages form within a post type.
For example...
Here I define the search criteria: hidden link which would be distance and place.
On the underlying 'detail page' I would like to place a back and forward button that will navigate through the range defined earlier. Example: hidden link
Here I searched on 'Drachten' which shows me 8 results. Going back and forward should be limited to 8 profiles.
Hi Bob,
Thank you for contacting us and I'll be happy to assist.
To restrict the next and previous item links on the single post pages (or detail pages), based on the visitor's search filters, you'll need to pass on the information from that view to those detail pages.
The best way to keep track of that information would be to use PHP global variable: $_SESSION:
hidden link
For example, you can create 3 custom shortcodes:
( ref: https://codex.wordpress.org/Shortcode_API )
1. First, one will be used to create a new array in the $_SESSION global variable before the loop in the view starts (i.e. above the shortcode [wpv-items-found] )
2. The second one can be placed inside the views individual loop item to set the current post's ID in that array.
3. The third one will need to be placed on the detail pages, which will get the array from that session array and show the links from the previous and the next post IDs accordingly.
I hope this helps and for more personalized assistance around custom code, you can consider hiring a professional from our list of recommended contractors:
https://toolset.com/contractors/
regards,
Waqar
Hi Waqar,
Thanks for your guidance 🙂
I think I get the gist of it, but I'll have to do some reading up on the subject... so I'll put it on roll out phase 2 for now.
Thanks for now!
Bob
You're very welcome Bob and feel free to reach us anytime.
regards,
Waqar