[theme-reviewers] CSS in a PHP file
wptr at edge22.com
Sun Jul 6 00:12:36 UTC 2014
No need to answer this - after writing all that and sending I thought why
not just add the CSS to wp_head above where the files are being queued - no
need to include an extra file and do all that fancy stuff if it's not
From: theme-reviewers [mailto:theme-reviewers-bounces at lists.wordpress.org]
On Behalf Of Tom
Sent: Saturday, July 5, 2014 4:57 PM
To: theme-reviewers at lists.wordpress.org
Subject: [theme-reviewers] CSS in a PHP file
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