Disable prettyPhoto WordPress (Visual Composer)

Hi, I'm trying to configure WP Featherlight as a standard lightbox, right now Visual Composer is using prettyPhoto. So I need to disable it so that WP Featherlight overwrites it.

I asked wpbakery and I got an answer.

Hello, you can overwrite prettyphoto by adding prettyPhoto () to your functions.php file and call another lightbox.

And from the plugin author, I got the following:

When prettyPhoto is disabled, you don’t need to do anything else for the lightbox images on the site.

So, it is pretty clear what I need to do. Disable prettyPhoto. But I do not know how to do this. Can I add a simple line to my child functions.php theme? Or?

Any help would be really appreciated.

Thank.

+4
source share
6 answers

Put the following code in the theme theme 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 tested this on my installation and it works flawlessly.

What it does is dequeues and unregisters the javascript and stylesheets that Visual Composer creates and registers in all PHP plugin files for various template elements and shortcodes that use prettyPhoto lightbox.

Parameter "9999" provides that deletion / deregistration occurs well after the previous registration or registration occurred earlier when loading the plugin. Any number will do, but the larger the number, the better.

+3
source

javascript , :

function vc_prettyPhoto() {

}

prettyPhoto script, Visual Composer.

+1

, javascript. . Php

wp_dequeue_script( 'prettyphoto' );
wp_dequeue_style( 'prettyphoto' );

, , - King Composer, VC https://wordpress.org/plugins/kingcomposer/

0

, , ( , ).

ePix , Masonry Media Grid Visual Composer . 3 wp-content/assets/js/dist. :   vc_grid.min.js   page_editable.min.js   js_composer_front.min.js

Just remove window.vc_prettyPhoto() or vc_prettyPhoto() from wherever they appear.  

Lightbox dFactor, swipebox prettyPhoto. , . .

, -:)

0

Pretty Photo. , .

function remove_scripts(){
  wp_dequeue_script('prettyphoto' );
  wp_deregister_script('prettyphoto' );
}

add_action( 'wp_enqueue_scripts', 'remove_scripts', 100 );

.

0

, Visual Composer, . , Flexslider, Nivoslider Owl Carousel Visual Composer. functions functions.php:

add_action( 'wp_enqueue_scripts', 'deregister_vc_modules', 99 );
function deregister_vc_modules() {
    wp_deregister_style( 'flexslider' );
    wp_deregister_script( 'flexslider' );

    wp_deregister_style( 'nivo-slider-css' );
    wp_deregister_style( 'nivo-slider-theme' );
    wp_deregister_script( 'nivo-slider' );

    wp_deregister_style( 'owl-carousel' );
    wp_deregister_script( 'owl-carousel' );
}
0

All Articles