[Resolved] Loading theme style sheets before plugin style sheets

Home Forums Support [Resolved] Loading theme style sheets before plugin style sheets

Home Forums Support Loading theme style sheets before plugin style sheets

  • This topic has 5 replies, 3 voices, and was last updated 4 years ago by David.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1184902
    David

    Hi,

    Lately, I am getting mobile usability warnings in Google Search Console.
    From what I can see, some style sheets aren’t being loaded (Unknown error).
    The number of errors for a page varies among different trials (when using the Live Pagetest). Sometimes enough gets loaded so I don’t get a mobile usability warning.
    I tried Google’s robots.txt testing tool and it can access the stylesheets.

    Also, I seem not to experience any issues when using the standard mobile usability tester.

    From several web discussions I gather that many users experience this, in particular since the new search console (with various themes and WordPress installations); some people have been successful by inlining critical stuff.

    I also had the CSS files combined into one using Breeze (a Cache plugin that can also minify and combine CSS and js files) to reduce the number of requests, but that doesn’t solve the problem. Then that large CSS file doesn’t get loaded.

    Now I am thinking to load theme stylesheets plus the GP premium plugin stylesheet(s) first and then normal plugin stylesheets like Tablepress, Contactform 7, Table of content etc. after that, hoping that this will allow for a more consistent proper rendering of the page in Googlebot.

    How could I achieve this?

    Manu thanks for reading.

    #1185396
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    You would need to dequeue those stylesheets using wp_dequeue_style(): https://developer.wordpress.org/reference/functions/wp_dequeue_style/

    Then you can re-add them using wp_enqueue_style(), and set the in_footer parameter to true: https://developer.wordpress.org/reference/functions/wp_enqueue_style/

    However, it’s best to check with the developers of those plugins – there may be a better way of doing it that will be more update-proof.

    #1208017
    David

    Thanks a lot for your reply. I have experimented with this and decided not to go down this route for the time being.
    One final question:
    Could it be that GeneratePress inlines part of the CSS?
    It looks like that when I look at the Web response in Google console (or is there some other plugin at work?).

    #1208268
    David
    Staff
    Customer Support

    Hi there,

    yes GP uses inline styles for the Customizer settings and things like a Header Element.

    #1208302
    David

    Thanks again.
    Al the best.

    #1208305
    David
    Staff
    Customer Support

    Glad we could be of help

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.