0
votes

I am using a WordPress Theme - Rock 'n' Rolla which uses prettyPhoto as it's default lightbox for image galleries.

I have built a child theme and I want to disable prettyPhoto to replace it with a different lightbox solution.

In the functions.php file on the parent theme, it has the following function

function rock_n_rolla_scripts() {

    wp_enqueue_style( 'bootstrap', get_template_directory_uri() .'/assets/css/bootstrap.css' );
    wp_enqueue_style( 'flexslider', get_template_directory_uri() .'/assets/css/flexslider.css' );
    wp_enqueue_style( 'font-awesome', get_template_directory_uri() .'/assets/font-awesome/css/font-awesome.min.css' );
    wp_enqueue_style( 'prettyPhoto', get_template_directory_uri() .'/assets/css/prettyPhoto.css' );
    wp_enqueue_style('rock-n-rolla-google-fonts', '//fonts.googleapis.com/css?family=Lato:400,300,700,400italic,900|Oswald:400,700');
    wp_enqueue_style( 'rock-n-rolla-ie-style', get_stylesheet_directory_uri() . "/assets/css/ie.css", array()  );
    wp_style_add_data( 'rock-n-rolla-ie-style', 'conditional', 'IE' );
    wp_enqueue_style( 'rock-n-rolla-style', get_stylesheet_uri() );

    wp_enqueue_script( 'bootstrap', get_template_directory_uri() . '/js/bootstrap.js', array('jquery') );
    wp_enqueue_script( 'prettyPhoto', get_template_directory_uri() . '/js/jquery.prettyPhoto.js', array('jquery'));
    wp_enqueue_script( 'flexslider', get_template_directory_uri() . '/js/jquery.flexslider.js', array('jquery') );
    wp_enqueue_script( 'rock-n-rolla-custom-js', get_template_directory_uri() . '/js/custom.js', array('jquery') );
    wp_enqueue_script( 'rock-n-rolla-ie-responsive-js', get_template_directory_uri() . '/js/ie-responsive.min.js', array() );
    wp_script_add_data( 'rock-n-rolla-ie-responsive-js', 'conditional', 'lt IE 9' );
    wp_enqueue_script( 'rock-n-rolla-ie-shiv', get_template_directory_uri() . "/js/html5shiv.min.js");
    wp_script_add_data( 'rock-n-rolla-ie-shiv', 'conditional', 'lt IE 9' );
    wp_enqueue_script( 'rock-n-rolla-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20151215', true );
    wp_enqueue_script( 'rock-n-rolla-skip-link-focus-fix', get_template_directory_uri() . '/

Commenting out the prettyPhoto elements disable it however I know this would not be the correct way to go about this due to updates overriding the changes.

I have tried adding a functions.php file and creating that function without prettyPhoto elements but with no success unfortunately.

1

1 Answers

0
votes

You can add this function to the child theme:

function pplabs_custom_scripts() {

/*
 * Remove PrettyPhoto Lightbox plugin
 */
   wp_dequeue_script( 'prettyPhoto' );

/*
 * Add Your New Lightbox plugin
 */
    wp_enqueue_script( 'child-theme-lightbox', get_stylesheet_directory_uri() . '/js/child-theme-lightbox.js' );

}
add_action( 'wp_enqueue_scripts', 'pplabs_custom_scripts', 100 );