Advertisement
hmbashar

How to change Howdy text and use conditional text in wp site

May 20th, 2015
604
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.85 KB | None | 0 0
  1. /*
  2. * Main Post: http://www.pchelpcenterbd.com/wordpress-development-12813
  3. * Coded by: Md Abul Bashar
  4. */
  5. function public_holiday() {
  6.     $date = date('d-m');
  7.     switch($date) {
  8.         case '01-01':
  9.             $message = 'Happy New Years ';
  10.         break;
  11.  
  12.         case '02-06':
  13.             $message = 'Happy Sobeborat Mobarak ';
  14.         break;
  15.        
  16.  
  17.         case '18-06':
  18.             $message = 'Happy Romadan Mobarak ';
  19.         break;
  20.        
  21.         case '18-07':
  22.             $message = 'Eid Mobarak ';
  23.         break;
  24.  
  25.         default:
  26.             $message = 'Welcome to ';
  27.     }
  28.     return $message;
  29. }
  30.  
  31. function howdy_message($translated_text, $text, $domain) {
  32.     $message = public_holiday();
  33.     $new_message = str_replace('Howdy', $message, $text);
  34.     return $new_message;
  35. }
  36.  
  37. add_filter('gettext', 'howdy_message', 10, 3);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement