Closed DaveyJake closed 4 years ago
Hi Davey,
Sorry for the delay into looking into these changes! I moved house earlier this week and have only just got back online!
I'll properly review these commits and get back to you very soon.
Cheers
Hi Davey,
What issue was being caused after the last merge using WP conditionals to check if the script should be loaded dependant on ACF?
I don't really want to be editing and renaming the jquery.timepicker script as that could well cause issues with maintaining the plugin in the future.
Cheers
Hey mate!
The ACF plugin uses a different jQuery Timepicker plugin from a completely different codebase. The issue is a namespace conflict as both are named $.fn.timepicker
.
When ACF and WPCM are used on the same post type (wpcm_match
in this case), the ACF version gets loaded long before the WPCM version does. As a result, the UI when selecting a match date becomes unusable and doesn't function at all as expected.
Hi mate,
Sorry for the delays! Things are a bit crazy over here with the lock down... strange times indeed.
Thanks for the reply. I would then be inclined to revert our timepicker script to the same one used by ACF, which uses jQuery UI so will be a good fit anyway. I would rather maintain the separate field for the match time in the match admin page so we could use the .timepicker object.
Then we should use WP conditional functions to enqueue scripts if ACF isn't installed.
Hey Davey,
I've taken a good look into this now and am going to resort to your suggestion as I much prefer the timepicker plugin we are already using!
I've forked the jquery-timepicker plugin and renamed the function. I've committed the new timepicker version to the dev branch so feel free to check it out and give me feedback before I release v2.1.10.
Thanks for your help again :)
Renaming the plugin ensures complete ACF compatibility with no conflicts at runtime. The
timepicker
now works as expected. The changes made for this to work include the following:$.fn.timepicker
to$.fn.wpcmtimepicker
.jquery-timepicker
plugin instances inmeta-boxes
andjquery.timepicker
files.WPCM_Admin_Assets
class file to its original version with no conditional checks.meta-boxes.js
module using WordPress linter rules.jquery-timepicker
from version1.11.13
->1.13.0
.