最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

WordPress Theme With Modified View

programmeradmin1浏览0评论

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
Add a comment  | 

1 Answer 1

Reset to default 1

Sometimes 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.

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论