is_page()
is_page( int|string|int[]|string[] $page = ” ) 确定查询是否针对…
is_page( int|string|int[]|string[] $page = ” )
确定查询是否针对现有单页。
Determines whether the query is for an existing single page.
目录锚点:#说明#参数#返回#源码
说明(Description)
另见函数 is_single()
参数(Parameters)
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| $page | (int | string | int[] | string[]) | 可选 | 要检查的页ID、标题、段塞或这样的数组。 |
返回(Return)
(bool)查询是否针对现有的单页。
源码(Source)
/**
* Is the query for an existing single page?
*
* If the $page parameter is specified, this function will additionally
* check if the query is for one of the pages specified.
*
* @see is_single()
* @see is_singular()
*
* @since 1.5.0
*
* @global WP_Query $wp_query
*
* @param mixed $page Page ID, title, slug, or array of such.
* @return bool
*/
function is_page( $page = '' ) {
global $wp_query;
if ( ! isset( $wp_query ) ) {
_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' );
return false;
}
return $wp_query->is_page( $page );
}| 更新版本 | 源码位置 | 使用 | 被使用 |
|---|---|---|---|
| 1.5.0 | wp-includes/query.php:576 | 5 | 3 |
类别:WordPress 函数手册、
本文收集自互联网,转载请注明来源。
如有侵权,请联系 wper_net@163.com 删除。

还没有任何评论,赶紧来占个楼吧!