I would like to set my styling-colors of my wordpress-theme with theme-options. My problem is, how do I get the color-value of theme options into my css? I know where the theme-options values are stored, but how can I connect this with my css?
I would like to set my styling-colors of my wordpress-theme with theme-options. My problem
Share
Use PHP to write a CSS file every time theme options change (a CSS cache).
You can also take advantage of CSS preprocessors like Less or Sass, which compile the CSS for you.
Sample code, assuming you are using the WP options API:
Put inline CSS code in your theme header:
(Worst possible option) Turn your stylesheet into a PHP script that outputs
text/css. This is bad because you’re forcing your server run WordPress twice for every user page request. You could call a script that only loads basic WP components, but it’s still going to be slower than using a static CSS