[theme-reviewers] CSS in a PHP file
wptr at edge22.com
Sat Jul 5 23:56:56 UTC 2014
Hi all, quick question!
Up until now, I've been generating all of my custom CSS generated by
customize.php straight into wp_head, which works fine.
However, my child theme queues the style.css above where my generated CSS is
output, meaning the child theme's CSS has to be more specific than what's
being set in customize.php.
This isn't a huge problem, but can be quite annoying for people trying to
add their own custom CSS.
I've been working on moving the CSS from wp_head into its own file -
css.php. Here are the stripped down contents of that file:
Then, in my functions.php file I include the css.php file, and then enqueue
the script like so:
wp_enqueue_style( 'generate-customize', site_url() . '/?' . $name .
'-css=css', false, GENERATE_VERSION, 'all' );
Now, this works perfectly when changing settings, saving and then
However, it doesn't work when changing the settings in customize.php, and
hoping to see them change right in front of you. You need to actually save
and refresh to see the changes.
I'm assuming this has something to do with using the $_GET variable?
I've thought of including the CSS in wp_head only while in customize.php,
but I figure I'd ask your opinion first.
First, is the way I've set up css.php safe using the $_GET variable? Any
Second, is there any way I can get css.php and customize.php to play nice?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the theme-reviewers