Skip to content

Commit 6c6a72b

Browse files
committed
Use HTML API for hide header text
1 parent d29900a commit 6c6a72b

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

src/wp-includes/theme.php

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3010,16 +3010,24 @@ function _custom_logo_header_styles() {
30103010
$classes = array_map( 'sanitize_html_class', $classes );
30113011
$classes = '.' . implode( ', .', $classes );
30123012

3013-
$type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"';
3014-
?>
3015-
<!-- Custom Logo: hide header text -->
3016-
<style id="custom-logo-css"<?php echo $type_attr; ?>>
3017-
<?php echo $classes; ?> {
3018-
position: absolute;
3019-
clip-path: inset(50%);
3020-
}
3021-
</style>
3022-
<?php
3013+
$css = <<<"CSS"
3014+
3015+
{$classes} {
3016+
position: absolute;
3017+
clip-path: inset(50%);
3018+
}
3019+
3020+
CSS;
3021+
3022+
$processor = new WP_HTML_Tag_Processor(
3023+
"<!-- Custom Logo: hide header text -->\n<style id='custom-logo-css'></style>"
3024+
);
3025+
$processor->next_tag();
3026+
if ( ! current_theme_supports( 'html5', 'style' ) ) {
3027+
$processor->set_attribute( 'type', 'text/css' );
3028+
}
3029+
$processor->set_modifiable_text( $css );
3030+
echo $processor->get_updated_html();
30233031
}
30243032
}
30253033

0 commit comments

Comments
 (0)