_print_styles()
Prints styles (internal use only).
Internal function — this function is designed to be used by the kernel itself. It is not recommended to use this function in your code.
No Hooks.
Returns
null. Nothing (null).
Usage
_print_styles();
Notes
- Global. true|false.
$compress_css
Changelog
| Since 3.3.0 | Introduced. |
_print_styles() print styles code WP 7.0
function _print_styles() {
global $compress_css;
$wp_styles = wp_styles();
$zip = $compress_css ? 1 : 0;
if ( $zip && defined( 'ENFORCE_GZIP' ) && ENFORCE_GZIP ) {
$zip = 'gzip';
}
$concat = trim( $wp_styles->concat, ', ' );
if ( $concat ) {
$dir = $wp_styles->text_direction;
$ver = $wp_styles->default_version;
$concat_source_url = 'css-inline-concat-' . $concat;
$concat = str_split( $concat, 128 );
$concatenated = '';
foreach ( $concat as $key => $chunk ) {
$concatenated .= "&load%5Bchunk_{$key}%5D={$chunk}";
}
$href = $wp_styles->base_url . "/wp-admin/load-styles.php?c={$zip}&dir={$dir}" . $concatenated . '&ver=' . $ver;
echo "<link rel='stylesheet' href='" . esc_attr( $href ) . "' media='all' />\n";
if ( ! empty( $wp_styles->print_code ) ) {
$processor = new WP_HTML_Tag_Processor( '<style></style>' );
$processor->next_tag();
$style_tag_contents = "\n{$wp_styles->print_code}\n"
. sprintf( "/*# sourceURL=%s */\n", rawurlencode( $concat_source_url ) );
$processor->set_modifiable_text( $style_tag_contents );
echo "{$processor->get_updated_html()}\n";
}
}
if ( ! empty( $wp_styles->print_html ) ) {
echo $wp_styles->print_html;
}
}