From 72a354331b89b29c33c43af6d88d7d1b2e7b38b7 Mon Sep 17 00:00:00 2001 From: nacin Date: Sun, 21 Nov 2010 13:55:11 +0000 Subject: [PATCH] Add a simple filter to allow removing the recent comments default widget styles. fixes #15493, see #14876. git-svn-id: http://svn.automattic.com/wordpress/trunk@16522 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-content/themes/twentyten/functions.php | 3 +-- wp-includes/default-widgets.php | 6 +++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/wp-content/themes/twentyten/functions.php b/wp-content/themes/twentyten/functions.php index 4b16a0939..3b2184380 100644 --- a/wp-content/themes/twentyten/functions.php +++ b/wp-content/themes/twentyten/functions.php @@ -430,8 +430,7 @@ add_action( 'widgets_init', 'twentyten_widgets_init' ); * @since Twenty Ten 1.0 */ function twentyten_remove_recent_comments_style() { - global $wp_widget_factory; - remove_action( 'wp_head', array( $wp_widget_factory->widgets['WP_Widget_Recent_Comments'], 'recent_comments_style' ) ); + add_filter( 'show_recent_comments_widget_style', '__return_false' ); } add_action( 'widgets_init', 'twentyten_remove_recent_comments_style' ); diff --git a/wp-includes/default-widgets.php b/wp-includes/default-widgets.php index ca074c949..b4847d0e6 100644 --- a/wp-includes/default-widgets.php +++ b/wp-includes/default-widgets.php @@ -614,7 +614,11 @@ class WP_Widget_Recent_Comments extends WP_Widget { add_action( 'transition_comment_status', array(&$this, 'flush_widget_cache') ); } - function recent_comments_style() { ?> + function recent_comments_style() { + if ( ! current_theme_supports( 'widgets' ) // Temp hack #14876 + || ! apply_filters( 'show_recent_comments_widget_style', true, $this->id_base ) ) + return; + ?>