What is Shifter Local?
Shifter Local is a Docker image for testing WordPress themes and plugins while migrating to Shifter.
You can check out Shifter Local here.
This time, I will briefly explain how to create a WordPress theme development environment using Shifter Local.
Before You Start
Make sure Git is set up in you local environment.
Docker must be installed in advance.
Shifter Local is basically a command line tool.
Git clone to a suitable location.
Change to the cloned directory.
docker-compose up -d
After launching, access to
https://127.0.0.1:8443 with a web browser, you should see the WordPress installation screen.
WordPress and theme setup
You can install WordPress on the browser from here, but wp-cli is also included in Shifter Local. So I will explain how to install the test environment on the command line.
First, attach to the container.
docker exec -i -t shifter-local_wp_1 / bin / bash
In the following command, inside the shifter-local_wp_1 container,
1. Install WordPress with the following credentials:
2. Install and activate any plugins you might be using
3. Install the theme unit test data
4. Install and enable the starter theme(s) with the theme name
sample-theme and activate it.
sudo -u www-data wp core install \ --path=/var/www/html/web/wp \ --url=example.com \ --title=Example \ --admin_user=supervisor \ --admin_password=strongpassword \ --firstname.lastname@example.org \ && \ sudo -u www-data wp plugin install \ --path=/var/www/html/web/wp \ debug-bar \ show-current-template \ wordpress-importer \ --activate \ && \ wget wget https://raw.githubusercontent.com/WPTRT/theme-unit-test/master/themeunittestdata.wordpress.xml \ && \ sudo -u www-data wp import themeunittestdata.wordpress.xml \ --path=/var/www/html/web/wp \ --authors=create \ && \ rm themeunittestdata.wordpress.xml \ && \ sudo -u www-data wp scaffold _s sample-theme \ --path=/var/www/html/web/wp \ --theme_name="Sample Theme" \ --author="John Doe"
The theme should have a directory name of
volume / app / themes in the directory where
docker-compose up -d was executed.
When you open https://127.0.0.1:8443/ in your browser, WordPress opens with the sample data set up.
You can login from https://127.0.0.1:8443/wp-login.php.
If you already have a theme or want to clone from git, go to
volume / app / themes and do clone from there.
Also, if you execute
make clean, you can initialize this environment and start over again.
And that’s it! Thanks for using Shifter!