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
This commit is contained in:
Weston Ruter
2017-07-21 18:12:43 +00:00
parent bece1ff7a5
commit 642693bb91
2 changed files with 3 additions and 0 deletions

View File

@@ -79,7 +79,9 @@ class WP_Widget_Custom_HTML extends WP_Widget {
if ( ! empty( $title ) ) {
echo $args['before_title'] . $title . $args['after_title'];
}
echo '<div class="textwidget custom-html-widget">'; // The textwidget class is for theme styling compatibility.
echo $content;
echo '</div>';
echo $args['after_widget'];
}

View File

@@ -70,6 +70,7 @@ class Test_WP_Widget_Custom_HTML extends WP_UnitTestCase {
$this->assertNotEmpty( $this->widget_custom_html_content_args );
$this->assertNotEmpty( $this->widget_text_args );
$this->assertContains( '[filter:widget_text][filter:widget_custom_html_content]', $output );
$this->assertContains( '<div class="textwidget custom-html-widget">', $output );
$this->assertNotContains( '<p>', $output );
$this->assertNotContains( '<br>', $output );
$this->assertNotContains( '</u>', $output );