About this topic

  • Posted by Jeremy Winter 1 year ago. There are 4 posts. The latest reply is from jonh_mh.
  1. First off I want to say, great work on your excellent plugin Byron.

    I love how powerful Photosmash is. My only concern is that Photosmash loads on all pages of a site. Personally, I only need one gallery, on one page. That equates to loading 4 extra files (2 .css files and 2 .js files) and adding about 1 second more to the load time of almost every page on my site.

    Is there a way to have the plugin check if the page being loaded is a "page", a "post" or a "slug"? Perhaps a "if (isPage() { }" conditional tag could be utilized to only load Photosmash on pages?

    I am comfortable with tweaking .php files so I would be more then happy with a simple hack if you are not interested in adding a feature like this to Photosmash.

    Thanks for your time Byron, it's great to see a WP plugin developer that actually supports their free product and not just their paid one. I look forward to checking out Photosmash Extend when it is released!

    - Jeremy Winter

  2. Hey Jeremy, have a look on this link: http://justintadlock.com/archives/2009/08/06/how-to-disable-scripts-and-styles

    Follow the steps and after add the Tags to just load the css's and js's on the page(s) that you want!

    I use this "trick" on other plugins but I suppose it will work just fine on Photosmash...

    Cheers.

  3. Thanks for the link John, I have been looking for a article like that for quite some time now. That will help with a couple other plugins that I have been manually editing on updates.

    It works fairly well with Photosmash. The hack unloaded all of the .js files, but I can't get it too unload the .css files. Also the inline javascript won't be removed as it's not loaded with the wp_enqueue_style function.

    Definitely a step in the right direction though!

    This is the code I am using

    <?php
    add_action( 'wp_print_scripts', 'my_deregister_javascript', 100 );

    function my_deregister_javascript() {
    wp_deregister_script( 'bwbps_js' );
    wp_deregister_script('jquery-form');
    wp_deregister_script('thickbox');
    wp_deregister_script('jquery_starrating');
    wp_deregister_script('jquery_datepicker');
    wp_deregister_script('jquery-ui-tabs');
    }
    ?>
    <?php
    add_action( 'wp_print_styles', 'my_deregister_styles', 100 );

    function my_deregister_styles() {
    wp_deregister_style( 'bwbpstabs' );
    wp_deregister_style( 'bwbpsuicore' );
    wp_deregister_style( 'bwbpsdatepicker' );
    wp_deregister_style( 'thickbox' );
    }
    ?>

  4. Nice Jeremy. I am glad that the article helped you.

    I haven't used the action to unload css's so I am not sure if has a "catch" on the code to make it work that I am not aware...

    If you are really counting the bytes you might be interested in using the "wp minify" plugin. If you are not already using it, it will take some few kb from your .js .css files!

    By the way don't forget to add some conditional tag's to your code above, or the plugin won't work att all :)

    have fun!

RSS feed for this topic