Skip Navigation

[Resolved] Date range datepicker filters do not work in WordPress Archive

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.

This thread is resolved. Here is a description of the problem and solution.

Problem: The date range datepicker filters I added to my custom search WordPress Archive do not appear to be working. No calendar icon is shown.

Solution: Check to be sure jQuery is not loaded more than once. In this case, the Quick Donate widget is overwriting the jQuery library incorrectly.

This support ticket is created 6 years, 11 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 12 replies, has 2 voices.

Last updated by Michelle Dodd 6 years, 11 months ago.

Assisted by: Christian Cox.

Author
Posts
#603884

I am trying to:
I have added front-end filters for searching by category or tag, but I also need to add a date-range search for the user.

I have a post type of "Press Releases", I added a custom fields including a "Release Date". The archive is set up to show press releases in order by this Release Date. But I also need the user to be able to filter results shown by category AND a date range of the Release Date. I set up the archive and have everything displaying and working correctly except for this date search.

In the Custom Search Settings > Filter Editor I added a new filter, chose the Release Date custom field.
-- Type of control: Datepicker
-- Filter Comparison: SQL datetime using comparison BETWEEN
-- Date format: left blank
-- Default date: left blank
-- Labels: lower end: From, Higher end: To
-- URL parameter for lower and higher ends: these were automatically filled out, left as-is

When I save and reload the page, there are NO input fields at all for the two dates - only the labels are added. I've tried the different options of "Compare value as a" such as SQL date or number.

Please help me get this search on the front end figured out.

Link to a page where the issue can be seen:
hidden link
Password: Wild!

NOTE: this is a site in a WP Multisite install

#604097

Hi, it looks like you have things set up appropriately in your View, so I suspect something else is going on.
- There's an error shown in the JavaScript console when I view this page. It's difficult for me to tell if this error is preventing the View's datepickers from being initialized.
- Please temporarily disable all plugins except Types and Views, and activate a default theme like Twenty Seventeen. If you must activate a plugin like Maintenance Mode while testing that's fine.
- Test again, and check to see if the datepickers appear as expected. If they do, reactivate the parent Divi, then the child theme, then plugins one by one, testing each time until the conflict is revealed.

Please let me know what you find out.

#605548

I deactivated all plugins and the error you noticed was still in console and the date pickers still did not show up. I changed from Divi to Twenty Seventeen theme and the error was gone and the date picker did show up - however no field displayed to show the date picked - does that make sense?

Do you know if Toolset has issues with Divi in general?

Thanks,
Michelle

#605553

The other subsites on this multisite are not having this problem, but when Toolset is activated then they do. In the Network tab in the browser, it looks like jquery is being loaded twice. Could Toolset be loading it in addition to Divi or WordPress? Is there a way to block one of them from loading?

#605554

There are some known issues where Divi CSS clashes with Bootstrap, so I often recommend that Users disable Bootstrap in Toolset > Settings > General > Bootstrap Loading. However I do not think those would cause JavaScript errors like I see in the console, they usually just result in some minor styling and display issues.

Did you test with the parent Divi theme alone? I would like to eliminate the child theme as the source of the conflict before we continue to investigate. I have installed Divi parent theme version 3.0.95 locally, as well as Types and Views, and I am unable to replicate the error shown on your site so I suspect something else is going on.

#605561

I did set divi as the theme, without the child, and it was still happening 🙁

I have the setting for Bootstrap Loading: "This site is not using Bootstrap"

Thanks,
Michelle

#605571
Screen Shot 2018-01-11 at 5.37.39 PM.png

I changed from Divi to Twenty Seventeen theme and the error was gone and the date picker did show up - however no field displayed to show the date picked - does that make sense?
Yes, that is the expected behavior. No input field will be displayed, only the calendar icons.

In the Network tab in the browser, it looks like jquery is being loaded twice.
Okay that's not normal. Toolset does enqueue jQuery, but does so in a way that is compatible with WordPress and Divi. I see that one instance of jQuery is being loaded from guardiansinaction.org. Any ideas what's going on? Normally you would not load jQuery from another site like this. Screenshot attached.

#605573
Screen Shot 2018-01-11 at 5.45.16 PM.png

It's the Quick Donate donation form. Their code loads jQuery without checking to see if it's not already loaded. That's overwriting the jQuery library that is loaded by WordPress / Divi / Toolset. This little widget is going to cause fairly big problems unless you can configure it to not load jQuery.

#605577

Ack! Thanks for that! That was the issue!!

Thank you very much for your help, I really appreciate it!

Michelle

#605586

You're probably gone for the day, but how do I simply change the calendar icon to one of our own?

#605587
Screen Shot 2018-01-11 at 5.19.30 PM.png

I found this page, but it doesn't really help:
https://toolset.com/documentation/user-guides/styling-cred-forms/

What exactly does it mean to "use the wptoolset_filter_wptoolset_calendar_image filter "?

And how would I get the date in the box like in the example shown? There's no real help here. I think it's odd to assign an image for the datepicker trigger instead of an icon via css, and it's weird not to show an input field and only show the date result after. My graphic designer is going to flip her lid.

Any help you could give would be appreciated!

#606068

What exactly does it mean to "use the wptoolset_filter_wptoolset_calendar_image filter "?
It means to change the calendar icon image, you must add this code to your child theme's functions.php file:

function wpt_change_datepicker_icon(){
    $calendar_image = '<em><u>hidden link</u></em>'; // replace with your icon URL.
    return $calendar_image;
}
add_filter('wptoolset_filter_wptoolset_calendar_image', 'wpt_change_datepicker_icon');

how would I get the date in the box like in the example shown?
The default behavior of a CRED form datepicker is like you have described. The calendar icon shows up alone until you choose a date. There is no single setting you can choose to show a text input area before the calendar. It's possible to customize this to some degree with CSS and a bit of JavaScript as described in this other ticket:
https://toolset.com/forums/topic/datepicker-css-2/
If you would like additional assistance, feel free to create a separate ticket and assign it directly to me so we can investigate this in more detail.

I think it's odd to assign an image for the datepicker trigger instead of an icon via css
Agreed! However, we use jQuery UI, a common library, to show datepickers. This is how the jQuery UI library is set up to work with its theming systems. More info about that here, along with theming information:
hidden link

#607678

Thanks!

The forum ‘Types Community Support’ is closed to new topics and replies.