Permalink
Browse files

fix removal of recent comments CSS snippet

  • Loading branch information...
1 parent 733a675 commit 486e0f13d68e529db34a9f21646b0aff17ba2186 @willnorris willnorris committed Oct 8, 2009
Showing with 12 additions and 10 deletions.
  1. +12 −10 comments.php
View
@@ -398,17 +398,19 @@ function openid_get_user_data_form($data, $identity_url) {
}
+/**
+ * Remove the CSS snippet added by the Recent Comments widget because it breaks entries that include the OpenID logo.
+ */
function openid_recent_comments() {
- if ( is_active_widget('wp_widget_recent_comments') ) {
- remove_action('wp_head', 'wp_widget_recent_comments_style');
-
- // most themes seem to handle the recent comments widget okay, so I don't think the following style addition is necessary. We'll leave it here just in case it's needed later.
- //add_action('wp_head', create_function('', 'echo \'<style type="text/css">.recentcomments a{padding: 0;margin: 0 !important;}</style>\';' ));
- } else {
- // WP 2.8 +
- global $wp_widget_factory;
- if ( $wp_widget_factory && array_key_exists('WP_Widget_Recent_Comments', $wp_widget_factory->widgets) ) {
- remove_action('wp_head', array($wp_widget_factory->widgets['WP_Widget_Recent_Comments'], 'recent_comments_style'));
+ global $wp_widget_factory;
+
+ if ( $wp_widget_factory && array_key_exists('WP_Widget_Recent_Comments', $wp_widget_factory->widgets) ) {
+ // this is an ugly hack because remove_action doesn't actually work the way it should with objects
+ foreach ( array_keys($GLOBALS['wp_filter']['wp_head'][10]) as $key ) {
+ if ( strpos($key, 'WP_Widget_Recent_Commentsrecent_comments_style') === 0 ) {
+ remove_action('wp_head', $key);
+ return;
+ }
}
}
}

0 comments on commit 486e0f1

Please sign in to comment.