Base WordPress starter project built on Roots/Bedrock.
- Clone project repo
- Go to your Sites folder:
cd ~/Sites. - Run
git clone https://github.com/Design-Collective/dcwp myproject
- Create remote repository
- Go to https://github.com/new and setup the new repo
- follow the instructions to update the remote url, e.g.:
git remote set-url origin https://github.com/Design-Collective/my-new-repo
- Run
composer install - If you wish to clone the DesignCollective/sage starter theme, follow the instructions in the repository.
- Push your local repo to your new repository:
git push origin master
- Copy
.env.exampleto.envand update environment variables:
DB_NAME- Database nameDB_USER- Database userDB_PASSWORD- Database passwordDB_HOST- Database host (defaults tolocalhost)WP_ENV- Set to environment (development,staging,production, etc)WP_HOME- Full URL to WordPress home (http://example.com)WP_SITEURL- Full URL to WordPress including subdirectory (http://example.com/wp)
- Access WP Admin at
http://project.dev/wp/wp-admin
For more information, see Bedrock
To manually add an environment variable, add a line to the .env file:
MYVAR="My variable value"
MYCUSTOMNUMBER=999
config/application.php is the main config file that contains what wp-config.php usually would. Base options should be set in there.
For environment specific configuration, use the files under config/environments. By default there's is development, staging, and production but these can be whatever you require.
The environment configs are required before the main application config so anything in an environment config takes precedence over application.
Note: You can't re-define constants in PHP. So if you have a base setting in application.php and want to override it in production.php for example, you have a few options:
- Remove the base option and be sure to define it in every environment it's needed
- Only define the constant in
application.phpif it isn't already defined.
The following env vars are required:
DB_USERDB_NAMEDB_PASSWORDWP_HOMEWP_SITEURL
/*
Note: Need to review this and add all useful vars
Additional variables which can be included in the global theme:
GOOGLE_ANALYTICS_PUBIDINSTAGRAM_USER_ID
*/
Composer is used to manage dependencies. Bedrock considers any 3rd party library as a dependency including WordPress itself and any plugins.
See these two blogs for more extensive documentation:
WordPress Packagist is already registered in the composer.json file so any plugins from the WordPress Plugin Directory can easily be required.
Search for a plugin on WordPress Packagist
To add a plugin, add it under the require directive or use composer require <namespace>/<packagename> from the command line. If it's from WordPress Packagist then the namespace is always wpackagist-plugin.
For example: "wpackagist-plugin/my-plugin": "dev-trunk"
Whenever you add a new plugin or update the WP version, run composer update to install your new packages.
plugins, and mu-plugins are Git ignored by default since Composer manages them. If you want to add something to those folders that isn not managed by Composer, you need to update .gitignore to whitelist them, for example:
!web/app/plugins/my-plugin-name
Note: Some plugins may create files or folders outside of their given scope, or even make modifications to wp-config.php and other files in the app directory. These files should be added to your .gitignore file as they are managed by the plugins themselves, which are managed via Composer. Any modifications to wp-config.php that are needed should be moved into config/application.php.
Capistrano is a remote server automation and deployment tool. It will let you deploy or rollback your application in one command:
- Deploy:
cap staging deploy - Rollback:
cap staging deploy:rollback
Composer support is built-in so when you run a deploy, composer install is automatically run on the server.
If you plan to merge/update this repo from Roots/Bedrock you will need to setup the upstream remote in order to merge/update from upstream.
Run the following commands:
git remote add upstream https://github.com/roots/bedrockgit fetch upstreamCommits to the remote master will be stored in a local branch, upstream/master.- Checkout local master branch:
git checkout master - Merge upstream/master branch to sync with upstream:
git merge upstream/master