• Resolved technicalx

    (@technicalx)


    Is there a way to override the public.js file without editing the plugin file to make sure changes are kept if plugin is updated?
    eg, setting slidesToShow for mobile to 2, I want that to stay after updates.

    breakpoint : 319,
    settings : {
    slidesToShow : 2,

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor Riddhi Shukla

    (@ridhimashukla)

    Hello,

    Thank you for reaching us…

    If you are a developer then you can override the plugin js file in your theme folder. You have to just dequeue the plugin js file and enqueue it from your theme folder.

    Please check and let me know if anything.

    Thread Starter technicalx

    (@technicalx)

    good point, I was thinking of a file override but dequeue would work.

    Thread Starter technicalx

    (@technicalx)

    actually it doesn’t work (unless you add localize script, see below), just creates a huge white gap a few pages high where the plugin would load.
    This is what I did.

    
    function replace_plugin_scripts() {
       wp_deregister_script('iscwp-public-js');
       //wp_dequeue_script('iscwp-public-js');
    
        wp_enqueue_script( 'iscwp-public-js', get_stylesheet_directory_uri().'/assets/js/iscwp-public-functions-override.js', array('jquery'), ISCW_VERSION, true );
    }
    add_action( 'wp_enqueue_scripts', 'replace_plugin_scripts', 90 );
    • This reply was modified 4 years, 3 months ago by technicalx.
    Thread Starter technicalx

    (@technicalx)

    nvm I got it. needed localize script added.
    For everyone else, here’s what I did and copied it to /wp-content/themes/whatever-child/assets/js/iscwp-public-functions-override.js

    // remove replace instagram plugin js
    function replace_plugin_scripts() {
        wp_deregister_script('iscwp-public-js');
    
        wp_enqueue_script( 'iscwp-public-js', get_stylesheet_directory_uri().'/assets/js/iscwp-public-functions-override.js', array('jquery','wpos-slick-jquery'), ISCW_VERSION, true );
        wp_localize_script( 'iscwp-public-js', 'Iscw', array(
    		'ajaxurl' 	=> admin_url( 'admin-ajax.php', ( is_ssl() ? 'https' : 'http' ) ),
    		'is_mobile' =>	(wp_is_mobile()) 	? 1 : 0,
    		'is_rtl' 	=>	(is_rtl()) 			? 1 : 0,
    		'load_text' => esc_html__('Loading...', 'instagram-slider-and-carousel-plus-widget'),
    	));
    }
    add_action( 'wp_enqueue_scripts', 'replace_plugin_scripts', 90 );
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘override slides on mobile without core hack?’ is closed to new replies.