| | 182 | // save output buffer into a variable |
| | 183 | $buffer = ob_get_contents(); |
| | 184 | |
| | 185 | // stop output buffering |
| | 186 | ob_end_clean(); |
| | 187 | |
| | 188 | // backpat: check to see if a stylesheet was hardcoded into header.php |
| | 189 | // if so, echo the output buffer without the hardcoded stylesheet and enqueue it |
| | 190 | if ( strpos( $buffer, 'style.css' ) !== false ) { |
| | 191 | // replace hardcoded stylesheet with nothing |
| | 192 | echo str_replace( '<link rel="stylesheet" href="' . get_bloginfo( 'stylesheet_url' ) . '" type="text/css" media="screen" />', '', $buffer ); |
| | 193 | // Now properly enqueue the child theme's stylesheet |
| | 194 | wp_enqueue_style( get_stylesheet(), get_stylesheet_uri(), array() ); |
| | 195 | |
| | 196 | // stop the rest of this function |
| | 197 | return; |
| | 198 | } |
| | 199 | |
| | 200 | // we still need to output the saved buffer, then we continue as usual! |
| | 201 | echo $buffer; |
| | 202 | |