[Résolu] Showing post titles as select dropdown in views search form
This support ticket is created Il y a 3 années et 8 mois. There's a good chance that you are reading advice that it now obsolete.
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
In your view, where you'd like to show this select/dropdown field, you can place this shortcode like this:
[show_custom_title_field type="newspaper-title"]
Please note how I've used the required post type's slug "newspaper-title" in the shortcode attribute "type".
Next, you can include the following custom script in your view's "JS editor", to make the page redirect to the post which is selected through this new select/dropdown field:
Note: The custom code examples from our forum are shared to get you started in the right direction. You're welcome to adjust them as needed and for more personalized customization assistance, you can consider hiring a professional from our list of recommended contractors: https://toolset.com/contractors/
Thank You for this code, so far so good. What do I need to change, I assume in the view I need to change something, maybe by adding an additional filter, to show the results when a customer change in the drop down hidden link
to the selected title?
Additional, to the view I have, how can I change the view results, that it showing nothing, respectively only when the customer choosed a filter?
Thanks for writing back and Saturday and Sunday are my off-days.
When a select/dropdown is available to pick a specific post's title, it doesn't make much sense to use any other search filter from the view's search form. That is the reason, in the last step of my previous reply, I shared some script that would redirect to the selected post, once the selection is made.
I would recommend moving this custom select/dropdown field at the top of the view and include a note for visitors that they can either select the specific post from the dropdown or use the search fields below, to search for other posts that they're interested in.
In our situation it makes sense to have as we need it. Those custom post types don't have them single "page" - instead, it should show only the specific choosed "Title" (post) in this page: hidden link
From there the customer can "order" respectively request and order what he need.
We like to use this dropdown, if a customer already know what "newpaper" he like to order. So he not need to do all search first.
I am sure it is possible to do it, I just don't know how to manage the "search" result.