I am creating a theme where user can save custom styles from theme customizer through settings API. Those style info are saved in options table as serialized data.
When Custom skin is active I will have to print those css styles in the site. There are three route I might go about it.
- Printing custom styles on header area with
<style>
tag. - Creating a
custom.css.php
file where I print those styles. - Create a css file using php file operation and save those styles whenever user saves custom styles.
All those have pros and cons
- Printing inside
<head>
using<style>
: The theme will be used by internet marketers and they are concerned about code to text ratio. Adding a 20-30 lines of css code will increase code ratio. Creating CSS file using PHP
header()
: Wordpress functions isn't available. Will need to load them which is inefficient. Also IE have some issues with this method.Writing a CSS file whenever user saves custom style: It seems to be a good idea. But I don't have enough knowledge about what is the pros and cons of this method. And if there is any permission issues the theme may be facing when it installed in various servers by users. I will appreciate if you could enlighten me on this topic.
So, What is the right way to go with in this situation.