Black Friday sale! Get 25% off WPSP Pro! Discount automatically applied at checkout.

[Resolved] Is Specific WPSP CSS Applied Sitewide?

Please login to receive premium support.

Support for the free plugin can be found here.

Home Forums Pro Support Is Specific WPSP CSS Applied Sitewide?

Tagged: 

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #11469
    Jake
    Participant

    Hi Tom,

    Absolutely love the plugin.

    I was wondering: Does the CSS styles applied to one WPSP apply across the site (i.e. added to a sitewide stylesheet)?

    For example, if I style a particular WPSP on a single page (using your inbuilt plugin styling, not my own added CSS) in a certain way, will the CSS that applies to that WPSP be carried across my entire site, or only on the pages where this particular WPSP is present?

    Thank you for your clarification! Love your work.

    #11500
    Tom
    Keymaster

    Hi there,

    If you use the ID in your CSS, it will only apply to that one list.

    For example, every list has a parent section element, which has a unique ID like this: wpsp-123

    123 is the ID of the list.

    So your CSS would look like this:

    #wpsp-123 h2 {
    
    }

    Let me know if you need more info šŸ™‚

    #11510
    Jake
    Participant

    Sorry for my poorly worded question Tom, that’s not quite what I meant.

    Rather, is there some WPSP CSS code baked into the plugin that is specific to each WPSP, but is being shown site-wide?

    e.g. there will be this code:

    #wpsp-123 h2 {
    
    }

    Shown on all page. This CSS code is specific to WPSP with ID 123, but is still being shown on the page even if this particular WPSP is not present on a particular page (but another WPSP is).

    Coming at it from a performance standpoint šŸ™‚

    #11587
    Tom
    Keymaster

    There is a CSS file being loaded for the lists on all pages, unfortunately. WordPress doesn’t provide a way to add styles only when a shortcode is present on the page. Loading javascript is different, as we can check the content before adding it to the footer. Since styles are loaded before the content, there is no way to check unless we load them in the footer.

    There are some plugins out there that should help, though: https://wordpress.org/plugins/wp-asset-clean-up/

    Hope this helps šŸ™‚

    #11594
    Jake
    Participant

    Hi Tom,

    As a user of GP Premium, I can see just how much effort you put into performance ā€“ so I had no doubt you were following best performance practices.

    That said I didn’t realize there wasn’t even an *option* for this kind of functionality. No wonder so many plugins have this issue.

    Just one more question to add to this then: does that mean that I should delete and/or draft any of the WPSP that I’m no longer using?

    Otherwise wouldn’t that mean that their specific CSS associated with them, e.g.:

    e.g. there will be this code:

    #wpsp-123 h2 {
    
    }

    Would be on all of my wordpress pages ā€“ even though the shortcode isn’t used? Since you can’t see if the WPSP is being used, I would presume that you publish the CSS based on its published/draft status?

    I realize this is a tiny amount of CSS, but if it’s WPSP that I’m no longer using then there is no point keeping them around if it’s adding even a tiny amount of CSS.

    Please let me know whether I can draft these posts to remove the CSS associated with them, or whether I need to delete the specific WPSP altogether.

    Thank you very much for your help Tom!

    • This reply was modified 1 year, 1 month ago by Jake.
    #11603
    Tom
    Keymaster

    does that mean that I should delete and/or draft any of the WPSP that Iā€™m no longer using?

    The stylesheet will only load once, regardless of how many WPSP lists you have on your website. Where possible, we load CSS specific to each list directly above the list in the HTML. This makes it so less CSS is added site-wide.

    As for your custom CSS, you can use a plugin like “Simple CSS” to add it only on specific pages. That way your CSS isn’t loading where it doesn’t need to.

    Let me know if that makes sense or not šŸ™‚

    #11606
    Jake
    Participant

    Where possible, we load CSS specific to each list directly above the list in the HTML. This makes it so less CSS is added site-wide.

    This is what I was asking, to avoid the case where code from a completely unused yet still published WPSP was adding sitewide CSS.

    Simple CSS is an excellent plugin and I use it. I hear the inventor is a nice guy!

    Thank you very much for your help Tom šŸ™‚

    #11640
    Tom
    Keymaster

    No problem! šŸ™‚

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