The anatomy of a WordPress theme

The anatomy of a WordPress theme
Yoast SEO Blog, January 10, 2011
By Joost de Valk

“Webmaster’s Note: This is a convenient quick reference for understanding how WordPress functions. While WordPress is rather simple for those who know it well, it can be daunting for a beginner. (We all start at the beginning at some point.) This should help get the novice a bit closer to understanding how WordPress functions.”


Anatomy of a WordPress theme

The cheatsheet for how your blog works

WordPress themes consist of a folder of template files, each of which controls a specific piece of your theme. Parts of your site that remain static no matter what page you’re on are controlled by header, sidebar and footer files. You can hack these files so they detect what page you are on and serve different content accordingly, such as display different navigation on posts than on pages; however it is most common for these sections to look the same throughout the site.


  • header.php – Global file that displays headers and navigation. Also contains HTML code.
  • The Loop – The display of contents of the main area of your site are controlled by individual WordPress theme template files using what’s called “the loop”.
  • sidebar.php – This file controls your sidebar display. You can set up multiple sidebars in functions.php, and contents of sidebar widgets are set up from the WordPress wp-admin panel.
  • footer.php – Contains instructions for global footer and closes HTML tags.

Infographic - The anatomy of a WordPress theme by Yoast

Read the Full Article »

About the Author:

Joost de Valk is the founder and Chief Product Officer of Yoast. He’s an internet entrepreneur, who next to founding Yoast has invested in and advised several startups. His main expertise is open source software development and digital marketing