WordPress Static Site Generator – Installing WordPress Locally
The first step in setting up a WordPress static site generator is to install the proper software stack. There are two lists to look at: List of Apache–MySQL–PHP packages and List of Nginx–MySQL–PHP packages (Winginx is missing).
My web server is Ubuntu. My laptop computer is Linux Mint, based on Ubuntu. I installed everything on my laptop like I would on the server. I open a terminal window and sudo su to become root. It’s a lot easier doing it this way than it is to install a “wrapper” for yet another software stack.
The Static Site Generator Version of WordPress
Installing WordPress locally should be very similar to installing it on a server. Even if you use SSL on your server, you won’t need it for the local version. When it comes time to generate your static files, you’ll be changing your host information anyway.
Speaking of hosts, it really doesn’t matter what domain name you use. I use www.rtcx.local to match www.rtcx.net online. You just have to make sure your hosts file has it in there. It’s at /etc/hosts on Linux and c:WindowsSystem32Driversetchosts on Windows.
I’m not going to link to these plugins. If you have WordPress installed correctly, you should be able to get them from the WordPress plugin directory through WordPress itself.
Add Any Extension to Pages – Your static page URLs can end in any extension (.htm, .html, etc.) or no extension at all. You can use anything except the “/” character. Outside of WordPress, that character represents the first character of a directory name. Make sure you use a custom permalink to match.
See Add File Name Extensions to WordPress Pages, Category and Tag Pages
- Broken Link Checker – You’re going to link to other websites and some of them are going to be broken links eventually. Use this to find and fix them.
- Code Snippets – It’s easier than creating your own plugins or adding to your theme’s function file.
- Disable Embeds – Embeds won’t work with your static files anyway.
- Disable Emojis – Don’t use emoticons or emojis when you write. Trust me.
- EWWW Image Optimizer – Shrinks the images you’ll eventually upload.
- WP-Sweep – Keeps your database optimized.
- Yoast SEO – You’ll have to use it to understand why I recommend it.
You can use any theme you want to use. The PHP script I’ll talk about in a future article will alter what needs to be altered.
Don’t use any plugins or widgets that display dynamic content. Many of them won’t work right anyway. If you need “related posts”, I suggest the “Contextual Related Posts” plugin. You won’t need anything related to “recent posts”. I’ll show you how to create an article list that serves that function.
Most of the things you would normally display in a sidebar are practically useless. If you really want a sidebar, use it to display a skyscraper ad or something.
Most of your visitors are going to see one page on your website and one page only. A “page” in this context could be a WordPress “post” or a WordPress “page”.
What you want to do is to get your visitors to look at more than one page. Make it as easy as possible for them to find other pages from the page they land on. Even if you don’t like ads, I recommend using Google AdSense if for nothing more than the “matched content” ad units. You can display one ad unit after each article and follow it with a matched content ad unit. The alternative is a “related post” plugin.
Link to your other relevant articles from within a specific article. Don’t overdo it. Once per article is enough.
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 (You are here)
- 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