Add ID attribute to style element from wp_add_inline_style().
props westonruter. fixes #30032. Built from https://develop.svn.wordpress.org/trunk@29956 git-svn-id: http://core.svn.wordpress.org/trunk@29703 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
ccbf1571f3
commit
26c8088a97
|
@ -120,12 +120,14 @@ class WP_Styles extends WP_Dependencies {
|
||||||
}
|
}
|
||||||
|
|
||||||
public function add_inline_style( $handle, $code ) {
|
public function add_inline_style( $handle, $code ) {
|
||||||
if ( !$code )
|
if ( ! $code ) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$after = $this->get_data( $handle, 'after' );
|
$after = $this->get_data( $handle, 'after' );
|
||||||
if ( !$after )
|
if ( ! $after ) {
|
||||||
$after = array();
|
$after = array();
|
||||||
|
}
|
||||||
|
|
||||||
$after[] = $code;
|
$after[] = $code;
|
||||||
|
|
||||||
|
@ -135,15 +137,17 @@ class WP_Styles extends WP_Dependencies {
|
||||||
public function print_inline_style( $handle, $echo = true ) {
|
public function print_inline_style( $handle, $echo = true ) {
|
||||||
$output = $this->get_data( $handle, 'after' );
|
$output = $this->get_data( $handle, 'after' );
|
||||||
|
|
||||||
if ( empty( $output ) )
|
if ( empty( $output ) ) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$output = implode( "\n", $output );
|
$output = implode( "\n", $output );
|
||||||
|
|
||||||
if ( !$echo )
|
if ( ! $echo ) {
|
||||||
return $output;
|
return $output;
|
||||||
|
}
|
||||||
|
|
||||||
echo "<style type='text/css'>\n";
|
echo "<style id='wp-inline-style-" . esc_attr( $handle ) . "' type='text/css'>\n";
|
||||||
echo "$output\n";
|
echo "$output\n";
|
||||||
echo "</style>\n";
|
echo "</style>\n";
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue