WordPlate is a modern WordPress stack which tries to simplify the fuzziness around WordPress development. Using the latest standards from PHP. WordPlate utilizes WordPress as its dependency through Composer.
composer create-project wordplate/wordplate
- Installation
- Configuration
- Theming
- Plugins
- Gulp
- Multisite
- Post Types
- Taxonomies
- Custom Fields
- Translations
- Helpers
- Security
- Contributing
- Easy to setup
- Built with Composer
- WordPress as a dependency
- BrowserSync
- Environment files
- Versioning and cache busting
- WordPress Packagist
- Laravel Elixir
- Real GUIDs
To use WordPlate, you need to have PHP 5.6.4+ installed on your machine. You'll also optionally need Node.js and NPM installed if you want to use Elixir to compile your CSS and Javascript.
Make sure your server meets the following requirements:
- PHP >= 5.6.4
- Mbstring PHP Extension
Install WordPlate by issuing the Composer create-project
command in your terminal:
composer create-project wordplate/wordplate
The first thing you should do after installing WordPlate is to add WordPress salts to your .env
environment file.
Typically, these strings should be 64 characters long. The strings can be set in the .env
environment file. If you have not renamed the .env.example
file to .env
, you may do that now. If the WordPress salts is not set, your user sessions and other encrypted data will not be secure!
Please visit WordPlate's salt page and copy the WordPress salts to your environment file.
WordPlate supports WordPress 4.0+
and comes with the latest version out of the box. If you want to specify an older version of WordPress you may add it to your composer.json
file.
"require": {
"johnpbloch/wordpress": "4.5.1"
}
This way you can lock the WordPress version number to the one you're working with. This could come in handy if you're opening your project six months from now and WordPress has released a new version with breaking changes.
Building your theme with WordPlate works like any other WordPress environment. Please use the WordPress documentation for reference.
Plate is a plugin with a bunch of defaults to help you make the most out of WordPress. It comes with handy features such as customizing the administrator dashboard. It is required by default. Please see the documentation for more information.
WordPress Packagist comes straight out of the box with WordPlate. It mirrors the WordPress plugin and theme directories as a Composer repository.
Require the desired plugin or theme using wpackagist-plugin
or wpackagist-theme
as the vendor name.
composer require wpackagist-plugin/wp-migrate-db
Packages are installed to public/plugins
or public/themes
.
This is an example of how your composer.json
file might look like.
"require": {
"wordplate/framework": "^4.0",
"wpackagist-plugin/polylang": "^1.0",
},
Please visit WordPress Packagist website for more information and examples.
WordPlate has integrated Elixir. It provides a clean, fluent API for defining basic Gulp tasks for your WordPlate application.
Before triggering Elixir, you must first ensure that Node.js is installed on your machine.
node -v
If you don't have Node on your machine you can install it by visiting their download page.
Within a fresh installation of WordPlate, you'll find a package.json
file in the root. Think of this like your composer.json
file, except it defines Node dependencies instead of PHP. You may install the dependencies it references by running:
npm install
If you are developing on a Windows system or you are running your VM on a Windows host system, you may need to run the npm install
command with the --no-bin-links
switch enabled:
npm install --no-bin-links
To use Elixir and Gulp, please run one of the following commands:
This script is for development. This script will first run all the Gulp tasks and then keep listening for changes you make in your asset files.
npm run dev
This script will automagically start a BrowserSync proxy. For more information about getting started with BrowserSync, please visit the Elixir documentation.
Then there is a script you should run before publishing your application. This script will compile all your asset files and revision them for cache busting.
npm run prod
For more information about Elixir please visit the official document page.
To send email with WordPress you can use the wp_mail
helper method. WordPlate provides a simple way to add custom SMTP credentials.
Require the mail package in the root directory of your project.
composer require wordplate/mail
Then update the credentials in your .env
environment file with your SMTP keys and you're good to go. Please visit the WordPress codex to read more about the phpmailer_init
action hook.
To add multisite support to WordPlate you can head over to our multisite plugin here on GitHub.
Note: This plugin is still under development, you may use it at your own risk. We haven't had any issues ourselves but please be cautious.
For custom post types we recommend looking at Extended CPTs by John Blackbourn. The package provides extended functionality to WordPress custom post types, allowing developers to quickly build post types without having to write the same code again and again.
register_extended_post_type('event');
For taxonomies we recommend looking at Extended Taxonomies by John Blackbourn. The package provides extended functionality to WordPress custom taxonomies, allowing developers to quickly build custom taxonomies without having to write the same code again and again.
register_extended_taxonomy('location', 'event');
For custom fields we recommend looking at the following plugins:
- Advanced Custom Fields - Powerful fields for WordPress developers.
- Papi - A different approach on how to work with fields and page types in WordPress.
WordPlate by default, doesn't provide translations. However, we're big fans of the Polylang plugin. We've created a bridge which makes it easy to integrate Polylang within your application.
Require the translator package, with Composer, in the root directory of your project.
composer require wordplate/translator
Login to the WordPress administrator dashboard and active the Polylang plugin.
Register the translations with the register_translations
method.
register_translations([
'general' => [
'general-language-english' => 'The english language',
'general-language-swedish' => 'The swedish language',
],
'contact' => [
'contact-email' => 'Contact page email string',
'contact-mobile' => 'Contact page mobile string',
'contact-telephone' => 'Contact page telephone string',
],
]);
Then to fetch and print a translation you can use the trans
method.
echo trans('contact-email');
Please visit Polylang's documentation to find out more about translating your post types.
WordPlate includes a variety of "helper" PHP functions. You are free to use them in your own applications if you find them convenient.
WordPlate support both Laravel's collections and helper methods. This means you can use great debugging methods such as dd()
and string helpers like str_contains()
.
Below is a list of all supported helper methods.
Though WordPlate makes your WordPress site more secure out of the box you should always try to get ahead. We suggest reading this article to learn more about WordPress security.
WordPlate comes with the wp-password-bcrypt
package to replace WordPress's outdated and insecure MD5-based password hashing with the modern and secure bcrypt.
We recommend taking a look at the Soil plugin by Roots. It is a A WordPress plugin which contains a collection of modules to apply theme-agnostic front-end modifications. The plugin also address some security concerns for WordPress themes.
Please review our contribution guidelines before submitting a pull request.