| @@ 42-65 (lines=24) @@ | ||
| 39 | * @param string|bool|array $handles Styles to be printed. Default 'false'. |
|
| 40 | * @return array On success, a processed array of WP_Dependencies items; otherwise, an empty array. |
|
| 41 | */ |
|
| 42 | function wp_print_styles( $handles = false ) { |
|
| 43 | if ( '' === $handles ) { // for wp_head |
|
| 44 | $handles = false; |
|
| 45 | } |
|
| 46 | /** |
|
| 47 | * Fires before styles in the $handles queue are printed. |
|
| 48 | * |
|
| 49 | * @since 2.6.0 |
|
| 50 | */ |
|
| 51 | if ( ! $handles ) { |
|
| 52 | do_action( 'wp_print_styles' ); |
|
| 53 | } |
|
| 54 | ||
| 55 | _wp_scripts_maybe_doing_it_wrong( __FUNCTION__ ); |
|
| 56 | ||
| 57 | global $wp_styles; |
|
| 58 | if ( ! ( $wp_styles instanceof WP_Styles ) ) { |
|
| 59 | if ( ! $handles ) { |
|
| 60 | return array(); // No need to instantiate if nothing is there. |
|
| 61 | } |
|
| 62 | } |
|
| 63 | ||
| 64 | return wp_styles()->do_items( $handles ); |
|
| 65 | } |
|
| 66 | ||
| 67 | /** |
|
| 68 | * Add extra CSS styles to a registered stylesheet. |
|
| @@ 66-87 (lines=22) @@ | ||
| 63 | * @param string|bool|array $handles Optional. Scripts to be printed. Default 'false'. |
|
| 64 | * @return array On success, a processed array of WP_Dependencies items; otherwise, an empty array. |
|
| 65 | */ |
|
| 66 | function wp_print_scripts( $handles = false ) { |
|
| 67 | /** |
|
| 68 | * Fires before scripts in the $handles queue are printed. |
|
| 69 | * |
|
| 70 | * @since 2.1.0 |
|
| 71 | */ |
|
| 72 | do_action( 'wp_print_scripts' ); |
|
| 73 | if ( '' === $handles ) { // for wp_head |
|
| 74 | $handles = false; |
|
| 75 | } |
|
| 76 | ||
| 77 | _wp_scripts_maybe_doing_it_wrong( __FUNCTION__ ); |
|
| 78 | ||
| 79 | global $wp_scripts; |
|
| 80 | if ( ! ( $wp_scripts instanceof WP_Scripts ) ) { |
|
| 81 | if ( ! $handles ) { |
|
| 82 | return array(); // No need to instantiate if nothing is there. |
|
| 83 | } |
|
| 84 | } |
|
| 85 | ||
| 86 | return wp_scripts()->do_items( $handles ); |
|
| 87 | } |
|
| 88 | ||
| 89 | /** |
|
| 90 | * Adds extra code to a registered script. |
|