[theme-reviewers] CSS in a PHP file

Tom wptr at edge22.com
Sun Jul 6 01:14:25 UTC 2014


Just found that function – it's perfect!

 

Thanks!

Tom

 

From: theme-reviewers [mailto:theme-reviewers-bounces at lists.wordpress.org] On Behalf Of Daniel Tara
Sent: Saturday, July 5, 2014 6:14 PM
To: Discussion list for WordPress theme reviewers.
Subject: Re: [theme-reviewers] CSS in a PHP file

 

You can use the add_inline_style function and assign it the handle of the parent theme. That way the custom CSS will be printed precisely after the parent theme's stylesheet link and before the child theme's stylesheet link (assuming the parent theme's stylesheet has been correctly added as a dependency of the child theme's stylesheet)

 

Daniel

Sent from my iPhone


On 06 Jul 2014, at 04:05, "Philip M. Hofer \(Frumph\)" <philip at frumph.net> wrote:

It’s a love-hate relationship for sure

 

From: Emil Uzelac <mailto:emil at uzelac.me>  

Sent: Saturday, July 05, 2014 5:59 PM

To: Discussion list for WordPress theme reviewers. <mailto:theme-reviewers at lists.wordpress.org>  

Subject: Re: [theme-reviewers] CSS in a PHP file

 

And enemy as well ;)

 

On Sat, Jul 5, 2014 at 7:52 PM, Philip M. Hofer (Frumph) <philip at frumph.net> wrote:

the !important CSS flag in the customizer can be your friend

 

 

From: Tom <mailto:wptr at edge22.com>  

Sent: Saturday, July 05, 2014 5:22 PM

To: 'Discussion list for WordPress theme reviewers.' <mailto:theme-reviewers at lists.wordpress.org>  

Subject: Re: [theme-reviewers] CSS in a PHP file

 

… Well I thought I was smart and figured it out, but now it's above the parent theme CSS and the customize.php css is being ignored if it's also in the parent's css.

 

If anyone has any tips that would be awesome.

 

Sorry for the multiple emails.

 

Tom

 

From: theme-reviewers [mailto:theme-reviewers-bounces at lists.wordpress.org] On Behalf Of Tom
Sent: Saturday, July 5, 2014 5:13 PM
To: 'Discussion list for WordPress theme reviewers.'
Subject: Re: [theme-reviewers] CSS in a PHP file

 

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 needed. *facepalm*

 

Thanks guys!

Tom

 

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: 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


  _____  


_______________________________________________
theme-reviewers mailing list
theme-reviewers at lists.wordpress.org
http://lists.wordpress.org/mailman/listinfo/theme-reviewers


_______________________________________________
theme-reviewers mailing list
theme-reviewers at lists.wordpress.org
http://lists.wordpress.org/mailman/listinfo/theme-reviewers

 


  _____  


_______________________________________________
theme-reviewers mailing list
theme-reviewers at lists.wordpress.org
http://lists.wordpress.org/mailman/listinfo/theme-reviewers

_______________________________________________
theme-reviewers mailing list
theme-reviewers at lists.wordpress.org
http://lists.wordpress.org/mailman/listinfo/theme-reviewers

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


More information about the theme-reviewers mailing list