Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Template Hierarchy
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
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
200
Contributing to the Theme Review Team
wpprodigy
0
430
Exploring WooCommerce
wpprodigy
0
770
Other Decks in Programming
See All in Programming
Unicodeどうしてる? PHPから見たUnicode対応と他言語での対応についてのお伺い
youkidearitai
PRO
1
1.1k
CSC307 Lecture 08
javiergs
PRO
0
670
AtCoder Conference 2025
shindannin
0
1k
責任感のあるCloudWatchアラームを設計しよう
akihisaikeda
3
160
フルサイクルエンジニアリングをAI Agentで全自動化したい 〜構想と現在地〜
kamina_zzz
0
400
Vibe codingでおすすめの言語と開発手法
uyuki234
0
220
例外処理とどう使い分ける?Result型を使ったエラー設計 #burikaigi
kajitack
16
6k
Apache Iceberg V3 and migration to V3
tomtanaka
0
150
インターン生でもAuth0で認証基盤刷新が出来るのか
taku271
0
190
AI時代の認知負荷との向き合い方
optfit
0
140
20260127_試行錯誤の結晶を1冊に。著者が解説 先輩データサイエンティストからの指南書 / author's_commentary_ds_instructions_guide
nash_efp
0
900
CSC307 Lecture 05
javiergs
PRO
0
490
Featured
See All Featured
Speed Design
sergeychernyshev
33
1.5k
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
400
Lessons Learnt from Crawling 1000+ Websites
charlesmeaden
PRO
1
1.1k
Become a Pro
speakerdeck
PRO
31
5.8k
The World Runs on Bad Software
bkeepers
PRO
72
12k
The Limits of Empathy - UXLibs8
cassininazir
1
210
What's in a price? How to price your products and services
michaelherold
247
13k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
122
21k
Technical Leadership for Architectural Decision Making
baasie
1
240
Collaborative Software Design: How to facilitate domain modelling decisions
baasie
0
130
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
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?