Make WordPress Core

Changeset 29956


Ignore:
Timestamp:
10/18/2014 05:57:23 PM (12 years ago)
Author:
SergeyBiryukov
Message:

Add ID attribute to style element from wp_add_inline_style().

props westonruter.
fixes #30032.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class.wp-styles.php

    r28518 r29956  
    121121
    122122        public function add_inline_style( $handle, $code ) {
    123                 if ( !$code )
     123                if ( ! $code ) {
    124124                        return false;
     125                }
    125126
    126127                $after = $this->get_data( $handle, 'after' );
    127                 if ( !$after )
     128                if ( ! $after ) {
    128129                        $after = array();
     130                }
    129131
    130132                $after[] = $code;
     
    136138                $output = $this->get_data( $handle, 'after' );
    137139
    138                 if ( empty( $output ) )
     140                if ( empty( $output ) ) {
    139141                        return false;
     142                }
    140143
    141144                $output = implode( "\n", $output );
    142145
    143                 if ( !$echo )
     146                if ( ! $echo ) {
    144147                        return $output;
    145 
    146                 echo "<style type='text/css'>\n";
     148                }
     149
     150                echo "<style id='wp-inline-style-" . esc_attr( $handle ) . "' type='text/css'>\n";
    147151                echo "$output\n";
    148152                echo "</style>\n";
Note: See TracChangeset for help on using the changeset viewer.