• Resolved ofmarconi

    (@ofmarconi)


    I know there is a specific plugin to disable other plugins, but it would be interesting if your plugin could contain something like this.
    Is it more complex than I imagine?
    I just want to disable it on LPs and Home.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author malihu

    (@malihu)

    Hey, thanks for the suggestion!

    I’ll need to check/test if I could make a mechanism to enable the user to (easily) disable it under certain conditions. This said, I think that it would be more inline with the scope of plugins (in general) to provide a code for the users to manually add in their theme/child-theme functions.php.

    Is this suggestion about improving page loading times or page scrolling performance? The plugin js file is about 25kb but usually, the best way to improve page loading times is by using a CDN and caching.

    Thread Starter ofmarconi

    (@ofmarconi)

    It’s more for maximum optimization, for example on a page where I don’t use the plugin, the recommendation is not to load it…

    I don’t know if this has been documented, but manual installation of the script on specific pages works in my case.
    (Also because I’m using LiteSpeed Cache optimization for Guests and it’s very aggressive, it doesn’t let any script run until the first interaction)

    I tried to do some “reverse engineering” looking for where the plugin settings that match your script sheet might be. But I was unsuccessful.

    Is the script sheet standard for all sites, or is it generated based on configured options?

    Thread Starter ofmarconi

    (@ofmarconi)

    Ahhh

    And about the script not executing on some pages, the Dequeue scripts option should resolve the issue, am I right?

    Plugin Author malihu

    (@malihu)

    Yes, you can use dequeue, e.g.:

    //Dequeue page scroll to id script
    function dequeue_ps2id_script() {
        //add condition here, e.g. if ( is_front_page() ) {
            wp_dequeue_script( 'page-scroll-to-id-plugin-script' );
        //}
    }
    add_action( 'wp_print_scripts', 'dequeue_ps2id_script' );

    The script is standard for all sites (normal/minified script id: page-scroll-to-id-plugin-script).

    Thread Starter ofmarconi

    (@ofmarconi)

    Perfect, I’ll test this ??

    Thread Starter ofmarconi

    (@ofmarconi)

    I did the following:

    I copied the JS scrolltoid.js and pasted it into uploads, I only call it on pages that I need with:

    (function() {
    var script = document.createElement('script');
    script.src = '/wp-content/uploads/JS/scrolltoid.js';
    script.onload = function() {
    console.log('OK');
    
    setTimeout(function() {
    var config = mPS2id_params.instances.mPS2id_instance_0;
    jQuery('a[href*="#"]').mPageScroll2id(config);
    }, 500);
    };
    
    script.onerror = function() {
    console.error('ERROR');
    };
    
    document.head.appendChild(script);
    })();
    Plugin Author malihu

    (@malihu)

    Thanks for posting the code ??

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Consider disabling the plugin on specific pages’ is closed to new replies.