[Support request] css affecting site speed

Home Forums Support [Support request] css affecting site speed

Home Forums Support css affecting site speed

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1998443
    Ewa

    Hello,

    I would like to ask you for an advice. For the moment I use customizer css to change styles on website.( CSS in external file).
    I would like to apply some css changes only for posts from specific category. I am wondering how to approach to that. I consider two options:

    1. the plugin which enables that: https://wordpress.org/plugins/postpage-specific-custom-css/
    2. Adding css field in admin to each post and page via advanced custom fields and then output css code from there in headers of each post / page (here said how to do it: https://www.satollo.net/custom-css-post-advanced-custom-fields-and-header-footer)

    Which approach do you think would be better for site speed?

    #1998498
    David
    Staff
    Customer Support

    Hi there,

    how much CSS are you writing for those category specific posts ?

    #1998517
    Ewa

    not much, just to add a border box with shadow and maybe two or three things more like this

    #1998534
    David
    Staff
    Customer Support

    You could use a Hook Element:

    https://docs.generatepress.com/article/hooks-element-overview/

    In the Hook content add your CSS inside style tags:

    <style>
    Your CSS goes here
    </style>

    Set the Hook to wp_head
    Set the Display Rule Locations to Post Category > Your Category.

    #1998575
    Ewa

    I didn’t know it’s possible. Great. Thats even easier.
    Thank you very much

    #1998865
    David
    Staff
    Customer Support

    Glad to be of help

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