can I pre-define some parameters in the shortcode, to be able to load the search while it is already open at a specific setting?
The only way to predefine the selected search criteria in a parametric search form is to link to the search form page using URL parameters, as I described earlier. You cannot use shortcode attributes or any other method to pass arguments into the View that predefine search criteria.
Hi Christian,
Thanks for the clarification.
If the custom search is not suitable, is there another way that I can create a view that has a dropdown list, but I can predefine a certain custom field to show, and then visitors can choose another option from the dropdown list to change the displayed text?
basically the flexible search solution you helped me to develop works great, but it is either I start with all the results displayed, then the results keep shrinking, or I hide all the results until all dropdown list choices are chosen.
the first solution leads to loading an enormous amount of text, and the second solution leads to people visiting an empty page with some dropdown lists.
What I am hoping for is a solution whereby the visitor to the post "Genesis Chapter 1" will see some text (say the KJV translation), then they can change the translation later.
Linking to a search page is understandable, but how can it be applied in this scenario?
Is there any solution that can achieve something close to what I am describing?
thanks
is there another way that I can create a view that has a dropdown list
The only way to create a View that responds to a dropdown list is to use a parametric search form and the approach I have described. Any other solution will require custom code that falls outside the scope of what we offer here in the forums. If you need professional help with this code, you can contact one of our certified partner contractors:
https://toolset.com/consultant/
Linking to a search page is understandable, but how can it be applied in this scenario?
Let's say you have a link somewhere on your site that should redirect to Genesis Chapter 1, KJV. You want that link to send the User to a page with the search form View and the "Genesis Chapter 1 KJV" results shown. You want to preselect "Genesis", "Chapter 1", and "KJV" in the search form. On the page with the link, create the href URL for that link using the proper URL parameters:
<a href="https://yoursite.com/page-with-search-form?wpv-bible-book=01-genesis&wpv-bible-chapter=chapter-01&wpv-bible-translation=kjv">Read Genesis Chapter 1 (KJV)</a>
The User clicks your link and ends up at the correct parameterized URL. The correct post is displayed in the View results. The filters in your search form will be preselected because you supplied values in the URL. The User may change the translation filter from KJV to NIV, then the URL will change and the NIV translation will be displayed in the results section. The User may change the chapter or book as well, updating the URL and displaying the correct post in the View results. This is the best way to accomplish what you have described without writing a lot of custom code.
Is there any solution that can achieve something close to what I am describing?
Beyond the approach I have described, you can write custom code to create your own custom search form filters. Redirect the User to the correct, parameterized URL when they submit the form.
Thanks a lot Christian.
I really appreciate the extent and accuracy of your help in this ticket. You helped me to achieve results that are beyond my capabilities. Much appreciated.
Can I suggest that you file a "feature request" for future update to enable adding parameters to the custom search shortcode? I can see huge potentials for this option that I could have used it if it was present. I am sure that some other users can benefit from this too.
Thanks again.