WordPress The WordPress Template Hierarchy Page and Post Templates in WordPress Static Page Template Files

tarry nwaise
tarry nwaise
1,391 Points

I don't understand the answer for one of the questions on the quiz

There was a question on the quiz which was what is the fallback template for a static homepage. The correct anwers shows as page.php. Shouldn't it be index.php According to the Codex page hierarchy, this would be the page that would be used if front-page.php was not available.

2 Answers

Emma Willmann
Emma Willmann
Treehouse Project Reviewer

I can understand your confusion on this question, as sometimes understanding the wp hierarchy can be difficult. I use http://wphierarchy.com/ to look at the hierarchy, because I find it a little easier to read.

Starting on the left side, find 'Site Home Page' that leads to frontpage.php. It then breaks into two options, showing posts or a page. The question is asking about a static page, so follow the arrow up to 'Page Template' which leads to page.php as the fall back and the answer to this question. However, if page.php didn't exist, then index.php would be the fallback.

Hope that helps!

tarry nwaise
tarry nwaise
1,391 Points

Ok that makes sense.

Got it. I guess I thought the question was asking about the 'Site Home Page' that leads to frontpage.php.

Thanks!