Skip Navigation

[Resolved] Dropdown menu of post type

This support ticket is created 5 years, 7 months ago. 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.

This topic contains 1 reply, has 1 voice.

Last updated by myleneB 5 years, 7 months ago.

Author
Posts
#1216985

Tell us what you are trying to do? I have a post type called establishment. I have 30 establishments entered. On the sidebar of a page, I would like to put a dropdown list (select) of all establishments. and upon choosing one, clicking on the button would direct us to the establishment's page.

I tried doing a view - custom search or view - show all results, but with the new Toolset I cannot find where or how to do this, which is super simple!

I tried hand coding, but it doesn't work, as I don't know where/how to redirect or to tell the Single etablissement page to accept a get parameter (establishment ID).

Example:
[wpv-layout-start]
[wpv-items-found]
<!-- wpv-loop-start -->
<form action="hidden link" method="get">
<select name="etablissement[]" class="js-wpv-filter-trigger wpcf-form-select form-select select" data-currentposttype="etablissement">
<option value="0" selected="selected" class="wpcf-form-option form-option option">Choose</option>
<wpv-loop>
<option value="[wpv-post-id]" class="wpcf-form-option form-option option">[wpv-post-body view_template="loop-item-in-test7"]</option>
</wpv-loop>
</select>
<input type="submit" class="wpv-submit-trigger js-wpv-submit-trigger btn" name="wpv_filter_submit" value="Go">
</form>
<!-- wpv-loop-end -->
[/wpv-items-found]
[wpv-no-items-found]
[wpml-string context="wpv-views"]No items found[/wpml-string]
[/wpv-no-items-found]
[wpv-layout-end]

#1217023

My issue is resolved, but for those wondering, here is the solution:
1) Choose display all results for your view
2) Hand code in loop editor:

[wpv-layout-start]
[wpv-items-found]
<!-- wpv-loop-start -->
<form action="hidden link" method="post">
<select name="etablissement[]" class="js-wpv-filter-trigger wpcf-form-select form-select select" data-currentposttype="etablissement">
<option value="0" selected="selected" class="wpcf-form-option form-option option">Choose</option>
<wpv-loop>
<option value="[wpv-post-slug]" class="wpcf-form-option form-option option">[wpv-post-body view_template="loop-item-in-test7"]</option>
</wpv-loop>
</select>
<input type="submit" class="wpv-submit-trigger js-wpv-submit-trigger btn" name="wpv_filter_submit" value="Go">
</form>
<!-- wpv-loop-end -->
[/wpv-items-found]
[wpv-no-items-found]
[wpml-string context="wpv-views"]No items found[/wpml-string]
[/wpv-no-items-found]
[wpv-layout-end]

3) and in template:
[wpv-post-title]

The trick is to set form action to your base page, method set to Post, then have [wpv-post-slug] as value that is passed in post.