[theme-reviewers] File operations in themes, which PHP functions are/will stay allowed?

Justin Tadlock justin at justintadlock.com
Wed Apr 6 20:30:41 UTC 2011


We can all thank Otto for this:
http://ottopress.com/2011/tutorial-using-the-wp_filesystem

Great writeup!  Go ahead and bookmark it so we'll have a reference each 
time this same discussion crops up.

On 4/4/2011 10:17 PM, Emil Uzelac wrote:
> This is definitely the most comprehensive WordPress related e-mail 
> that I have ever seen.
> Thanks Otto.
> Emil
>
> *Emil Uzelac* | ThemeID | T: 224-444-0006 | Twitter: @EmilUzelac | E: 
> emil at themeid.com <mailto:emil at themeid.com> | http://themeid.com 
> <http://themeid.com/>
> Make everything as simple as possible, but not simpler. - Albert Einstein
>
>
>
> On Mon, Apr 4, 2011 at 9:51 PM, Otto <otto at ottodestruct.com 
> <mailto:otto at ottodestruct.com>> wrote:
>
>     On Mon, Apr 4, 2011 at 8:15 PM, Lmm Muc <lmmmuc at gmail.com
>     <mailto:lmmmuc at gmail.com>> wrote:
>     > I plan to write dynamic CSS to a file (ending on .css) located
>     in the theme
>     > folder
>
>     With regards to this specific problem, there is a couple of issues
>     with the idea:
>
>     1. On any kind of secure setup, you probably don't have permissions to
>     write files into the themes directory. Using the upload folder would
>     work, but suffers the same ownership problems. Using the WP_Filesystem
>     to write the file works around this ownership and permissions problem,
>     but if you write into the themes directory, a theme upgrade wipes out
>     your static file.
>
>     2. For any normal kind of theme, you probably don't have that much
>     dynamic CSS that you actually need to create. You probably only have a
>     few settings, for things like colors, fonts, etc. No more than 1K of
>     code, probably. The dynamic CSS should go *inline* in the page itself.
>     Minified, if you prefer.
>
>     Look at how the custom_background and custom_header stuff in core
>     works. It's creating CSS and then inserting it right into the page
>     using the wp_head hook. That's the right way to do dynamic CSS. Not
>     only does it avoid the whole writing files problem, but it also avoids
>     an extra HTTP round trip to the server to get your dynamically-written
>     static, but small, CSS file. It's actually faster and simpler to put
>     the dynamic CSS inline on the page itself.
>
>     -Otto
>     _______________________________________________
>     theme-reviewers mailing list
>     theme-reviewers at lists.wordpress.org
>     <mailto: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/20110406/24dff86a/attachment.htm>


More information about the theme-reviewers mailing list