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

Emil Uzelac emil at themeid.com
Tue Apr 5 03:17:42 UTC 2011


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

> On Mon, Apr 4, 2011 at 8:15 PM, Lmm Muc <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
> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wordpress.org/pipermail/theme-reviewers/attachments/20110404/0b9ca80b/attachment.htm>


More information about the theme-reviewers mailing list