当我更改帖子时,Wordpress 页面层次结构被忘记了页
再会。在 WordPress 中通过设置 ->阅读时,我更新了我的帖子获得输出的页面(参见屏幕截图)。新页面称为博客。它的父页面是新闻。
帖子显示正常,但是,对于博客页面, is_home() 现在为 true!?!它的 URL 未更改(/news/blog)。
一点背景:在幕后,我嗅探每个页面以确定要显示的子导航。由于帖子页面认为它是主页,因此不会输出子导航,这是不正确的。
为什么它会失去它真正的父页面并认为它现在是主页?这是设计使然吗?有什么办法解决这个问题吗?
WordPress 版本:3.1 / 主题:Starkers
谢谢。
Good day. In WordPress via Settings -> Reading, I updated the page my posts get output (see screen shot). New page is called Blog. It's parent page is News.
Posts are displaying fine, however, for the Blog page, is_home() is now true!?!. It's URL is unchanged (/news/blog).
A little background: Under the hood I sniff each page to determine what sub nav to display. Since the posts page thinks it's the home page, no sub nav is output, which is not correct.
Why it would lose it's true parent and think that it's the home page now? Is this by design? Any way around this?
WordPress version:3.1 / Theme: Starkers
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这种行为很正常,但会引起很多混乱。您可以根据 is_home() 条件向子导航代码添加特殊情况,也可以创建一个自定义页面模板,其中包含使用 WP_Query 提取最近帖子的辅助查询。
这是辅助查询的框架:
This behavior is normal and causes a lot of confusion. You can either add a special case to the code for your subnav based on the is_home() conditional, or you can create a custom page template that includes a secondary query using WP_Query to pull in recent posts.
Here is a skeleton for the secondary query: