Custom Theme Development, Getting Started
WordPress Intermediate/Advanced
Chapter 1 · Custom Theme Development, Getting Started
WordPress Fundamentals 5 treated a theme as a black box — something you install and activate, never something you build. This course opens that box, starting with the two files WordPress absolutely requires, and the two more that, by strong convention, essentially every real theme includes.
The Two Files WordPress Actually Requires
A folder inside wp-content/themes/ only becomes a real, recognized WordPress theme once it contains exactly two specific files.
style.css — Required, and Genuinely Unusual
Every theme's style.css must begin with a specially-formatted comment block that WordPress itself parses — this is what actually registers the folder as a theme in the first place and makes it appear in the dashboard's theme browser at all.
index.php — Required, the Universal Fallback
index.php is the one template guaranteed to exist and be used if no more specific template file is found for a given page — the fallback of last resort. WordPress Intermediate/Advanced 2 covers the full system determining exactly which template file gets chosen for which URL; this chapter only needs the fact that index.php is always the final, catch-all option.
Two More Files Nearly Every Real Theme Includes
Not strictly required by WordPress core, but close to universal by convention: header.php and footer.php, pulled into other templates via get_header() and get_footer().
header.php must call wp_head() just before its closing </head> tag, and footer.php must call wp_footer() just before its closing </body> tag. These two hooks are how WordPress core and every installed plugin inject their own scripts and styles into the page — a theme missing either one will cause plugins to silently, confusingly fail to work, with no obvious error pointing back to the actual cause.
What This Actually Reveals About WordPress Fundamentals 5
Every theme WordPress Fundamentals 5 covered installing and activating was, underneath, exactly this: a folder containing at minimum a correctly-formatted style.css and an index.php, almost certainly alongside header.php and footer.php — plus, typically, a great deal more template files and a functions.php covered properly once WordPress Intermediate/Advanced 7 reaches proper script/style enqueuing.
Hands-On Exercises
A developer creates a folder with a fully-styled style.css and a working index.php, but forgets the special comment header block. Explain what happens when they check the WordPress dashboard.
A theme's header.php is missing its call to wp_head(). A plugin that's supposed to load its own CSS on every page stops working, with no visible error message anywhere. Explain exactly why.
Write a minimal, valid style.css header block for a theme named "Portfolio Grid," and explain what would happen if this file didn't exist at all in an otherwise complete theme folder.
Chapter 1 Quick Reference
- style.css — required; its special comment header block is what registers the folder as a theme at all
- index.php — required; the universal fallback template used when no more specific template exists
- header.php / footer.php — not strictly required, but near-universal by convention, pulled in via get_header()/get_footer()
- wp_head() / wp_footer() — must be called in header.php/footer.php respectively, or plugin scripts/styles silently fail to load
- Every theme WordPress Fundamentals 5 installed was exactly this structure underneath, typically with many more template files and functions.php
- Next chapter: The WordPress Template Hierarchy