Hi I'm trying to get WP Featherlight setup as the default lightbox, right now Visual Composer is using prettyPhoto. So I need to disable it, so that WP Featherlight will overwrite it.
I asked wpbakery and I got this response.
Hello, you can actually overwrite prettyphoto by adding prettyPhoto() in your functions.php and call another lightbox.
And from the plug-in author I got this:
Once prettyPhoto has been disabled, you shouldn't need to do anything else to lightbox images on the site.
So it's pretty clear what I need to do. Disable prettyPhoto. But I don't know how to do that. Can I add a simple line to my child theme's functions.php? Or?
Any help would really be appreciated.
Thanks.
Place the following code in your theme's function file.
function remove_vc_prettyphoto(){
wp_dequeue_script( 'prettyphoto' );
wp_deregister_script( 'prettyphoto' );
wp_dequeue_style( 'prettyphoto' );
wp_deregister_style( 'prettyphoto' );
}
add_action( 'wp_enqueue_scripts', 'remove_vc_prettyphoto', 9999 );
I have tested this on my installation and it works flawlessly.
What it does is dequeues and deregisters the javascript and stylesheets that Visual Composer enqueues and registers throughout the plugin's PHP files for the various template elements and shortcodes that use the prettyPhoto lightbox.
The '9999' parameter enforces that the dequeuing/deregistering happens well after any enqueuing or registering took place earlier on in the loading of the plugin. Any number will do, but the higher the number the better.