当发出页面请求时,在什么时候is_front_page
开始工作?我记得,如果您尝试过早使用它,它将始终返回false。
我的假设是wp
行动是第一点is_front_page
但是,条件检查is_front_page
是WP_Query
类,所以不会parse_query
那么最早的安全使用是什么呢?
当发出页面请求时,在什么时候is_front_page
开始工作?我记得,如果您尝试过早使用它,它将始终返回false。
我的假设是wp
行动是第一点is_front_page
但是,条件检查is_front_page
是WP_Query
类,所以不会parse_query
那么最早的安全使用是什么呢?
这个parse_query()
的方法WP_Query
类设置条件标记所基于的变量parse_query
在从返回之前执行挂钩parse_query()
方法,变量已设置(例如。is_home
, 使用人:is_front_page()
) 和is_front_page()
will work, 但是可以连接到更改当前状态的函数parse_query
(仍然是parse_query()
方法,该方法设置如下变量is_home
).
挂钩pre_get_posts
直接在之后执行parse_query
, 这就是为什么我是第一个使用条件标记的安全钩子。
posts_selection
WordPress中的动作挂钩(thewp
动作挂钩是第一个可以使用这些条件的挂钩)。对于主题,这意味着如果在functions.php
, i、 e.功能外部。但是:如果您有对查询对象的引用(例如,from within the parse_query
or pre_get_posts
hooks), you can use the WP_Query conditional methods (例如:$query->is_search()
)
Sub-questions:i) Which files/templates need to be copied to the child theme folder, other than function.php and style.css?ii) What actions/filters/ should be used and where should this code be inserted?抱歉,如果下面的措辞不准确,我是WP初学者。我最近在本地主机上安装了Customizer 4.0.8[作为