[theme-reviewers] CSS in a PHP file

Tom 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:
https://gist.github.com/proframework/79dd529afbbad4d84ea0

 

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
refreshing.

 

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
downfalls there?

 

Second, is there any way I can get css.php and customize.php to play nice?

 

Thanks!

Tom

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wordpress.org/pipermail/theme-reviewers/attachments/20140705/a4c1e67f/attachment.html>


More information about the theme-reviewers mailing list