Forums › Forums › Search & Filter Pro › Datepicker Conflict with Tribe Events
- This topic has 11 replies, 3 voices, and was last updated 4 years, 1 month ago by Ross.
-
Anonymous(Private) October 1, 2020 at 5:21 pm #261624
The datepicker on The Events Calendar bar is not opening when I have Search and Filter Pro activated.
As soon as I turn it off, the datepicker works again.
Please advise on how to fix this conflict.
Events page on my dev install is here: https://warf.greenleafmedia.com/events/
Ross Moderator(Private) October 6, 2020 at 7:44 pm #262130Hi Cory
I’ve been a bit snowed under but prioritising this for tomorrow – hopefully there might be a solution I can find, but it’s looking like using both datepickers on the same page won’t be possible.
Do you intend to use both on the same page?
If they will be on different pages, then I’m sure we can unload our scripts on those specific pages or visa versa.
Thanks
Ross Moderator(Private) October 7, 2020 at 1:51 pm #262211Hi Corey
So I would use this info here to unload S&F scripts:
https://searchandfilter.com/documentation/faq/#how-do-i-remove-cssjs-files-when-i-don8217t-need-themBut, do it conditionally.
I am guessing, perhaps, that you only use this URL for checking your events?
https://warf.greenleafmedia.com/events/That is a post type archive, so we can exclude that using: https://developer.wordpress.org/reference/functions/is_post_type_archive/
So, overall the code should look like:
add_action('wp_enqueue_scripts', 'remove_sf_scripts', 100); function remove_sf_scripts(){ if ( is_post_type_archive( 'tribe_events' ) ) { wp_deregister_script( 'jquery-ui-datepicker' ); wp_deregister_script( 'search-filter-plugin-build' ); wp_deregister_script( 'search-filter-chosen-script' ); } }
Let me know how you get on.
Thanks
-
AuthorPosts