Hi! I have a view in my front page showing all the CPT Tours. In each tour I'm displaying several custom fields, including next confirmed departure date. Confirmed departure date is a custom field that can have a list of departure dates. In this view I'm showing a blue element with the nearest confirmed departure date, if exists, so I did this: I created a fields & text block and use a shortcode to display only the first confirmed departure date. That's working OK. Then I created a conditional field and configured it so it only shows up if the confirmed departure date is not empty and put the fields & text block inside.
But it's not working fine. In the tours with at least one confirmed departure date saved it works fine, but I have some tours with no date and the blue area is showing but with no date, in other tours it's not showing at all correctly. Please help.
Thanks in advance!
hidden link
Hi,
Just like your other ticket, I'll need to see how this conditional block is set up in the admin area.
Can you please share temporary admin login details, in reply to this message?
Note: Your next reply will be private and making a complete backup copy is recommended before sharing the access details.
regards,
Waqar
Hi Waqar, I've sent you the admin access for the other ticket, thank you so much
Thank you for waiting, while I performed some testing around this.
I was able to reproduce this behavior on my test website too. When a conditional block is used for an empty value check for a date type custom field, it always returns false.
(it uses the current date value instead of the empty date field value, in the evaluation)
I've shared these findings with the concerned team for further review and will keep you updated through this ticket.
For now, I've included the following custom script in the 'Custom JS' section of the view "Todos los tours", which hides the date container, when there is no value:
jQuery( document ).on( 'ready js_event_wpv_pagination_completed js_event_wpv_parametric_search_form_updated js_event_wpv_parametric_search_results_updated', function( event, data ) {
jQuery('.tb-fields-and-text.tour-salida-grupo .salida-grupo_portada .salida-grupo_fecha strong').each(function () {
var $this = $(this);
if ($this.length) {
var selText = $this.text();
console.log(selText);
if(!selText.trim()) {
console.log('Empty!');
$this.parents('.tb-fields-and-text.tour-salida-grupo').hide();
}
}
});
});
My issue is resolved now. Thank you!