Jump into concepts and practice - no test required
or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Recall & Review
beginner
What is the WordPress template hierarchy?
The WordPress template hierarchy is the system WordPress uses to decide which template file to use to display a page. It checks files in a specific order from most specific to most general.
Click to reveal answer
beginner
Which template file does WordPress use to display a single blog post?
WordPress first looks for single-{post-type}.php (like single-post.php), then single.php, and if none exist, it falls back to index.php.
Click to reveal answer
intermediate
Order the template files WordPress checks for a category archive page.
WordPress checks category-{slug}.php, then category-{id}.php, then category.php, and finally archive.php before using index.php.
Click to reveal answer
intermediate
What template file does WordPress use for the homepage if a static front page is set?
If a static front page is set, WordPress uses front-page.php first. If that doesn't exist, it uses the template file of the selected page (usually page.php), then index.php.
Click to reveal answer
beginner
Why is understanding the template hierarchy important for WordPress theme development?
It helps developers know where to put template files to control how different pages look, ensuring the site displays content correctly and efficiently.
Click to reveal answer
Which template file does WordPress use first for a single post of type 'post'?
Apage.php
Bsingle.php
Cindex.php
Dsingle-post.php
✗ Incorrect
WordPress first looks for single-{post-type}.php, so for a post type 'post', it looks for single-post.php first.
If WordPress cannot find category-{slug}.php or category-{id}.php, which template does it use next for a category archive?
Acategory.php
Barchive.php
Cindex.php
Dsingle.php
✗ Incorrect
After category-{slug}.php and category-{id}.php, WordPress uses category.php before falling back to archive.php or index.php.
What template file is used for the homepage if no static front page is set?
Afront-page.php
Bhome.php
Cindex.php
Dpage.php
✗ Incorrect
If no static front page is set, WordPress uses home.php to display the blog posts index.
Which template file is the ultimate fallback in the WordPress template hierarchy?
Aarchive.php
B404.php
Cindex.php
Dfront-page.php
✗ Incorrect
index.php is the last fallback template WordPress uses if no other specific template matches.
For a custom post type archive, which template file does WordPress look for first?
Aarchive-{post-type}.php
Barchive.php
Csingle-{post-type}.php
Dindex.php
✗ Incorrect
WordPress looks for archive-{post-type}.php first for custom post type archives.
Explain how WordPress decides which template file to use when displaying a page.
Think about how WordPress checks for files from the most specific to the most general.
You got /3 concepts.
Describe the template files WordPress uses for category archive pages and their order.
Remember the naming pattern and fallback sequence for category templates.
You got /5 concepts.
Practice
(1/5)
1. Which template file does WordPress use first when displaying a single blog post?
easy
A. archive.php
B. page.php
C. index.php
D. single-{post-type}.php
Solution
Step 1: Understand single post template priority
WordPress first looks for single-{post-type}.php to display a single post of a custom or default post type.
Step 2: Recognize fallback templates
If that file is missing, WordPress falls back to single.php or index.php, but the first choice is single-{post-type}.php.
Final Answer:
single-{post-type}.php -> Option D
Quick Check:
Single post uses single-{post-type}.php first [OK]
Hint: Single posts use single-{post-type}.php first [OK]
Common Mistakes:
Confusing page.php with single post template
Thinking archive.php is for single posts
Assuming index.php is always used first
2. Which of the following is the correct template file name to display a category archive for category with slug 'news'?
easy
A. news.php
B. category-news.php
C. category.php
D. archive-news.php
Solution
Step 1: Identify category archive template naming
WordPress uses category-{slug}.php to display a specific category archive page.
Step 2: Match slug to template
For category slug 'news', the template file is category-news.php.
Final Answer:
category-news.php -> Option B
Quick Check:
Category archives use category-{slug}.php [OK]
Hint: Category archives use category-{slug}.php [OK]
Common Mistakes:
Using archive-news.php which is invalid
Confusing category.php as specific slug template
Naming file as news.php which is not recognized
3. Given the following files in a theme: page-about.php, page.php, and index.php. Which template will WordPress use to display the About page?
medium
A. page-about.php
B. page.php
C. index.php
D. It will show a 404 error
Solution
Step 1: Check for page-specific template
WordPress looks for page-{slug}.php first for pages, so page-about.php matches the About page slug.
Step 2: Understand fallback order
If page-about.php exists, WordPress uses it before falling back to page.php or index.php.
Hint: Page slug templates like page-about.php have priority [OK]
Common Mistakes:
Choosing page.php ignoring slug-specific template
Assuming index.php is used first
Thinking About page shows 404 without template
4. You created a template file named single-post.php but WordPress still uses single.php to display posts. What is the likely problem?
medium
A. The file name should be single-post.php but WordPress uses single-{post-type}.php where {post-type} is the actual post type slug
B. The correct file name is single-post.php but it must be in a subfolder
C. The file should be named single.php for posts
D. WordPress does not support single-post.php templates
Solution
Step 1: Understand post type template naming
WordPress uses single-{post-type}.php where {post-type} matches the post type slug exactly.
Step 2: Check post type slug for 'post'
The default post type slug is 'post', so single-post.php is correct if the post type is 'post'. But if the post type is custom or named differently, the file name must match exactly.
Step 3: Identify common mistake
If WordPress ignores single-post.php, it may be because the post type slug is not 'post' or the file is misplaced.
Final Answer:
File name must match actual post type slug in single-{post-type}.php -> Option A
Quick Check:
Template file must match post type slug exactly [OK]
Hint: Match single-{post-type}.php exactly to post type slug [OK]
5. You want to create a custom template for the tag archive page of the tag with slug 'featured'. Which template file name should you create to follow WordPress template hierarchy?
hard
A. archive-featured.php
B. tag.php
C. tag-featured.php
D. taxonomy-featured.php
Solution
Step 1: Identify tag archive template naming
WordPress uses tag-{slug}.php for tag archive pages with specific slugs.
Step 2: Match slug to template file
For the tag slug 'featured', the correct template file is tag-featured.php.
Step 3: Understand fallback templates
If tag-featured.php is missing, WordPress falls back to tag.php or archive.php.
Final Answer:
tag-featured.php -> Option C
Quick Check:
Tag archives use tag-{slug}.php [OK]
Hint: Tag archives use tag-{slug}.php for custom tags [OK]