显示$ handles队列中的样式。
原型
wp_print_styles( string|bool|array $handles = false )
描述
将空数组传递给$ handles会打印队列,传递一个带有一个字符串的数组打印该样式,并传递一个字符串数组来打印这些样式。
参数
$handles
(string|bool|array)
(Optional)
要打印的样式。默认为’false’。
返回值
(array)
成功时,处理过的数组
源文件
路径:wp-includes/functions.wp-styles.php
<?php
...
function wp_print_styles( $handles = false ) {
if ( '' === $handles ) { // for wp_head
$handles = false;
}
/**
* Fires before styles in the $handles queue are printed.
*
* @since 2.6.0
*/
if ( ! $handles ) {
do_action( 'wp_print_styles' );
}
_wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );
global $wp_styles;
if ( ! ( $wp_styles instanceof WP_Styles ) ) {
if ( ! $handles ) {
return array(); // No need to instantiate if nothing is there.
}
}
return wp_styles()->do_items( $handles );
}
...
?>
其他
英文文档:https://developer.wordpress.org/reference/functions/wp_print_styles/