No announcement yet.

Do CSS hook boxes create extra calls?

  • Filter
  • Time
  • Show
Clear All
new posts

  • Do CSS hook boxes create extra calls?

    If we create a Hook Box for CSS on specific pages (via conditionals) does that create an additional CSS file that is called upon page load? And, if so, would that extra call then increase page load speed? My concern isn't just one extra CSS but if I used Hook Boxes for this purpose I could inadvertently create too many CSS files.

  • #2
    No, CSS Hookboxes simply echo the CSS directly from the <head> of your site. So no extra CSS files or calls and therefore should cause no difference in page load times.


    • Sogwap
      Sogwap commented
      Editing a comment
      This is one of the reasons I really like DWB.

  • #3
    So as a best practice, if we have CSS that is specific to a certain page should we put that in a Hook box then? Versus the general style sheet? Or if we have CSS for pages vs posts, etc. In the past I've always just placed these in hook boxes but I'm trying to really focus on page performance right now.


    • SiGa
      SiGa commented
      Editing a comment
      Alternative method: You can use simple CSS and put it in Custom CSS (which is minified). Each page got its ID added as a class to the body tag, so you donĀ“t necessarily have to use hooks and conditionals to address individual pages.

  • #4
    Yeah SiGa that was what I was thinking. Thanks.


    • #5
      Yeah, for general CSS like this I usually just stick it in the Custom CSS feature, which like SiGa mentioned is minified for greater efficiency. I usually use the CSS Hook Boxes when I either want to match up some specific styles with something specific I did with a PHP/Text Hook Box, of if I use a certain bit of styling for specific pages and therefore assign it to a Custom Label that I can then assign on a per-page basis. But that's just me. It can be used however it best suits your needs.