Lock in $30 Savings on PRO—Offer Ends Soon! ⏳
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Template Hierarchy
Search
Caleb Burks
July 17, 2015
Programming
0
530
Template Hierarchy
Intro to the WordPress Template System.
WordCamp Columbus
Caleb Burks
July 17, 2015
Tweet
Share
More Decks by Caleb Burks
See All by Caleb Burks
Child Themes and the Template Hierarchy
wpprodigy
0
190
Contributing to the Theme Review Team
wpprodigy
0
420
Exploring WooCommerce
wpprodigy
0
750
Other Decks in Programming
See All in Programming
re:Invent 2025 のイケてるサービスを紹介する
maroon1st
0
150
モデル駆動設計をやってみようワークショップ開催報告(Modeling Forum2025) / model driven design workshop report
haru860
0
280
ゆくKotlin くるRust
exoego
1
160
GISエンジニアから見たLINKSデータ
nokonoko1203
0
180
Pythonではじめるオープンデータ分析〜書籍の紹介と書籍で紹介しきれなかった事例の紹介〜
welliving
2
570
Cap'n Webについて
yusukebe
0
150
新卒エンジニアのプルリクエスト with AI駆動
fukunaga2025
0
230
Patterns of Patterns
denyspoltorak
0
310
tparseでgo testの出力を見やすくする
utgwkk
2
280
Graviton と Nitro と私
maroon1st
0
130
JETLS.jl ─ A New Language Server for Julia
abap34
2
450
Giselleで作るAI QAアシスタント 〜 Pull Requestレビューに継続的QAを
codenote
0
290
Featured
See All Featured
How To Stay Up To Date on Web Technology
chriscoyier
791
250k
How to optimise 3,500 product descriptions for ecommerce in one day using ChatGPT
katarinadahlin
PRO
0
3.4k
Applied NLP in the Age of Generative AI
inesmontani
PRO
3
2k
Lightning Talk: Beautiful Slides for Beginners
inesmontani
PRO
1
410
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
94
GitHub's CSS Performance
jonrohan
1032
470k
Facilitating Awesome Meetings
lara
57
6.7k
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
0
44
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
1.7k
Optimising Largest Contentful Paint
csswizardry
37
3.5k
Thoughts on Productivity
jonyablonski
73
5k
Fashionably flexible responsive web design (full day workshop)
malarkey
407
66k
Transcript
TEMPLATE HIERARCHY intro to the WordPress template structure
ABOUT ME ▸ Caleb Burks ▸ WC Ninja at Automattic
▸ Loves Gummy Bears ▸ Tweets at @WPprodigy
WHAT'S A TEMPLATE?
None
HOW DOES THE HIERARCHY WORK?
REQUIREMENTS TO BE A THEME ▸ style.css ▸ index.php
STYLE.CSS /* Theme Name: My Theme Theme URI: http://awesometheme.com Author:
Caleb Burks Author URI: http://author.com Description: Blah Blah License: GNU General Public License v3 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html Text Domain: storefront */
MAIN TEMPLATES: INDEX ▸ home.php - blog homepage ▸ index.php
- backup for home.php
INDEX EXAMPLE
MAIN TEMPLATES: POSTS ▸ single.php - Single Post Page ▸
singular.php - Fallback (new)
MAIN TEMPLATES: PAGE ▸ front-page.php - static homepage ▸ page.php
- backup for front-page.php ▸ singular.php - Fallback (new)
AREN'T THERE MORE PARTS?
COMPONENTIZED TEMPLATES ▸ get_header() ▸ get_footer() ▸ get_sidebar()
HEADER.PHP ▸ wp_head() ▸ wp_title() ▸ body_class()
FOOTER.PHP ▸ wp_footer() ▸ date(‘Y’)
SIDEBAR.PHP ▸ dynamic_sidebar()
A CLOSER LOOK
None
INCLUDING TEMPLATES get_template_part(); This is essentially a PHP include or
require, on steroids.
CONTENT.PHP Used for posts in the index pages. ▸ the_title()
▸ the_content() ▸ the_excerpt()
OTHER CONTENT TEMPLATE PARTS content-single.php for single posts. content-page.php for
single pages. content-search.php for results from searches.
BLOG TEMPLATES ▸ index.php or home.php ▸ content.php
SINGLE TEMPLATES ▸ single.php for single posts ▸ page.php for
single pages
BUT WAIT, THERE'S MORE!
ARCHIVE TEMPLATES ▸ Categories ▸ Tags ▸ Date-Based ▸ Author-Based
ARCHIVE.PHP Used for displaying archive pages ▸ date.php ▸ category.php
▸ taxonomy.php ▸ tag.php ▸ author.php
COMMENTS.PHP ▸ Author comment highlighting ▸ Display gravatars if appropriate
▸ Support threaded comments
SEARCH.PHP Displays a list of posts/pages based on search query.
▸ Include the search form again ▸ get_search_form()
CUSTOM TEMPLATES
CUSTOM TEMPLATES: ARCHIVES ▸ category-$slug.php ▸ category-$id.php ▸ tag-$slug.php ▸
tag-$id.php Applies to authors, taxonimies, and CPT's as well.
CUSTOM TEMPLATES: POSTS <?php get_template_part( 'content', get_post_format() ); ?> https://codex.wordpress.org/Post_Formats
Example: content-video.php
CUSTOM TEMPLATES: PAGES ▸ page-$slug.php ▸ page-$id.php OR...
CUSTOM TEMPLATES: PAGES
CUSTOM TEMPLATES: PAGES Make your own template with just one
extra line of code!
CUSTOM TEMPLATES: PAGES How to create a custom home page
template: 1. Copy page.php 2. Rename it to page-home.php 3. Add the following comment to the top: 4. Template Name: Homepage
CONFUSED YET?
AWESOME TOOLS ▸ What The File https://wordpress.org/plugins/what-the- file/
AWESOME TOOLS ▸ WPhierarchy.com
AWESOME TOOLS ▸ _s underscores.com
QUESTIONS?