wp_style_is()
wp_style_is( string $handle, string $list = ‘enqueued’ )
检查是否已将CSS样式表添加到队列中。
Check whether a CSS stylesheet has been added to the queue.
参数(Parameters)
参数 | 类型 | 说明 |
---|---|---|
$handle | (string) | 样式表的名称。 |
$list | (string) | 要检查的样式表的状态。接受’enqueued’、’registered’、’queue’、’tou-do’和’done’。 |
源码(Source)
/** * Check whether a CSS stylesheet has been added to the queue. * * @since 2.8.0 * * @param string $handle Name of the stylesheet. * @param string $list Optional. Status of the stylesheet to check. Default 'enqueued'. * Accepts 'enqueued', 'registered', 'queue', 'to_do', and 'done'. * @return bool Whether style is queued. */ function wp_style_is( $handle, $list = 'enqueued' ) { _wp_scripts_maybe_doing_it_wrong( __FUNCTION__ ); return (bool) wp_styles()->query( $handle, $list ); }
更新版本 | 源码位置 | 使用 | 被使用 |
---|---|---|---|
2.8.0 | wp-includes/functions.wp-styles.php | 4 | 20 |
笔记(Notes)
在WordPress的旧版本中(在3.1中选中),不接受$list param的“enqueued”值,并在启用strict模式时导致PHP通知和警告。
wp_style_is() 为WP2原创文章,链接:https://www.wp2.cn/functions/wp_style_is/