Support » Plugin: Progress Bar » Can I block CSS from loading

  • Resolved Preeminent

    (@preeminent)


    I’m hoping to cut down on extra requests on page load. Is there a good way to stop calling the extra css file for this plugin, and just add the css to my default site styles file?

    I’m also seeing a javascript file being called. Is that for the quick animation? Can I stop that as well?

    Thanks!

    http://wordpress.org/extend/plugins/progress-bar/

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Chris Reynolds

    (@jazzs3quence)

    Yep. You’d use wp_deregister_style and wp_deregister_script, respectively. The scripts and styles are hooked into init so you should be able to hook into anything that fires after that in a function like this:

    function dont_load_progress_bar_stuff() {
    wp_deregister_style( 'wppb_css' );
    wp_deregister_script( 'wppb_animate' );
    }
    add_action( 'init', 'dont_load_progress_bar_stuff' );

    If hooking it into init doesn’t work, you could try later…maybe after_setup_theme if you’re doing this in a theme.

    Plugin Author Chris Reynolds

    (@jazzs3quence)

    Thread Starter Preeminent

    (@preeminent)

    Awesome! Ok, so the “dont_load_progress_bar_stuff” would be my own hook from my theme, right? Just find a hook from my theme?

    Then, as long as I have the css, and don’t want the animated part, the progress bars should work fine without the javascript, right?

    Plugin Author Chris Reynolds

    (@jazzs3quence)

    that would be your function if you wanted to do a separate function. Alternately, if your theme is doing something like what twentyten/twentyeleven does with the twentyten_setup_theme function with all the setup stuff, you could probably throw it in there.

    And yeah, the only thing the javascript does is the pretty animation. I had considered eliminating it entirely from the plugin when I first wrote it but decided to keep it in because it’s not that big but it’s purely cosmetic. The only other thing is the jquery loading. Probably your theme or a plugin is loading jquery somewhere, so it’s not going to hurt anything, but I wouldn’t want to deregister jquery because that could prevent other plugins from being able to use jquery.

    Thread Starter Preeminent

    (@preeminent)

    Ok, it’s working as far as stopping those from loading, but now the progress bars aren’t showing. It’s actually just showing “50%” where the bar should be for example. So I will see if I can find something other than init to use.

    Plugin Author Chris Reynolds

    (@jazzs3quence)

    That’s actually probably right because you’re deregistering all the CSS and CSS is pretty much all the plugin is. Just copy the CSS from the stylesheet in the plugin into your theme’s style.css and you’ll be set.

    Thread Starter Preeminent

    (@preeminent)

    Ok, got it! Sorry, Chrome has been doing weird things today, and not accepting my css changes right away. I did have to use init. Again, thanks a ton for your quick help on this!!

    Plugin Author Chris Reynolds

    (@jazzs3quence)

    NP 🙂

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Can I block CSS from loading’ is closed to new replies.