WordPress.org

Support

Support » Plugins and Hacks » [Plugin: Easing Slider] how to deregister slider on pages it is not used on

[Plugin: Easing Slider] how to deregister slider on pages it is not used on

  • Sjourney
    Member

    @sjourney

    AFAIK, this plugin only allows 1 slider and yet it loads the js and styles on every page.
    I’m trying to manually deregister the plugin via functions.php
    The issue that I’m running in to is that the styles and script.

    From a simple recursive grep I’ve learned that Slider enqueues as far as scripts:

    easingslider.php:wp_enqueue_script('media-upload');
    easingslider.php:wp_enqueue_script('thickbox');
    easingslider.php:wp_enqueue_script('uploadimagebutton');
    easingslider.php:wp_enqueue_script('jquery');
    easingslider.php:wp_enqueue_script('easing');
    easingslider.php:wp_enqueue_script('script');

    I hesitate to deregister ‘script’ because it seems a tad on the generic side and perhaps another plugin or essential function may use such a name.
    and as far as styles:

    easingslider.php:wp_enqueue_style('thickbox');
    easingslider.php:wp_enqueue_style('slider');

    Here’s where I got so far:

    /*  Remove Easing Slider javascript from every page except Frontpage */
            /*  http://www.position-relative.com/2010/wordpress/wordpress-only-load-plugins-on-pages-that-need-them/
            ================================================================== */
    
            add_action( 'wp_print_scripts', 'deregister_slider_javascript', 100 );
            function deregister_slider_javascript() {
                if ( !is_page(home) ) {
                    wp_deregister_script( 'easing' );
                    wp_deregister_script( 'slider' );
                }
            }   
    
            /* Remove Easing Slider CSS from every page except Frontpage
            ================================================================== */
            add_action( 'wp_print_styles', 'deregister_slider_styles', 100 );
            function deregister_slider_styles() {
                if ( !is_page(home) ) {
                    wp_deregister_style( 'easing' );
                    wp_deregister_style( 'slider' );
                }
            }

    But I still have inline CSS injected in to pages.
    Any advice?

    http://wordpress.org/extend/plugins/easing-slider/

  • The topic ‘[Plugin: Easing Slider] how to deregister slider on pages it is not used on’ is closed to new replies.