Boilerplate WordPress site directory for use with Varying Vagrant Vagrants local environments, although could easily be used in any new WordPress project where you want to track an actual WordPress website and optionally use Git for deployment.
This Git repo begins at the same level as the actual WordPress site directory, meaning the same folder that wp-config.php
, wp-content
directory, etc. are usually located.
By default, it is set up to only track specific themes and plugins critical to site functionality & display by whitelisting their directories in the provided .gitignore
file, although other folders & files can be whitelisted as desired, it is usually best practice to only track especially relevant files.
Note: the Git repo and actual directory name do not need to match; this is worth mentioning because this directory is usually named something like public_html
or htdocs
on most webservers and requires extra unnessary server configuration to change, so its best left as is.
You can however specify a meaningful name (e.g. mycoolwebsite) for the Git repository at other locations, for example at Git hosting sites like GitHub and Bitbucket.
While wp-project-base can be easily adpated as a base for any new WordPress site, it was originally created for local WordPress development using Varying Vagrant Vagrants.
Therefore, directions here pertain to using this repo in combination with VVV 2 + wp-vvv2-make-site projects.
- VVV 2.0
- Vagrant::Hostsupdater - Vagrant plugin for auto-updating system's hosts file.
- wp-vvv2-make-site - Git repo for auto-site setup in
vvv-custom.yml
-
Clone this repo into a local directory on your computer, replacing "my-site-name" with your own site's.
git clone https://github.com/SeanM88/wp-site-base.git my-site-name
-
Run the following command (again replacing "my-site-name" with your own) to move to the newly created site directory and remove the existing .git subfolder — this tracks wp-site-base, we want to track our site in it's own repo.
cd my-site-name && rm -Rf .git
We now have a fresh and clean site directory to use with wp-vvv2-make-site and get started developing our site locally. Before we can actually use it though we need to add our site's theme and any necessary plugins.
-
Copy your site's theme and required plugins into the respective
/themes/
and/plugins/
directory inside/wp-content/
-
Open the
.gitignore
file and whitelist all the theme and plugin directorys you just added, using the Git negate pattern prefix.
Theme example:!wp-content/themes/my-site-theme/
Plugin example:!wp-content/plugins/my-plugin/
-
Initialize a new Git repo and optional initial commit message:
git init -m "Initial commit of my-site-name"
-
Add all files to be tracked and commit:
git add . &$ git commit -m "Track site files"
-
Using a Git hosting service like GitHub or Bitbucket, create a new empty repo and import your site's newly created Git repo.
-
That's it! Copy the repo's URL and you're ready to automatically import your's repo with the wp-vvv2-make-site site wizard.
See the official wp-vvv2-make-site docs for more help with setting up a working local copy of WordPress with your site.