Wordpress workflow that generates a static site.
This workflow uses wordpress as a CMS and generates a static site which can be pushed up to S3.
Install Composer: https://getcomposer.org/doc/00-intro.md
curl -sS https://getcomposer.org/installer | phpInstall NPM
curl http://npmjs.org/install.sh | shPROJECT/
|- composer.json # list of php dependencies (composer packages)
|- composer.lock # lock file auto_produced when running 'composer install'
|- gulpfile.js # gulp tasks
|- node_modules/ # list of npm dependencies used in gulp (git ignored)
|- package.json # list of npm packages
|- README.md
|- src/ # source code (themes and/or plugins)
| |- cms/
| | |- plugins/
| | |- themes/
| | `- wp-config.php
| |- html/ # front-end files
|- vendor/ # composer dependencies (git ignored)
|- wordpress_module/ # wordpress (git ignored)
Run 'composer install' in terminal to install wordpress and all dependent plugins and themes. Configuration can be edited inside composer.json. Refer to http://roots.io/using-composer-with-wordpress/ for more info on how it's set up.
composer installRun 'npm install' in terminal to install node_modules/.
npm installSetup your database table, database passoword and user. If you're using MAMP, its usually located at http://localhost/phpmyadmin.
Fill in src/cms/wp-config.php with the credentials you used for the database.
/** The name of the database for WordPress */
define('DB_NAME', '*************');
/** MySQL database username */
define('DB_USER', '*************');
/** MySQL database password */
define('DB_PASSWORD', '*************');
/** MySQL hostname */
define('DB_HOST', '*************');Set up path where Wordpress will be hosted
define('WP_HOME','http://localhost/wordflow/dist');
define('WP_SITEURL','http://localhost/wordflow/dist');Setup your aws credentials (if applicable)
define('AWS_ACCESS_KEY_ID', '*************');
define('AWS_SECRET_ACCESS_KEY', '*************');- Go to the dist folder where Wordpress is copied over, ie. http://localhost/wordflow/dist/wp-admin and activate all plugins by going to 'Plugins' on the side dashboard.
- Go to 'Settings' > 'JSON API' and activate wordflow
Run 'gulp' to build.
- Wordpress core will be copied over to dist/[env]/
- src/cms/wp-config.php will be copied over to dist/[env]/wp-config.php
- src/cms/plugins will be copied over to dist/[env]/wp-content/plugins
gulpRun 'gulp' while developing themes and plugins inside src/cms
- src/cms/wp-config.php will be copied over to dist/[env]/wp-config.php
- src/cms/plugins will be copied over to dist/[env]/wp-content/plugins
gulp###JSON API
- JSON API https://wordpress.org/plugins/json-api/ has been included in composer.json to install. This plugin generates a JSON file from WP pages or posts.
- You can edit custom functions inside cms/plugins/wordflow/json.php.
- To access the file, go to http://localhost/wordflow/dist/?json=wordflow.[function_name]. for example, http://localhost/wordflow/dist/?json=wordflow.get_menu
###Advanced Custom Fields
Tutorials:
- http://polycademy.com/blog/id/148/modern_wordpress_workflow_with_composer
- http://roots.io/using-composer-with-wordpress/
Wordpress plugin list:
MAMP is weird. If you're getting an error when hitting .sh script, fix mamp by opening /Applications/MAMP/Library/bin/envvars and comment out
# DYLD_LIBRARY_PATH="/Applications/MAMP/Library/lib:$DYLD_LIBRARY_PATH"
# export DYLD_LIBRARY_PATH