WordPress Static Site Generator – Creating Standard Pages

- May 1, 2017

WordPress Static Site Generator There are some standard pages your WordPress website should include, regardless of whether it’s a static site or not. I’ll get to them shortly.

A static WordPress site isn’t going to behave exactly as a dynamic one would. While, technically, you can make it use archive taxonomies in the same way, you really shouldn’t. You’ll end up generating far more pages than you actually need.

The one page you can’t create without help is a list of all the articles. I’ll give you the WordPress shortcode you’ll need to make it. The category and tag taxonomy pages will be created by the PHP script I’ll be providing in another article.

Standard Pages

The home page, whether it’s a list of blog posts or a regular page, is a given. The other pages I recommend are:

The “Article List” is a nonstandard page. You’re welcome to plagiarize my comments policy and privacy policy pages.

The Article List Page for your Static Site

This WordPress shortcode function can be used for any blank page:

function shortcode_article_list() {
  $posts_array = get_posts( array('posts_per_page' => -1, 'orderby' => 'date', 'order' => 'DESC', 'post_type' => 'post', 'post_status' => 'publish') );
  $output = '<ul>';
  foreach ($posts_array as $post) {
    $a = explode(' ', $post->post_date);
    $output .= '<li><a href="' . home_url('/') . $post->post_name . '.html">' . $post->post_title . '</a> (' . $a[0] . ')</li>';
  $output .= '</ul>';
  return $output;
add_shortcode('article_list', 'shortcode_article_list');

Once this shortcode is in place, you just need to include “article_list” (replace the quotes with brackets, not braces) on the blank page you’ve selected for it. My “Article List” page is the only example you need.

I don’t have a page listing categories and I don’t have one listing tags. It wouldn’t be hard to do the same thing with them. I don’t believe it’s worth the effort. Anyone can click on one of the categories or one of the tags (from within an article) to bring up a page listing all the articles that reference them. Please correct me if you think I’m wrong.

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.

Share this:

Categories: Technology

Tags: , , , ,

Previous and Next Articles (if any):

« »


You've made it this far down the page. Please read some of my more important pages if you have the time:

Comments Policy           Privacy Policy

RTCXpression established Feb 28, 2011
Copyright © 2013-2017 RT Cunningham
Hosted at Digital Ocean