I'm very new to WordPress. I'm going through some tutorials in developing a theme. What I'm trying to grasp is creating a theme when the pages are a bit different. They all have the same theme but the layout is different for example on the home page and the rest of the pages.
For an example of a home page:
And for all the content pages the look is somewhat different:
I'm looking at the hierarchy and I see home.php and page.php, but I'm not 100% sure how they tie in.
Any advice or links to better understand how this works would be appreciated
I'm very new to WordPress. I'm going through some tutorials in developing a theme. What I'm trying to grasp is creating a theme when the pages are a bit different. They all have the same theme but the layout is different for example on the home page and the rest of the pages.
For an example of a home page:
And for all the content pages the look is somewhat different:
I'm looking at the hierarchy and I see home.php and page.php, but I'm not 100% sure how they tie in.
Any advice or links to better understand how this works would be appreciated
Share Improve this question asked Jun 18, 2020 at 17:39 advineradviner 1116 bronze badges 1- there is something called Custom Template. You can create and assign them to Pages. When you have custom template created it will appear in dashboard while creating a new page. If you select the custom template then wordPress will use that template for that page instead of page.php – Sabbir Hasan Commented Jun 18, 2020 at 17:44
1 Answer
Reset to default 1Sometimes the names can be misleading as home.php actually refers to the page that stores all of your blog posts.
In general, use either page-home.php or front-page.php for the home page and then page.php for the rest. Whenever you have a specific page with a different layout, you can create a new template that is styled specifically for that. Eg. page-contact for a contact page that doesn't follow the styles of other pages. The page-XXXXX.php is dependent on the slug of the page so that is how WordPress finds it.