Boilerplate for WordPress sites, based on WordPlate.
The public
folder is the web root. Most of the project's code will reside in your project theme in public/themes
.
WordPress plugins are added via composer from WordPress Packagist and automatically placed in public/mu-plugins
where they are automatically enabled. Please see WordPlate documentation for more information on how to add plugins. This repo comes with some plugins already installed. Please read up on these before removing them.
WordPress translations are added via composer from this repository and automatically placed in public/languages
.
Static resources (JavaScript, CSS, images, fonts etc) is added to the resources
folder and is automatically compiled/copied into your theme folder. These resources should follow our coding conventions.
Merge this repo into your own:
$ git remote add lorica https://github.com/fiskhandlarn/lorica.git
$ git pull lorica master
Open composer.json
and change the name
and description
properties.
Rename the example theme and use it as the base for your project's theme:
$ git mv public/themes/project/ public/themes/your-project/
Update public/themes/your-project/style.css
with your project's name and description.
Change WP_THEME
and BROWSER_SYNC_HOST
in .env.example
to reflect your new theme/project name.
Change Project
in resources/assets/styles/app.scss to your project's name.
Follow the Install instructions.
Set your ACF license key as ACF_KEY
in .env
and update advanced-custom-fields-pro
to the latest version:
$ composer update-acf-plugin
Install ACF pro:
$ composer require advanced-custom-fields/advanced-custom-fields-pro
Add composer.lock
and package-lock.json
to your git repo to ensure that the same package versions are used by other contributors and on the servers:
$ git add composer.lock package-lock.json
Set your ITSEC_NETWORK_BRUTE_FORCE_API_KEY
and ITSEC_NETWORK_BRUTE_FORCE_API_SECRET
in the .env
file.
Visit your project in the browser and run the WordPress installation wizard with these values:
- Username: sysop
- Your Email: [email protected]
- Search Engine Visibility:
Save the login url and credentials in your password file.
Do not click the ''Log in'' button in the final step, instead use the URL /wordpress/lorica-admin
to log into wp-admin. If you get a 404 for that URL it's probably because iThemes Security has removed or changed .htaccess. If .htaccess
is marked as changed, revert it and try again.
If you get error messages, reload /wordpress/lorica-admin
until all error messages has disappeared.
Add languages for Polylang in wp-admin (Languages in the side menu) so you can start using the hoy/polylang functions, or remove hoy/polylang
and wpackagist-plugin/polylang
from composer if your project is monolingual (optionally remove koodimonni-language
packages if not needed). If you disable Hide URL language information for default language in Polylang settings make sure that you add at least one page or post to avoid redirect loop on the site root URL.
Read TODO.md so you know what must be done before launching your project.
Change "Project" and "domain.tld" in this README.md below to reflect your project's name and domain name.
Update the Deploy section below.
Setup done! Remove everything in this README.md above and including this line:
1: Install the composer dependencies:
$ composer install
2: Install the node dependencies and build the resources:
$ npm install && npm run dev
3: Configure your web server setting the web root to the public/
folder, configure Valet or use Docker.
4: If you want to use a custom domain you should update your /etc/hosts
file.
5: Edit the .env
file with your database and mail credentials, and WordPress salts.
6: Use the URL /wordpress/lorica-admin
to log into wp-admin.
Build CSS & JS files one time:
$ npm run dev
Build CSS & JS files and watch for file changes:
$ npm run watch
Build minified CSS & JS files one time:
$ npm run prod
Use this database host:
DB_HOST=mysql
Create SSL certificate:
$ mkdir -p .docker/.ssl
$ openssl req -x509 -nodes -days 3650 -newkey rsa:2048 -keyout .docker/.ssl/server.key -out .docker/.ssl/server.pem
or
$ make ssl:create
Start Docker:
$ docker-compose up -d
or
$ make up
Access the site via https://localhost:3000/ and phpMyAdmin via http://localhost:8082/.
Stop Docker:
$ docker-compose down
or
$ make down
See also: database/README.md.
BackstopJS can be used for testing visual regression. If not using Docker, change the url
in backstop.json as you see fit.
Initialize BackstopJS to have something to compare against:
$ make backstop:reference
Run tests (which creates screenshots and compares them against the reference screenshots):
$ make backstop:test
Test screenshots and results are genereated in backstop_data/
.
If the test you ran looks good you can approve them (thus making the test screenshots your new reference screenshots):
$ make backstop:approve
Deploy with deploy service to:
Tip: Run composer run activate-maintenance
in your deploy service (after all files are added) to deploy whilst keeping the site non-public.