Skip to content

Commit 642693b

Browse files
committed
Widgets: Improve theme styling compatibility for Custom HTML widget by adding container with textwidget class.
The same styling from the Text widget should apply to the Custom HTML widget since users are expected to copy HTML from the (legacy) Text widget into the latter. Amends [40893]. See #40907. Fixes #41392. git-svn-id: https://develop.svn.wordpress.org/trunk@41115 602fd350-edb4-49c9-b593-d223f7449a82
1 parent bece1ff commit 642693b

2 files changed

Lines changed: 3 additions & 0 deletions

File tree

src/wp-includes/widgets/class-wp-widget-custom-html.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,9 @@ public function widget( $args, $instance ) {
7979
if ( ! empty( $title ) ) {
8080
echo $args['before_title'] . $title . $args['after_title'];
8181
}
82+
echo '<div class="textwidget custom-html-widget">'; // The textwidget class is for theme styling compatibility.
8283
echo $content;
84+
echo '</div>';
8385
echo $args['after_widget'];
8486
}
8587

tests/phpunit/tests/widgets/custom-html-widget.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ function test_widget() {
7070
$this->assertNotEmpty( $this->widget_custom_html_content_args );
7171
$this->assertNotEmpty( $this->widget_text_args );
7272
$this->assertContains( '[filter:widget_text][filter:widget_custom_html_content]', $output );
73+
$this->assertContains( '<div class="textwidget custom-html-widget">', $output );
7374
$this->assertNotContains( '<p>', $output );
7475
$this->assertNotContains( '<br>', $output );
7576
$this->assertNotContains( '</u>', $output );

0 commit comments

Comments
 (0)