maartenvangelder / wordpress
A modern WordPress scaffold
Installs: 4
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Type:project
Requires
- php: >=8.1
- composer/installers: ^1.2.0
- johnpbloch/wordpress: ^4.9.0
- oscarotero/env: ^2.1
- roots/bedrock-autoloader: ^1.0
- roots/bedrock-disallow-indexing: ^2.0
- roots/soil: ^4
- roots/wordpress: ^6
- roots/wp-password-bcrypt: ^1
- vlucas/phpdotenv: ^5.5
- wikimedia/composer-merge-plugin: ^2
- wpackagist-plugin/acf-content-analysis-for-yoast-seo: ^3.0
- wpackagist-plugin/another-simple-image-optimizer: ^0.3.0
- wpackagist-plugin/classic-editor: ^1.6
- wpackagist-plugin/w3-total-cache: ^2
- wpackagist-plugin/wordpress-seo: ^26.0
Requires (Dev)
- squizlabs/php_codesniffer: ^3.0
- wp-cli/core-command: ^2.0
- wp-cli/entity-command: ^2.0
- wp-cli/extension-command: ^2.0
- wp-cli/wp-cli: ^2.0
README
A WordPress 'Pro' scaffold, based on the Bedrock WordPress boilerplate, with a customized theme loosely based on Sage.
Based on
Quick start
Create a new project
Run composer create-project grrr-amsterdam/wordpress-scaffold <project>
.
This will create a new project in the chosen directory. It will also initiate an interactive shell where the following things will be done for you:
- Install root Composer dependencies
- Create and prefill a
.env
file (essentials only) - Create a database
- Install WordPress
- Rename the theme folder
- Prefill the
style.css
file - Install theme Composer dependencies
- Install npm packages
- Run
yarn build
- Activate the theme and plugins
Theme & asset building
We use Yarn for managing our front-end dependencies, and (grrr-gulpfile)[https://github.com/grrr-amsterdam/gulpfile] for building all the assets.
Commands should be run from inside the theme folder: web/app/themes/*
.
- For watching and buildint, run
yarn watch
oryarn build
- For building production assets, run
yarn build:production
Deploying
We use Capistrano for deployments.
Run bundle install
to install the necessary requirements, or run gem install bundler
first if you don't have Bundler.
Initial server setup can be done via cap <env> deploy:setup
, after verifiying that the server config is correct in config/deploy/<env>.rb
This will create a few directories, install Composer and WP-CLI, and copy some files which need to be persistent between deploys (eg. files in de shared
folder).
Deployments and rollbacks can be done via:
cap <env> deploy
and cap <env> deploy:rollback
Structure & flow
Theme settings & logic
We try to avoid extensive logic in templates or partials. Most logic can be found in lib\<namespace>
, and all classes are autoloaded thru PSR-4. Directories with classless functions (like libs/Grrr/Utils
and libs/Sage/
) need to be specified explicitly in the functions.php
. Loading them thru Composer will fail, since we 'hoist' the theme composer dependencies to the main composer.json
on install.
Plugins & dependencies
WordPress and WordPress plugins should be required by Composer in the root of the project. Dependencies explicitly required by the theme (a SDK for accessing an API for example) should be included in the theme, which has its own composer.json
.
Requiring a plugin works by using WordPress Packagist:
composer require wpackagist-plugin/<plugin-slug>
Paid plugins should be included in the repo, and excluded form exclusion in the .gitignore
file.
Updating WordPress & plugins
Updating WordPress or plugins is as simple as running composer update johnpbloch/wordpress
or composer update
for everything.
Paid plugins can be updated in development, whereafter the updated files can be committed to the repo.