A Wordpress Boilerplate combining the best libraries and practices
Wordpress Keystone is a WordPress boilerplate designed for quickly building effective twelve-factor applications
WordPress Keystone is the combination of many libraries, taking inspiration and straight code from them. If you are confused on how some of the parts of this project work, checkout the following projects:
app
- Project functionality
app/components
- This is the bread and butter of the boilerplate. All your code you would usually stick
in functions.php
lives here. WordPress Keystone wil automatically parse folders within the components
folder
and have the files contained loaded under their wordpress filter or hook.
This forces developers to think about when there code is being executed within the WordPress runtime.
config
- All application configuration is found here including constant definition and bootstrapping
env
- Environment based files. Mainly docker configuration and tools are found within here.
resources
- Most importantly, your view files are found here as well as styles and scripts.
runtime
- Any application runtime files live here, besides uploads.
web
- This is your web root. Avoid putting anything in here if you can.
Install: composer create-project loonpwn/wp-keystone project-name
First Run a search and replace for the following:
local.wp-keystone
-> local.your-domainWordpress Keystone
-> Your Project Namewp-keystone
-> your-project-slugThen delete this section from the readme.
Note: this project uses docker for all its local development.
Local Setup
Copy over the env file cp -n .env.example .env
Copy over the htaccess cp -n web/.htaccess.sample web/.htaccess
Build & docker containers docker-compose up -d
Note: If you are already running apache or mysql on ports 80 / 3306, you can change the ports docker runs on in the
.env
file, otherwise close your other applications
Setup your hosts file. sudo sh -c 'echo "127.0.0.1 local.wp-keystone" >> /etc/hosts'
Mount yourself to the workspace ./env/mount-workspace.sh
Run the deployment script composer build
Install WordPress wp core install --url=local.wp-keystone --title="WordPress Keystone" --admin_user="wp-keystone" --admin_email="[email protected]"
Note: This command will output the admin password
Done. You can visit the site at http://local.wp-keystone
.
Note: Admin login is at http://local.wp-keystone/wp/wp-admin
and login with wp-keystone
. The local environment does not
check for a valid password so you can enter in anything.
This project uses a docker container which will host our site for us and be able to build all of our assets for us. Some useful commands:
docker-compose restart
- Restart the container./env/mount-workspace.sh
- Attach yourself to the workspace container