Saltar navegación

[Resuelto] User Date filter search between dates

This support ticket is created hace 5 años, 5 meses. 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/Karachi (GMT+05:00)

Este tema contiene 2 respuestas, tiene 2 mensajes.

Última actualización por leilaG hace 5 años, 5 meses.

Asistido por: Waqar.

Autor
Mensajes
#1294011

How do we add user date picker / filter that can search between 2 dates, when the user selects a specific date

For example:

Visitor 1 - Arrival Date 26/07/2019 Departure date 27/07/2019
Visitor 2 - Arrival Date 27/07/2019 Departure date 27/07/2019
Visitor 1 - Arrival Date 23/07/2019 Departure date 29/07/2019

We would need all 3 visitors to show when the user selects 27/07/2019 as the visitor is still present on the departure date.

#1294513

Hi Leila,

Thank you for contacting us and I'd be happy to assist.

If your goal is to add a search filter that targets a "specific date" to show the available visitors, based on the separate arrival and departure date fields, you can follow these steps:

1. In the "Query Filter" section, please include filters for arrival and departure date fields, so that the arrival date field is compared as "lower than or equal to" and departure date is compared as "greater than or equal to".

Please also make sure to set the same URL parameter for both fields.
( screenshot: enlace oculto )

2. In the "Search and Pagination" section, you can include the code to show the front-end date selection field, like this:


<div class="form-group">
	<label>[wpml-string context="wpv-views"]Target Date[/wpml-string]</label>
	[wpv-control-postmeta field="wpcf-arrival-date" type="date" url_param="wpv-wpcf-target-date"]
</div>

Notes:

1. Please make sure to use the URL parameter value, the same as used in the "Query Filter" ( wpv-wpcf-target-date )

2. The "wpcf-arrival-date" can be replaced with the slug of either arrival or departure date field, used on your website.

I hope this helps and please let me know if you need any further assistance around this.

regards,
Waqar

#1295325

That worked perfectly! Thank you so much 🙂