Wordpress Theme Deploy
I only recently started to work with Wordpress as I feel it matured into a decent CMS. It does lack deployment options though. My first choice for deploying PHP projects is Deployer. Unfortunately, since the client can update Wordpress or install plugins on the production server at any time, that deployment strategy doesn't work that well here. So I had to come up with a solution to only deploy the actual theme.
With wordpress-deploy you can upload your wordpress theme via FTP to your server with a single bash command. A backup will be created and there is no downtime since the theme will get placed into the theme folder only after the upload completed.
Install
Install the package wordpress-deploy globally:
npm install -g wordpress-deploy
Now you can use the bash command wordpress-deploy
(or in short wp-dep
) preferably from within your wordpress folder.
wp-dep
Config
Add a config file named wordpress-deploy.config.js
to your wordpress folder and adjust accordingly.
Make sure to add the config file to your .gitignore
const config = { // The hostname or IP address of the FTP server host: 'localhost', // The port of the FTP server port: 21, // Username for authentication user: 'anonymous', // Password for authentication password: 'secret', // The theme name theme: 'my-wordpress-theme', // The local theme folder location pathLocal: './wp-content/themes', // The remote theme folder location pathRemote: './wp-content/themes', // The remote folder in which to save uploading files and backups backup: './.wordpress-deploy', // Files and folders to ignore // Folder paths are relative to the theme folder // To ignore a folder use two patterns: 'folder', 'folder/**' ignore: ['.DS_Store', 'node_modules', 'node_modules/**'] }; module.exports = config;
Example file: wordpress-deploy.config.js
You can also provide an argument to use a different config filename:
wp-dep --config=my-custom-config.js
All config parameters can be used as arguments, for example:
wp-dep --theme=my-theme
License
wordpress-deploy is licensed MIT.