2 Commits 4ddfff0591 ... 42f59826d0

Author SHA1 Message Date
  windhamdavid 42f59826d0 fix depr null on str_replace 4 months ago
  windhamdavid f0971d928b readme 4 months ago
2 changed files with 7 additions and 9 deletions
  1. 1 1
      README.md
  2. 6 8
      functions.php

+ 1 - 1
README.md

@@ -33,7 +33,7 @@ Thanks:
 
 ### Log
 
-- 24/07/26 - rm news and footer contact
+- 24/07/26 - rm news/footer info, fix str_replace deprecation, up v6.6.1
 - 24/04/05 - stage / theme.json
 - 24/04/04 - Init
 

+ 6 - 8
functions.php

@@ -85,15 +85,13 @@ function uhp24_footer_filter ($default) {
   return '';
 }
 
-add_filter( 'admin_bar_menu', 'uhp24_replace_wordpress_howdy', 25 );
-function uhp24_replace_wordpress_howdy( $wp_admin_bar ) {
-  $account = $wp_admin_bar->get_node('my-account');
-  $newtext = str_replace( 'Howdy,', '', $account->title );
-  $wp_admin_bar->add_node( array(
-    'id' => 'my-account',
-    'title' => $newtext,
-  ));
+add_filter('gettext', 'uhp24_change_howdy', 10, 3);
+function uhp24_change_howdy($translated, $text, $domain) {
+    if (false !== strpos($translated, 'Howdy,'))
+        return str_replace('Howdy,', '', $translated);
+    return $translated;
 }
+
 /* for email */
 add_filter( 'gettext', 'uhp24_change_howdy_text', 10, 2 );
 function uhp24_change_howdy_text( $translation, $original ) {