Theme Templates

The markup in Sage is based on HTML5 Boilerplate with ARIA roles for accessibility and the hNews microformat for posts.

The theme root contains files that you can further extend with the normal WordPress Template Hierarchy:

404.php
Error 404 page
base.php
The theme wrapper which wraps the base markup around all template files
index.php
Archive page (used by blog page, category archives, author archives and more)
page.php
Single page
single.php
Single post page
template-custom.php
An example single page template

These files include templates from the templates/ directory which is where you’ll be making most of your customizations:

comments.php
Markup for comments
content-page.php
Markup included from page.php
content-single.php
Markup included from single.php
content.php
Markup included from index.php
entry-meta.php
Post entry meta information included from content-single.php
footer.php
Footer markup included from base.php
head.php
<head> markup included from base.php
header.php
Header markup included from base.php
page-header.php
Page title markup included from most of the files in the theme root
sidebar.php
Sidebar markup included from base.php

Extending templates

Even with the theme wrapper, the normal WordPress Template Hierarchy is still intact. Here’s some examples:

  • Copy index.php to author.php for customizing author archives
  • Copy index.php to home.php for customizing the Home page if you’re showing the latest posts (under Reading Settings) instead of a static front page
  • Copy index.php to archive-gallery.php for customizing the archive page for a custom post type registered as gallery
  • Copy page.php to front-page.php for customizing the static front page
  • Copy page.php to page-about.php for customizing a page called About

The theme wrapper documentation goes into depth about creating new base.php files, but if you’d like to have a customized base.php based on a certain template, just copy it to base-<template name>.php. You can add conditional statements to base.php whenever possible and should generally aim to not have multiple theme wrappers in your theme.