WordPress.org

Support

Support » Plugins and Hacks » [Plugin: Meteor Slides] streamlining resources

[Plugin: Meteor Slides] streamlining resources

  • Hi,
    I have installed and are enjoying using your plugin on my website,

    I have noticed however one thing, (which maybe is a bug?)

    the plugin causes every webpage to load 1 css style / and 3 java scripts
    should not it be the case, that it should load them only on pages with slides?

    we’re trying to cut down the amount of javascripts loading .. to make the website faster,
    if there any solution for this?

    thanks
    Kris

    http://wordpress.org/extend/plugins/meteor-slides/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Josh Leuze

    @jleuze

    Hi Kris, loading the scripts on every page is actually how it is supposed to work.

    It seems a little counter-intuitive, but it actually takes more resources to dynamically check each page for a slideshow than too just load the scripts on each page. Especially when you consider that the scripts are cached after the first page and are not being re-downloaded.

    However the issue is only with dynamically checking for the slideshow as I would have to do within the plugin. For your use, since you know exactly which page/pages will have a slideshow, you can conditionally load the scripts just when you need them.

    Here’s an example you could add to your theme’s functions.php file to only load the scripts on the homepage, assuming you just have a homepage slideshow:

    // Remove Meteor Slides scripts from all but the frontpage:
    
    add_action( 'get_header', 'remove_meteorslides_scripts' );
    
    function remove_meteorslides_scripts() {
    
    	if ( !is_front_page() ) {
    
    		remove_action( 'wp_print_scripts', 'meteorslides_javascript' );
    
    		remove_action( 'wp_enqueue_scripts', 'meteorslides_css' );
    
    	}
    
    }

    thank you so much for quick reply!
    really appreciated 🙂

    will try this code

    thanks again
    Kris

    Plugin Author Josh Leuze

    @jleuze

    No problem Kris, let me know if that doesn’t work for you.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: Meteor Slides] streamlining resources’ is closed to new replies.