You can put lipstick on a pig, but it's still a pig.
(pig: WordPress, lipstick: Starter themes)
We created Rye because there are times when we need to build high performing applications with a WordPress backend. When we do this, we don't want several layers of abstraction existing simply to help the majority of developers.
What Rye does:
- Isolates the boilerplate code you need to write to one place.
- Gives you a simple and modern/psr-4-ready file architecture to start with.
What Rye does not:
- Try to make you buy stuff.
- Add too many layers of abstraction.
- Add dependencies (except for composer - which you can strip if you want).
- Override default WP conventions. WP methods will always remain true.
Please make sure you have npm and gulp installed globally.
- Download and add this project as a theme in your WP installation. Rename the directory to something relevant.
composer installso the gulp plugins will be installed.
- Edit the package.json file. The project name will be used to set the name for the compiled asset files.
- Configure the configuration array in init.php.
- Add custom theme-specifc logic to lib/Rye/Grain.php.
- Add any other classes and namespaces to this directory.
- Develop your styles using
gulp at any time will build your assets. For convience, run
gulp watch and your files will be compiled automatically as you edit them.
- Rye The Rye class. Not much to do here. It's the "core".
Grain A good place to add helper/utility methods. Can be later accessed like
- Rye::$grain The Grain singleton reference. This gets instantiated in Rye's init.
- Rye::package() The package.json file as a php object.
- Rye::projectName() Returns sanitized name specified in the package.json file.
Rye::$enviornment A static property which tells Rye which enviornment to run in. This is in the functions.php file for you. It can be assigned to 1 of 4 constants;
- Rye::stylesheet() Outputs style tags using the appropriate css file based on the enviornment property.
- lib/ Put any other custom classes you may need and configure the init.php file.
- templates/ A place to put partials and custom templates.
- style.css This shouldn't be used. It's only required to specify information about the theme for WordPress.
- assets/css Any css or pre-processor css file such as .styl or .less files should be included here. The main entry file should be called app.(type).
- assets/js/vendor These files don't get compiled/minified after gulping. They should be specified in the functions.php file (in the Rye config array) so WordPress is aware of them. This will eliminate any chance of duplicate libraries being added after installing plugins.
Plugin recommendations for doing things.
- WP Mail SMTP Allows you to specify a SMTP server to use for WP's mail function.
- Advanced Custom Fields Great for making the CMS user-friendly for data driven websites.
- Contact Form 7 Great for creating forms using the CMS.
- Yoast SEO Plugin Gives you total control over meta tagging and dynamic page titles.
- W3 Total Cache Makes using CDN's very easy, amongst other techniques.