问题描述
检测wordpress主页有哪些不同的方法
除了 is_front_page()
和 is_home()
谢谢
is_front_page()
就是你想要的.
我假设,根据 wp-admin 中的设置,is_home()
不起作用,您的主页是静态的.
is_home()
在您的主要博客页面上返回 true,而 is_front_page()
在任何被定义为首页的页面上返回 true,无论是否为 Feed.>
来自法典:
此条件标签检查主页是帖子还是页面.这是一个布尔函数,意味着它返回 TRUE 或 FALSE.当显示主博客页面并且设置->阅读->前页显示设置为您的最新帖子"时,或设置为静态页面"且前页"值为正在显示的当前页面.
What are the different ways to detect wordpress homepage
except is_front_page()
and is_home()
Thanks
is_front_page()
is what you want.
I assume, by the fact that is_home()
is not working, that your home page is static, according to the settings in wp-admin.
is_home()
returns true on your main blog page whereas is_front_page()
returns true on which ever page is defined as your front page, feed or not.
From codex:
这篇关于在wordpress中检测主页有哪些不同的方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!