This readme contains only a few sentences about how to run the WP site contained in this repository. Mostly it's about the steps I took -- which you may be able to replicate -- to build a WordPress site that leaves me feeling like I'm using modern tools and producing a high-quality product.
If you follow these steps you'll have a site that uses Bootstrap SASS with a well-organized template structure, your assets will be concatenated, minified, and placed correctly, you'll have a working Gulp setup with live reload, you'll get free SSL and DDOS protection from CloudFlare and free hosting without having to worry about server management from OpenShift.
- Clone the OpenShift WordPress Developer Quickstart. (More on this in OPENSHIFT.md)
- Make yourself a database and update
wp-config.php
. - Point Apache or MAMP at the appropriate place and fire up your web browser!
- Run the famous WordPress 5-minute install.
- Probably best to update WordPress to the latest version now.
- Download the Sage starter theme by roots.io.
- Check out the Sage README.md, and set up
Gulp/Bower accordingly. (You must do this from
wp-content/themes/sage
.) - Find
manifest.json
and changeexample.dev
tolocalhost
- In your theme directory, run
gulp watch
and check out your new site!
I choose OpenShift because it's free, and it's a repo-backed system whose server I basically never want to worry about. YMMV, and if you're a bigger site with more interactive features or heavier plugins, you may need something with a bit more kick.
- Install the Red Hat Cloud client tools (docs) and run
rhc setup
. - Make a new app per the instructions in OPENSHIFT.md with
rhc app create wordpress php-5.4 mysql-5.5 --from-code=https://github.com/openshift-quickstart/openshift-wordpress-developer-quickstart.git
- Open your site in a browser and run the WordPress install. (This one was http://wordpress-theopen.rhcloud.com/.)
- Make sure to remove
dist
from the theme's.gitignore
file, because this project isn't currently set up for OpenShift to handle the Gulp tasks. - Find the ridiculously long ssh link for your site and add a corresponding remote with
git remote add rhc ssh://[email protected]/~/git/wordpress.git
. - Deploy your site with
git push rhc
. (The first time through, you may need to force it withgit push -f rhc
.)
- Set up CloudFlare.
- Install and activate these plugins:
- Amazon Web Services -- required for WP Offload
- WP Offload S3 Lite -- required for media storage on OpenShift. WARNING: this step is required to ensure that uploads are permanent on s3 instead of temporary on OpenShift's filesystem.
- Autoptimize -- be sure to check these advanced settings 1. ✅ Optimize JavaScript Code 1. ❌ Force JavaScript in < head > 1. ✅ Also aggregate inline JS 1. ✅ Optimize CSS Code 1. ✅ Also aggregate inline CSS
- WP-Optimize -- cleans up your database
- Yoast SEO -- proper SEO management
- Tell OpenShift to use "hot deployments", which are just fine for most
WordPress setups, by adding a blank file at
.openshift/markers/hot_deploy
.
- In this repo I'm copying the theme for my own purposes.
sage
remains the default theme, andthe-open.net
is the new one. There are a couple of performance enhancements below that involve modifying some theme files, and usually you should apply them to your theme, but you'll want to test them out yourself. - I'm copying from an existing Bootstrap SASS site (Jekyll) so I'm just going
to replace the
_variables.scss
file and check that out -- the colors are already looking more like mine! - Next, take the rest of my existing
main.scss
and put it here, ensuring we get the dependencies right, but not the placement in compontent or layout files (we can do that later).
- Remove unused Bootstrap components from includes list in
_bootstrap.scss
- To shrink your scripts even further, go to Autoptimize's option "Exclude
scripts from Autoptimize" and add "jquery" to the list. (It will also
exclude jQuery migrate.) Then add them back into the HTML in
base.php
just abovewp_footer()
. Most users will have these files cached from other websites so they'll only load one rather small concatenated script from our site.