815 posts
  • Has referred 1+ members
  • Has sold $10,000+ on Envato Market
  • Has collected 1+ items on Envato Market
  • Contributed a free file of the month
+3 more
rvision_ says

So nobody sets the headers for customstyles.php to
<?php header("Content-type: text/css"); ?>
, adding it as any other external CSS to the head?
<link rel="styleheet" href="<?php bloginfo('stylesheet_directory'); ?>/customstyles.php" media="screen">

I do something similar for theme styles.

And also for the editor: http://themeforest.net/forums/thread/add_editor_style-bug-in-v341/71574

3557 posts Ruben Bristian
  • Sells items exclusively on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $500,000+ on Envato Market
  • Has been part of the Envato Community for over 6 years
+10 more
KrownThemes says

To echo custom rules inside a style block of header is not a bad practice and also has absolutely zero impact on performances/load times while to write an external css file with custom values requires an additional server request which is far more costly in terms of resources. BF

so if i have 200 lines of custom css code, should i add it to the header of each file?

493 posts
  • Has referred 1000+ members
  • Has sold $250,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+8 more
pixelentity says

so if i have 200 lines of custom css code, should i add it to the header of each file?
yes.

that will still be way faster than loading another file.

3072 posts
  • Has referred 50+ members
  • Has sold $40,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Had an item featured on Envato Market
+5 more
wickedpixel says

I also use a dynamic style tag in the header for style options. Putting stuff in a special file (like the css.php example file )only complicates things because that means a new set of queries for wordpress to make to generate a new file + another file to request/load from server. Is not worth the cost, in my opinion.

38 posts
  • Has been part of the Envato Community for over 4 years
  • Has referred 10+ members
  • Has sold $75,000+ on Envato Market and is now an Elite Author
  • Has collected 10+ items on Envato Market
+5 more
Lion says

For custom CSS styling I generate + minify css file and save it on server only when user clicks on ‘Save Changes’ button in theme options, so there are no additional WP queries made on each page view.

422 posts Keep Walking
  • Has been part of the Envato Community for over 3 years
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $125,000+ on Envato Market
  • Has collected 100+ items on Envato Market
+2 more
UXbarn says

Hmm. It looks like a kind of trade-off between the two methods right?

At first, I thought echoing custom style block directly to the header may not be a good way because the page would look too messy and, you know, kind of unorganized way to do so. But I never realized the fact of the performance as @pixelentity mentioned. That’s very great to know.

I just tried the method of “special” style file like style.php and that works perfectly too.

This is quite questionable for which one is better..

3007 posts
  • Has been part of the Envato Community for over 4 years
  • Has referred 200+ members
  • Has sold $250,000+ on Envato Market
  • Had an item featured in an Envato Bundle
+7 more
duotive says

To echo custom rules inside a style block of header is not a bad practice and also has absolutely zero impact on performances/load times while to write an external css file with custom values requires an additional server request which is far more costly in terms of resources. BF

Exactly what i wanted to say. STAY AWAY FROM EXTERNAL PHP FILES . They have huge impact on performance and if they have the folder wp-content set to 777 or any folder that is parent to the php file it will not execute on some servers. Trust me, we used it with fortune and three and we had issues, so we added the extra styles in the header, that loads faster and less support on the matter. In short – NO TO EXTERNAL PHP

815 posts
  • Has referred 1+ members
  • Has sold $10,000+ on Envato Market
  • Has collected 1+ items on Envato Market
  • Contributed a free file of the month
+3 more
rvision_ says

For custom CSS styling I generate + minify css file and save it on server only when user clicks on ‘Save Changes’ button in theme options, so there are no additional WP queries made on each page view.

+1, exactly

493 posts
  • Has referred 1000+ members
  • Has sold $250,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+8 more
pixelentity says

I just tried the method of “special” style file like style.php and that works perfectly too.
i can hardly see any advantage in doing that.

with almost any server now supporting gz compression, a 8kb uncompressed css block would just add like like 1-2kb to the page.

BF

3007 posts
  • Has been part of the Envato Community for over 4 years
  • Has referred 200+ members
  • Has sold $250,000+ on Envato Market
  • Had an item featured in an Envato Bundle
+7 more
duotive says

For custom CSS styling I generate + minify css file and save it on server only when user clicks on ‘Save Changes’ button in theme options, so there are no additional WP queries made on each page view.

How many customers had issues with this? I can bet that many did not have the permission set for the file/folder and windows servers will bust the writing process + get_files_content restriction in effect, those are a few problems that i can say for sure that you have with this.

by
by
by
by
by
by