开发者

Wordpress - Custom Blog Page

开发者 https://www.devze.com 2023-01-29 11:30 出处:网络
I would like to show a static front page and custom posts page. I created 2 page templates for this开发者_Python百科.

I would like to show a static front page and custom posts page. I created 2 page templates for this开发者_Python百科.

page-template-home.php //commented it as Template Name: Home Template)
page-template-blog.php //commented it as Template Name: Blog Template)

Then created 2 wordpress pages Home and Blog, then for the home page, set page template as Home Template and for the blog page, set page template as Blog Template.

And from Settings > Reading I set

Front page: Home
Posts page: Blog

Now the Home page is perfect, but the blog page seems to load index.php rather than page-template-blog.php

Any thing that I am missing or doing wrong ??


You're making a little work for yourself here - I would forget custom templates and instead utilise the template hierarchy - front-page.php for the home page (front page), and home.php for the blog page.

You'll still need to have your settings as you've described in your question, but the 'control' pages are now independent of the templates that render them :)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号