WordPress Static Site Generator – Putting it all Together
It doesn’t do much good to give you the ingredients for your static site if I don’t explain how to use them. There’s no such thing as too much information.
What I’ve given you is a guide. If you copy everything verbatim and make no changes, you’re going to have issues.
I’m more than willing to help you if you get stuck on something. There isn’t any other way to turn WordPress into a static site generator like this without rewriting core files.
Additions and Changes to your Static Pages
You can add anything that doesn’t need a database query or PHP code to display. I already mentioned Google Forms for the contact page. I don’t think I mentioned Disqus within this article series. It’s easy to add it if that’s what you want to do.
There are a lot of good social sharing plugins. You need one but again, it can’t require MySQL or PHP.
There are some changes which can’t be made without going directly to the templates. An example is my home.php file. I removed the pagination code so my home page is only one page. While WordPress themes authors recommend using a child theme to do this, it really doesn’t matter. Once you take the static approach, you’ll probably stick with the same theme for as long as possible, without any more changes.
By the way, you may want to use one of the plugins designed to stop automatic updates for themes and plugins after you’re done setting it all up.
Making it Work
I neglected to mention you need two new subdirectories in your local version of WordPress: “static_master” and “static_new”. Once you transfer the files from the static_new subdirectory, you move them to the static_master subdirectory.
When I started using these routines, I used “rsync”. For reasons I won’t get into, I switched to FTP. Anyway, I upload images to the upload directory before uploading static files to the root directory. I then use my own social sharing script to, well, share them.
I have my feeds redirected to FeedBurner and I have the ping service there turned on. My pages usually get completely indexed within a few days.
So…everything on the local WordPress version works just as if I had it on a real server. I write, edit, save drafts and publish the same way. This gives me an opportunity to make sure everything looks right before I start the static generation process.
The entire process from starting an article to sharing the link takes about an hour on average. It only takes longer when I get interrupted, which happens more often than I like.
I’m sure I’ve missed at least one thing you consider important. Heck, I’ve probably missed more than one thing.
I can’t know what I missed unless you ask me questions. If answering a posted comment isn’t enough, I’ll write an entire article in response.
Before you ask, you don’t have to worry about security updates. A static site is immune to bad PHP code since PHP isn’t being used.
This article concludes the series. I’ll go back and make corrections when necessary.
Articles in this Series
This is a list of all the articles in this series. You should read each article in the order they’re presented. You could miss something important if you skip around.
- WordPress Static Site Generator – Why Bother with any Static Site Generator?
- WordPress Static Site Generator – Installing WordPress Locally
- WordPress Static Site Generator – Creating Standard Pages
- WordPress Static Site Generator – Changes from within WordPress
- WordPress Static Site Generator – The PHP Script for Pages and Posts
- WordPress Static Site Generator – Categories, Tags, Feeds, Sitemap
- WordPress Static Site Generator – Putting it all Together (You are here)