FacetWP / use-child-theme

A WordPress class to ensure that a child theme is installed and active
65 stars 21 forks source link

Use the WP Filesystem API #5

Closed justintadlock closed 8 years ago

justintadlock commented 8 years ago

Right now, the script uses file_put_contents(). This would fail the WordPress.org Theme Check. I imagine it'll fail ThemeForest's check too. If the intention is to add this to themes, you'd want to make sure the code would pass at those two places.

Here's a link to the WP Filesystem API: https://codex.wordpress.org/Filesystem_API

FWIW as a WordPress theme review admin, I doubt we'd allow this type of script within themes in the directory. It'd probably fall under what we consider "plugin territory". However, if you want to make a case for allowing it in themes, you'll want to make sure it's using the Filesystem API.

mgibbs189 commented 8 years ago

@justintadlock Good call, I'll get it switched to $wp_filesystem.

Re: inclusion in theme directory, it's a grey area for sure. Since its only purpose is to check for a child theme, it makes much more sense as a theme component than as a plugin.

The purpose of this project is to promote child theme usage, especially for non-technical users who would otherwise be modifying parent themes directly.

mgibbs189 commented 8 years ago

@justintadlock Added a new branch: https://github.com/FacetWP/use-child-theme/blob/wp-filesystem/use-child-theme.php

So far it only supports direct access. Still not sure how to handle displaying the Credentials form if needed for FTP/SFTP connections...

justintadlock commented 8 years ago

I haven't actually ever worked with it myself, but Otto wrote a tutorial on using it. You might be able to learn a little bit from it. http://ottopress.com/2011/tutorial-using-the-wp_filesystem/