A VVV 2.x site template for Wordpress development. It includes an optimal structure for fast creation of a new site, composer.json
-enabled plugin workflow with ACF Pro and Timber plugins included, and a Timber based theme (default, but any other theme can be used as well).
The site template can be used for creation of multiple WP sites (projects) within one VVV VM. It is currently not optimised for WP multisite development.
- It makes it easier to start new sites on the same VVV install;
- it makes plugin installation effortless with
composer.json
and includes a couple of plugin dependencies that are useful for theme development; - it structures the project conveniently so that all the stuff related to one project ends up in the same place. It helps to separate stuff from multiple projects running in the same VM;
- all the unrelated files get ignored by default in the included
.gitignore
(you define what is whitelisted). So no logs or db files checked out accidentally; - by default it installs a boilerplate theme optimised for modern, highly automated, component-enabled, DRY development driven by Twig templates. See more information in the repo of the theme.
The site template uses VVV2 for local installation.
Default WP login and password are admin
and password
, and the MYSQL credentials are wp
/wp
.
- This site template assumes that you will store your project in a git repo of its own (it's perfectly possible to use non-git existing codebase with VVV 2.x, but maybe you don't need this template then);
- it is advisable to use a
.test
local domain. See why; - though not mandatory, it is a good idea to have your site folder located separately from the main VVV directory (with the
local_dir
key of project config invvv-custom.yml
).
First you need to install VVV itself. Skip this if you already have VVV 2.x installed. This part is pretty standard and is the same that the official installation procedure.
- clone or download VVV2 (follow the instuctions in their docs);
- create a copy of
vvv-config.yml
in the VVV2 directory naming itvvv-custom.yml
(see the installation note 2).
-
Fork this repo or push it to a Git server of your choice. Copy the git URL (SSH);
-
add the site to
vvv-custom.yml
, replacing placeholders in{}
accordingly:{your_project_name}: repo: {git URL to YOUR repo} hosts: - {your_domain}.test local_dir: {absolute path on your computer where the site folder will be. Can be outside of VVV2 folder} custom: site_title: {Site title (optional, {your_project_name} by default)} db_name: {local DB name (optional, {your_project_name} by default)} acf_pro_key: {insert your ACF Pro key here (optional)} install_boilerplate_theme: true
For example, this is a valid config:
acme: repo: git@github.com:githubuser/my-wp-site.git hosts: - acme-domain.test local_dir: /Users/user/Sites/acme_site custom: site_title: My new WP project db_name: acme_db acf_pro_key: XXXX install_boilerplate_theme: true
Remove the
acf_pro_key
key in case you don't have an ACF Pro license. The only mandatory key (other than the project name) isrepo
, but we recommend to have all of them for clarity. -
do
vagrant reload --provision
now (and later if the procedure finishes with some problems); -
(optionally) create an
.env
file in thesite
dir. Two constants can be added there right away (you can also use the file later for other environment-dependent values):- If you own an ACF Pro license, you need to add the key here as the value for
ACF_PRO_KEY
constant to have the plugin automatically installed oncomposer install
when not provisioning (in a form ofACF_PRO_KEY=XXXX
). Note that this is in addition to theacf_pro_key
key invvv-custom.yml
. If you don't own a Pro license — remove the lines 7-22 and 25 fromsite/composer.json
; - On staging/production you might want to add an
ENV
constant to this file equal to anything except fordev
;
- If you own an ACF Pro license, you need to add the key here as the value for
-
rename the theme folder to your name and update the last line in the root
.gitignore
file accordingly; -
only once the provision is successful, remove
install_boilerplate_theme
key from the project config invvv-custom.yml
or set it tofalse
. Otherwise you'll have all your themes removed and the boilerplate theme installed again; -
(optionally) continue with the theme installation by following the
README.md
in thesite/wp-content/themes/{your_theme}
folder.
- If you want to use your own theme instead of the provided one right prior to VVV project creation, comment out the lines that start from
noroot wp theme install
inprovision/vvv-init.sh
; - you can remove/comment out the default sites from
vvv-config.yml
(wordpress-develop
andwordpress-default
) if you wish. You can also later add the sites from other Wordpress projects as well into the same VM by redoing the step 2.
-
If you need to run a
composer install
during development, it may be a good idea to do it aswww-data
user to allow updating plugins from WP admin as well:sudo -u www-data /usr/local/bin/composer install
-
Update the last lines in the root
.gitignore
file once you have custom plugins that need to be tracked by your repo.