Some WordPress themes include sliders that are implemented using the same slider library as in the Reviews Slider shortcode (or Gutenberg block). For example, WoodMart theme includes a slider to display multiple pictures of a product. In these cases, it is possible that a conflict between different sliders will occur and impact functionality of the sliders.


The conflict can be resolved by adding a custom code snippet to the functions.php file as shown below. PHP development skills are required in order to correctly apply this solution. Please take a full backup of your website before making any changes to the functions.php file.


function dequeue_cr_slick_script() {
    global $wp_scripts;

    $handle = false;
    $reviews_handle = 'cr-reviews-slider';

    foreach ( $wp_scripts->queue as $script ) {
        if( $script == $reviews_handle ){
            continue;
        }

        $ex = "~^(.*)slick(.*)\.js$~";
        if ( preg_match( $ex, $wp_scripts->registered[$script]->src ) ) {
            $handle = $script;
        }

    }

    if ( $handle ){
        wp_dequeue_script( $reviews_handle );
        wp_add_inline_script($handle, 'jQuery(document).ready(function() {jQuery("div.cr-reviews-slider").slick()});');
    }
}

add_action( 'get_footer', 'dequeue_cr_slick_script', 100 );