• Resolved RossB

    (@rossb)


    Hi.

    I’m using a Twenty Fourteen child theme. My site is here.

    A recent site performance report from GTMetrics recommended that I inline small CSS for the WordPress Popular Posts plugin, which had a “small response body”. The rationale for the recommendation was that inlining the response in HTML can reduce blocking of page rendering.

    Not sure what I need to do or how to go about it, but am assuming it’s not a long, complex task. Would be appreciative of some advice re this.

    Cheers
    Ross

    https://wordpress.org/plugins/wordpress-popular-posts/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Hector Cabrera

    (@hcabrera)

    Hi Ross!

    From a maintainability perspective, inlining CSS (that is, embbeding CSS directly into the HTML code of your site) is considered a bad practice and so I’m going to give you a different recommendation.

    Basically, assuming I got it correctly, what they asked you to do is to get rid of WPP’s stylesheet to reduce the number of files that the browser must load to render your pages. This is actually a good idea: the less files there are to load, the faster your page can be rendered.

    So, to avoid inlining WPP’s CSS and comply with GTMetrics’ suggestion:

    1. Go to Plugins > Editor and select WordPress Popular Posts from the dropdown.
    2. Click on wordpress-popular-posts/style/wpp.css to open WPP’s stylesheet, copy its contents.
    3. Paste WPP’s CSS into your theme’s stylesheet (you can do this via Appeareance > Editor, and then click on your theme’s stylesheet to edit it).
    4. Go to Settings > WordPress Popular Posts > Tools, set “Use plugin’s stylesheet” to disabled, and hit the Apply button to save changes.
    Thread Starter RossB

    (@rossb)

    Hi Hector and thanks a lot for your excellent and very clear recommendation. I have just followed your instructions and run the site through GTMetrix, and all fixed! Plus, the site speed has increased a few percent as a result – page speed score now 84% (up 2%) and Yslow score 95% (up 1%). I’ll take every improvement I can! I’ve been doing a lot of research on optimising my site for speed, and you have just provided one of the last pieces of the jigsaw!

    The only item they’re saying I should inline now is my child theme stylesheet. Is that even possible, I wonder?

    Whatever, again, many thanks for your prompt and productive reply!

    Cheers
    Ross

    Plugin Author Hector Cabrera

    (@hcabrera)

    Possible? Yes. You could embed the entire CSS code from your stylesheet into the HTML code but -as I said before- is not a good idea nor is practical, so I’d just leave it alone.

    If you want to further improve things, you could use a caching plugin. WP Super Cache -or was it W3 Total Cache?- includes a “combine stylesheets” feature that merges all the css files into one or something like similar (I’ve never used it tbh, but I’ve seen various mentions about this over the web and even here). Might be worth a shot.

    Thread Starter RossB

    (@rossb)

    Thanks for your further comments, Hector.

    Already using WP Super Cache. Don’t recall seeing that “combine stylesheets” option when going through the settings, but will check again.

    As you suggest, best to just leave the child theme stylesheet alone. I’m already getting v good load speeds for my site. You can get too obsessive about this optimising stuff, so time to pull back!

    Cheers
    Ross

    Thread Starter RossB

    (@rossb)

    Hector, if you’re still there, may I ask you a final question?

    Now that I’ve pasted the CSS from your plugin to my child theme stylesheet, should I also delete the WPP stylesheet?

    I’m thinking it would be a good idea to copy and paste the CSS from the stylesheets of some other plugins, as per your suggestion re the WPP stylesheet CSS, and would appreciate your thoughts on whether deleting the plugin stylesheets is generally advisable after such an action.

    Cheers
    Ross

    Plugin Author Hector Cabrera

    (@hcabrera)

    Hi Ross!

    If you disabled it as I suggested (see step 4), there’s no need to delete it as the browser won’t load it at all. If you decide to delete it after all, the next time you update the plugin WordPress will just recreate it again along with all plugin’s files.

    Thread Starter RossB

    (@rossb)

    Yep, I did disable it as per your suggestion. All AOK then!

    Thanks v much for your help, Hector.

    Cheers
    Ross

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘inline small css re WPP plugin’ is closed to new replies.