WordPress.org

Ready to get started?Download WordPress

Forums

Meteor Slides
streamlining resources (4 posts)

  1. kriskl
    Member
    Posted 2 years ago #

    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/

  2. Josh Leuze
    Member
    Plugin Author

    Posted 2 years ago #

    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' );
    
    	}
    
    }
  3. kriskl
    Member
    Posted 2 years ago #

    thank you so much for quick reply!
    really appreciated :)

    will try this code

    thanks again
    Kris

  4. Josh Leuze
    Member
    Plugin Author

    Posted 2 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic