wpseek.com
WordPress开发者和主题制作者的搜索引擎



wp_print_styles › WordPress Function

Since2.6.0
已弃用n/a
wp_print_styles ( $handles = false )
参数:
  • (string|bool|array) $handles Styles to be printed. Default 'false'.
    Required: No
    默认: false
返回:
  • (string[]) On success, an array of handles of processed WP_Dependencies items; otherwise, an empty array.
定义在:
文档:

Displays styles that are in the $handles queue.

Passing an empty array to $handles prints the queue, passing an array with one string prints that style, and passing an array of strings prints those styles.


源码

function wp_print_styles( $handles = false ) {
	global $wp_styles;

	if ( '' === $handles ) { // For 'wp_head'.
		$handles = false;
	}

	if ( ! $handles ) {
		/**
		 * Fires before styles in the $handles queue are printed.
		 *
		 * @since 2.6.0
		 */
		do_action( 'wp_print_styles' );
	}

	_wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );

	if ( ! ( $wp_styles instanceof WP_Styles ) ) {
		if ( ! $handles ) {
			return array(); // No need to instantiate if nothing is there.
		}
	}

	return wp_styles()->do_items( $handles );
}