814 posts
  • Author had a Free File of the Month
  • Exclusive Author
  • Sold between 10 000 and 50 000 dollars
  • Bought between 1 and 9 items
  • Referred between 1 and 9 users
  • Serbia
  • Has been a member for 5-6 years
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

3433 posts Ruben Bristian
  • Most Wanted Bounty Winner
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Has been a member for 6-7 years
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Won a Competition
  • Bought between 100 and 499 items
  • Exclusive Author
  • Referred between 500 and 999 users
+5 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?

491 posts
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Won a Competition
  • Referred between 1000 and 1999 users
  • Author had a Free File of the Month
  • Author had a File in an Envato Bundle
  • Bought between 10 and 49 items
+3 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.

3069 posts
  • Has been a member for 6-7 years
  • Won a Competition
  • Sold between 50 000 and 100 000 dollars
  • Bought between 10 and 49 items
  • Referred between 50 and 99 users
  • Exclusive Author
  • Romania
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
  • Bought between 10 and 49 items
  • Elite Author
  • Europe
  • Exclusive Author
  • Has been a member for 4-5 years
  • Referred between 10 and 49 users
  • Sold between 50 000 and 100 000 dollars
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.

403 posts Keep Walking
  • Has been a member for 3-4 years
  • Elite Author
  • Sold between 100 000 and 250 000 dollars
  • Bought between 100 and 499 items
  • Referred between 100 and 199 users
  • Exclusive Author
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
  • Author had a File in an Envato Bundle
  • Bought between 1 and 9 items
  • Elite Author
  • Europe
  • Exclusive Author
  • Has been a member for 4-5 years
  • Referred between 100 and 199 users
+2 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

814 posts
  • Author had a Free File of the Month
  • Exclusive Author
  • Sold between 10 000 and 50 000 dollars
  • Bought between 1 and 9 items
  • Referred between 1 and 9 users
  • Serbia
  • Has been a member for 5-6 years
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

491 posts
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Won a Competition
  • Referred between 1000 and 1999 users
  • Author had a Free File of the Month
  • Author had a File in an Envato Bundle
  • Bought between 10 and 49 items
+3 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
  • Author had a File in an Envato Bundle
  • Bought between 1 and 9 items
  • Elite Author
  • Europe
  • Exclusive Author
  • Has been a member for 4-5 years
  • Referred between 100 and 199 users
+2 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