From f283e9d81f956747e73a2b2be1668e17d204c7b5 Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Fri, 21 Jul 2017 21:02:43 +0000 Subject: [PATCH] Widgets: Include `widget_text` class name on Custom HTML widget wrapper for theme styling compatibility, in addition to previously-added `textwidget` class on nested content container. Amends [40893], [41115]. See #40907. Fixes #41392 for trunk. Built from https://develop.svn.wordpress.org/trunk@41116 git-svn-id: http://core.svn.wordpress.org/trunk@40956 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/version.php | 2 +- wp-includes/widgets/class-wp-widget-custom-html.php | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/wp-includes/version.php b/wp-includes/version.php index bfb7c292cc..f5e9c17542 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.9-alpha-41115'; +$wp_version = '4.9-alpha-41116'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. diff --git a/wp-includes/widgets/class-wp-widget-custom-html.php b/wp-includes/widgets/class-wp-widget-custom-html.php index 7447415185..7fcce78f19 100644 --- a/wp-includes/widgets/class-wp-widget-custom-html.php +++ b/wp-includes/widgets/class-wp-widget-custom-html.php @@ -75,6 +75,9 @@ class WP_Widget_Custom_HTML extends WP_Widget { */ $content = apply_filters( 'widget_custom_html_content', $content, $instance, $this ); + // Inject the Text widget's container class name alongside this widget's class name for theme styling compatibility. + $args['before_widget'] = preg_replace( '/(?<=\sclass=["\'])/', 'widget_text ', $args['before_widget'] ); + echo $args['before_widget']; if ( ! empty( $title ) ) { echo $args['before_title'] . $title . $args['after_title'];