wp_print_styles

Display styles that are in the $handles queue.

Description

(array) wp_print_styles( (bool) $handles = false ); 

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.

Returns (array)

On success, a processed array of WP_Dependencies items; otherwise, an empty array.

Parameters (1)

0. $handles — Optional. (bool) => false
Styles to be printed. Default false..

Usage

  1. if ( !function_exists( 'wp_print_styles' ) ) { 
  2. require_once ABSPATH . WPINC . '/functions.wp-styles.php'; 
  3.  
  4. // Styles to be printed. Default 'false'. 
  5. $handles = false; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = wp_print_styles($handles); 
  9.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/functions.wp-styles.php  
  1. function wp_print_styles( $handles = false ) { 
  2. if ( '' === $handles ) { // for wp_head 
  3. $handles = false; 
  4. /** 
  5. * Fires before styles in the $handles queue are printed. 
  6. * @since 2.6.0 
  7. */ 
  8. if ( ! $handles ) { 
  9.  
  10.  
  11. global $wp_styles; 
  12. if ( ! ( $wp_styles instanceof WP_Styles ) ) { 
  13. if ( ! $handles ) { 
  14. return array(); // No need to instantiate if nothing is there. 
  15.  
  16. returnwp_styles)->do_items( $handles );