Skip Navigation

[Resolved] Create a drop-down list for a search page according to date.

This support ticket is created 6 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
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 4 replies, has 2 voices.

Last updated by augustd 6 years, 8 months ago.

Assisted by: Beda.

Author
Posts
#612092

I need to create a search function where i can select a date: Year, Month or Week need to be available....i could not find anything related to this 🙁 i know that items are already sorted according to date on an ASC or DESC order but that is not enough. Any help would be kindly appreciated....

#612351
Bildschirmfoto 2018-02-03 um 07.13.40.png

In Toolset Views you can set an order by parameter using the Post date, and you can set up Query Filters but you cannot create Custom Searches with this values.

This means, you cannot have a Front End filter for the Post data as Date, Author, Title and more.

Hence, what you can do is add a Query Filter for the date as:

Published date is equal to: year:URL_PARAM(search_year), month:URL_PARAM(search_month), week:URL_PARAM(search_week)

Then, create a Custom Link or input that you can check in the front end, just like in any other search, and you link to the page with the View, passing the correct URL parameters.

For example, if you set up a filter like above, you can link to the View like this:

<em><u>hidden link</u></em>

This will then give you only posts published in 2017. The below gives only February 2017 posts.

<em><u>hidden link</u></em>

My search terms are according to what I set in the Query Filter as seen in my screenshot.
It can be anything you like, as long you follow this syntax when calling it:

site.com/page-where-view-is/?search_key=search_term&search_key=search_term&etc

If you want to create this list of links or inputs dynamically you can also use a View, where you query the posts and output only above search links, by using ShortCodes for the year, month and week values.

You can as well submit these links by AJAX, if your View uses AJAX updating, when you add the class js-wpv-filter-trigger to your inputs.
This will ensure that if clicked, the AJAX is updated with the value you pass in the input's value and name attribute.

For example, the below triggers the AJAX updated search if clicked
(you need to change result each time input changes, in the AJAX settings of the View):

    <input type="checkbox/radio/text/etc" name="your_url_parameter" class="js-wpv-filter-trigger" id="unique_id" value="term_to_search" /><label for="eat"></label>

This last approach will NOT work if the inputs are created OUTSIDE the filter editor area of the very view.

#612778
Screenshot 2018-02-05 14.10.14.png
Screenshot 2018-02-05 14.09.16.png

Hi Beda, thanks for the answer... i think i got it but i am yet to finish this. What i did was to create a custom field based on the Date and a view that uses that custom field in order to filter through items. My issue now is why i can not add a custom field ( from Toolset ) to a post that has been created outside the plugin...i am working with Events Espresso along side with toolset. I can set a parent-child relationship between the posts created by both plugins but when it comes to a custom field i am not seeing any of the event posts created by the second plugin...
Do you have any experience with this ?

#613278

I have Split your Ticket here:
https://toolset.com/forums/topic/event-espresso-plugin-post-types-are-not-available-in-types-custom-fields-groups/

There we will handle this new topic.

The problem of this very ticket here is solved?

#613345

yes we can consider it closed.

This ticket is now closed. If you're a Toolset client and need related help, please open a new support ticket.