
开发者测试调试工具Xdebug安装及集成使用教程
is_singular ( $post_types = '' )
确定查询是否为任何文章类型(文章、附件、页面、自定义帖子类型)的现有单个文章。
如果指定了$post_types参数,该函数将额外检查该查询是否为指定的文章类型之一。
关于这个和类似的主题函数的更多信息,请查看《主题开发者手册》中的{@link Conditional Tags}文章。
function is_singular( $post_types = '' ) { 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.0' ); return false; } return $wp_query->is_singular( $post_types ); }