Here's an alternative solution for embedding php in the Wordpress.css stylesheet (a utility that I'm not sure about) that does not require manipulation of the Wordpress core.
Just create an inline CSS php file in the theme directory containing regular code:
embedded_style.php
<?php header("Content-type: text/css"); ?> <?php $body_color = get_color(); ?> body { background: none; color: <?php echo $body_color ?>; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; font-size: 10pt }
Then import this dynamic file into your style.css themes so you don't have to change the core of Wordpress.
style.css
@import url(embedded_style.php);
my 2 cents
The genesis of this snippet was an attempt to allow directory changes when importing css from the parent theme into my child. I did not like the idea of changing the core wordpress files, however, since most functions / hooks are not defined in runtime for style.css, in order to break the call, an alternative method had to be found. In the end, I did not use this for the same reasons that I could not interrupt the file call (it is too early to use convenient Wordpress constants, etc.), However, I hope it is useful to someone else.
tonyest
source share