February 13, 2017 at 12:53 pm
I am having some issues with using the Advanced Custom Fields (ACF) plugin in the Virtue Premium theme. Specifically, some of the jQuery date/time Javascript is conflicting with jQuery date/time scripts in the ACF plugin. The following scripts are loaded into WP-Admin post pages from the Virtue lib/cmb (Custom Metaboxes) directory:
– jQuery UI Datepicker 1.10.4
– jQuery.timePicker.js
– cmb.js which is a script that appears to initialize the previous two scripts
When these scripts load, they overwrite any jQuery date/time picker scripts loaded from ACF, and cause the timepicker not to show up for my custom fields.
I was able to deregister the conflicting scripts, which were used by Custom Metaboxes in Virtue theme, with the following code which runs in the admin_enqueue_scripts action:
global $post;
if ( $hook == ‘post-new.php’ || $hook == ‘post.php’ ) {
if ( ‘post_type_name’ === $post->post_type ) {
wp_deregister_script( ‘cmb-datepicker’ );
wp_deregister_script( ‘cmb-timepicker’ );
}
}
This is not ideal though, because I have no control over how Virtue Premium registers these scripts. I opened a ticket with ACF, and they suggested I also notify your developers that this is a compatibility issue with the theme and the ACF plugin. I know this is a fairly widely used plugin for development of custom post types, so I was wondering if we could load your scripts in a way which doesn’t conflict with those from other plugins.