简体   繁体   中英

Wordpress - Custom Blog Page

I would like to show a static front page and custom posts page. I created 2 page templates for this.

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 :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM