Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm creating a theme where i want it to have different widgets and plugins. Each plugin would ideally have it's own css file. However, this approach is not so good because i can end up having multiple files included in my header.

Is there an approach where i can sort of cache all different css files in a single one upon the first user request and then just use that ?

share|improve this question
add comment

3 Answers

up vote 4 down vote accepted

Yes: put them all in a function, and then enqueue that function at the wp_enqueue_scripts hook. That way, you can define the CSS dynamically (e.g. based on Theme option settings), and let WordPress output it in the document head.

share|improve this answer
    
+1 That sounds interesting, but it would still load different css files right ? Is it possible to load a single one using that or an altered technique? –  SpyrosP Jun 24 '11 at 18:51
    
No; it would just output multiple <script> calls in the document head. –  Chip Bennett Jun 24 '11 at 20:11
add comment

WP Minify does the job quite well too. Little easier to configure than W3TC and integrates nicely with WP Super Cache if you're already using it.

share|improve this answer
add comment

W3 Total Cache is your friend. It has the ability to combine and concatenate js/css files out of the box. You'll have to do some manual configuration, but the pros outweigh the cons.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.