Skip Navigation

[Resolved] custom field search that shows select dropdown of selected year

This support ticket is created 4 years, 8 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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 4 replies, has 2 voices.

Last updated by Luo Yang 4 years, 8 months ago.

Assisted by: Luo Yang.

Author
Posts
#1812957

Tell us what you are trying to do?

Hi, I am a total Toolset beginner. I am rebuilding this website (the link below will link you to the page that I am trying to replicate) using WordPress and Toolset.
hidden link

The link below is the "new" page that I am having the issues with:
hidden link

I have a few custom search fields that the end-user should be able to search such as the "All Show Locations" (this search filter is working and producing results)

I am having issues figuring why the select dropdown is not filtering the "All Years" dropdown?

I have two custom fields "Start Date" and the "End Date" this is not working, I found the snippet (see below) in one of Toolset's forums to achieve the select dropdown fields. I only used the "Start Date" custom field (wpv-wpcf-start-date-location to filter the search along with the "All Shows Location" dropdown.

<div class="form-group">
<label for="wpv-wpcf-start-date-location">[wpml-string context="wpv-views"][/wpml-string]</label>
<select id="wpv_control_select_year-filter" name="year-filter" class="wpv-filter-trigger form-control">
<option value="">All Years</option>
<option value="2020">2020</option>
<option value="2019">2019</option>
<option value="2018">2018</option>
<option value="2017">2017</option>
<option value="2016">2016</option>
</select>
</div>

I am confused and I cannot figure what to do...below is the remainder of the code in the "Search and Pagination" in my show-list view section, would you kindly guide me to the right documentation or do you have any advice?

_______________________________________________________________

<div class="row">
<div class="col-md-4"></div>
<div class="col-md-4"></div>
<div class="col-md-4"></div>
</div>[wpv-filter-start hide="false"]
[wpv-filter-controls]
<div class="form-group">
<label for="wpv-location"></label>
[wpv-control-post-taxonomy taxonomy="location" type="select" default_label="All Show Locations" url_param="wpv-location"]
</div>

<div class="form-group">
<label for="wpv-wpcf-start-date-location">[wpml-string context="wpv-views"][/wpml-string]</label>
<select id="wpv_control_select_year-filter" name="year-filter" class="wpv-filter-trigger form-control">
<option value="">All Years</option>
<option value="2020">2020</option>
<option value="2019">2019</option>
<option value="2018">2018</option>
<option value="2017">2017</option>
<option value="2016">2016</option>
</select>
</div>

_______________________________________________________________________________

I need to point out that since I am rebuilding this site in WordPress the post-type "Shows" has about 50 posts all created in the year 2020 (last week to be exact)..is this why my date custom fields are not producing search results say for 2019? Should I have used "post-date" instead?

Any help or guidance will be greatly appreciated.

Thanks,
Juan Vazquez

#1813015
search-and-pagination.jpg

Here is a Search and Pagination code and screen shots:

#1813517

Hello,

I assume you are going to setup a select field "Year" on custom date field "Start Date" in the search form .

If it is, there isn't such kind of built-in feature within Toolset plugins, within custom search form, the custom date field can setup as datepicker or text input field, it can not be setup as select field. So it needs custom codes, but according to our support policy, we don't provide custom codes support.

And there is a workaround without custom codes, for example, you can create another select field "Year", edit each post, setup the value in field "Year", edit your post view, you will be able to add the "Year" field into custom search form.

#1821805
search-and-pagination.jpg

Thank you, but I am not sure if you saw the snippet of code that I found on your forum. I will re-attach or can you lead me to a tutorial that better explains what is available for custom date fields. Or, would someone will be able to help me accomplish what I am trying to do?

#1821829

The screenshot you provided above:
https://toolset.com/wp-content/uploads/2020/10/1821805-search_and_pagination.jpg

It is using static HTML codes to construct the "year" select, see HTML document:
hidden link

It won't load data from your database, and it won't set default value after you submit the search form.

As I mentioned above, you can try the custom field workaround:
https://toolset.com/forums/topic/custom-field-search-that-shows-select-dropdown-of-selected-year/#post-1813517

If you need custom codes solution, according to our support policy, we don't provide custom codes support:
https://toolset.com/toolset-support-policy/

You can also check our Toolset Contractors for it:
https://toolset.com/contractors/