3 * BackPress styles procedural API.
10 * Display styles that are in the queue or part of $handles.
13 * @uses do_action() Calls 'wp_print_styles' hook.
14 * @global object $wp_styles The WP_Styles object for printing styles.
16 * @param array|bool $handles Styles to be printed. An empty array prints the queue,
17 * an array with one string prints that style, and an array of strings prints those styles.
18 * @return bool True on success, false on failure.
20 function wp_print_styles( $handles = false ) {
21 do_action( 'wp_print_styles' );
22 if ( '' === $handles ) // for wp_head
26 if ( !is_a($wp_styles, 'WP_Styles') ) {
28 return array(); // No need to instantiate if nothing's there.
30 $wp_styles = new WP_Styles();
33 return $wp_styles->do_items( $handles );
37 * Register CSS style file.
40 * @see WP_Styles::add() For additional information.
41 * @global object $wp_styles The WP_Styles object for printing styles.
42 * @link http://www.w3.org/TR/CSS2/media.html#media-types List of CSS media types.
44 * @param string $handle Name of the stylesheet.
45 * @param string|bool $src Path to the stylesheet from the root directory of WordPress. Example: '/css/mystyle.css'.
46 * @param array $deps Array of handles of any stylesheet that this stylesheet depends on.
47 * (Stylesheets that must be loaded before this stylesheet.) Pass an empty array if there are no dependencies.
48 * @param string|bool $ver String specifying the stylesheet version number. Set to NULL to disable.
49 * Used to ensure that the correct version is sent to the client regardless of caching.
50 * @param string $media The media for which this stylesheet has been defined.
52 function wp_register_style( $handle, $src, $deps = array(), $ver = false, $media = 'all' ) {
54 if ( !is_a($wp_styles, 'WP_Styles') )
55 $wp_styles = new WP_Styles();
57 $wp_styles->add( $handle, $src, $deps, $ver, $media );
61 * Remove a registered CSS file.
64 * @see WP_Styles::remove() For additional information.
65 * @global object $wp_styles The WP_Styles object for printing styles.
67 * @param string $handle Name of the stylesheet.
69 function wp_deregister_style( $handle ) {
71 if ( !is_a($wp_styles, 'WP_Styles') )
72 $wp_styles = new WP_Styles();
74 $wp_styles->remove( $handle );
78 * Enqueue a CSS style file.
80 * Registers the style if src provided (does NOT overwrite) and enqueues.
83 * @see WP_Styles::add(), WP_Styles::enqueue()
84 * @global object $wp_styles The WP_Styles object for printing styles.
85 * @link http://www.w3.org/TR/CSS2/media.html#media-types List of CSS media types.
87 * @param string $handle Name of the stylesheet.
88 * @param string|bool $src Path to the stylesheet from the root directory of WordPress. Example: '/css/mystyle.css'.
89 * @param array $deps Array of handles (names) of any stylesheet that this stylesheet depends on.
90 * (Stylesheets that must be loaded before this stylesheet.) Pass an empty array if there are no dependencies.
91 * @param string|bool $ver String specifying the stylesheet version number, if it has one. This parameter
92 * is used to ensure that the correct version is sent to the client regardless of caching, and so should be included
93 * if a version number is available and makes sense for the stylesheet.
94 * @param string $media The media for which this stylesheet has been defined.
96 function wp_enqueue_style( $handle, $src = false, $deps = array(), $ver = false, $media = 'all' ) {
98 if ( !is_a($wp_styles, 'WP_Styles') )
99 $wp_styles = new WP_Styles();
102 $_handle = explode('?', $handle);
103 $wp_styles->add( $_handle[0], $src, $deps, $ver, $media );
105 $wp_styles->enqueue( $handle );
109 * Check whether style has been added to WordPress Styles.
111 * The values for list defaults to 'queue', which is the same as wp_enqueue_style().
113 * @since WP unknown; BP unknown
114 * @global object $wp_styles The WP_Styles object for printing styles.
116 * @param string $handle Name of the stylesheet.
117 * @param string $list Values are 'registered', 'done', 'queue' and 'to_do'.
118 * @return bool True on success, false on failure.
120 function wp_style_is( $handle, $list = 'queue' ) {
122 if ( !is_a($wp_styles, 'WP_Styles') )
123 $wp_styles = new WP_Styles();
125 $query = $wp_styles->query( $handle, $list );
127 if ( is_object( $query ) )