This topic contains 2 replies, has 2 voices, and was last updated by
- April 24, 2020 at 2:50 am #26883Participant
Another couple of questions regarding my set up.
1. On the landing page there is a search bar that redirects to the search page – currently, when I apply filters on the search on the landing-page, they aren’t being applies on the search page. Is there something I need to do in order to resolve this?
2. On my landing page I am querying three custom post types (alerts, news and insight). I would like to place a ‘view more’ link next to the respective section. This link would take the user to the search page and display all the posts associated with that respective custom post type – is there a URL string that I would need to put into my ‘a’ tags to achieve this?
Thanks again for your help!
//JoeApril 24, 2020 at 1:33 pm #26891Keymaster
A. That only works when the same search instance shortcode (ID) is used on both pages. So if you have a different search on one page, and another on the search page, it won’t parse the filter values, as it is a different one.
B. This is a bit more complicated, but doable. I am copying an answer from a different thread below, with the istructions. First, you need to navigate to the search results page, as you need the URL for that serach bar.
To get a URL to a specific search state, do the following:
1. Set up the search filters as you need them. In this example I have selected the following filters: https://i.imgur.com/Ki2nv5c.png
2. Open your developer console. In Google Chrome browsers you need to hit the F12 button once, and a window will open on the bottom of the browser window. Make sure to navigate to the ‘console’ tab there, it should look like this: https://i.imgur.com/Vzbqsj0.png
3. Now, enter the following code to the console input (I’m assuming the search ID on the results page is still 3):
ASP.api(3, 1, ‘getStateURL’);
..and then hit the enter key to execute it. It should return something like this: https://i.imgur.com/dN5jDJL.png
4. That is the state URL of the current search filters and input. You can right click to copy it. Using that URL will open the same exact page with these exact filters selected.
In my case this URL was exactly this.
You can use this method to generate any states, then copy the URLs. If you visit these URLs the search is re-created with the filters and the search phrase chosen.Best,
If you like my products, don't forget to rate them on codecanyon :)
April 24, 2020 at 2:22 pm #26894Participant
Thanks for that Ernest. As for the first issue, I will make do and just remove the filter option.
Thanks again! Have a great day.
You must be logged in to reply to this topic.