【问题标题】:Wordpress - Custom Blog PageWordpress - 自定义博客页面
【发布时间】:2010-12-05 13:04:30
【问题描述】:

我想显示一个静态首页和自定义帖子页面。我为此创建了 2 个页面模板。

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

然后创建2个wordpress页面Home和Blog,然后对于首页,将页面模板设置为Home Template,对于博客页面,将页面模板设置为Blog Template。

从设置>阅读我设置

Front page: Home
Posts page: Blog

现在主页是完美的,但是博客页面似乎加载了index.php而不是page-template-blog.php

我遗漏或做错了什么??

【问题讨论】:

标签: php wordpress


【解决方案1】:

您在这里为自己做了一些工作 - 我会忘记自定义模板,而是使用 template hierarchy - front-page.php 用于主页(首页),home.php 用于博客页面。

您仍然需要按照问题中所述进行设置,但“控制”页面现在独立于呈现它们的模板:)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-09-18
    • 2021-07-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多