Site icon GoogleCraft

Google News Follow us Button

How to add Follow us on Google News button in your WordPress website?

To add a “Follow us on Google News” icon on your WordPress website, follow these steps:

  1. Get Your Google News Publisher URL:
  1. Prepare the Icon:
  1. Upload the Icon to Your WordPress Media Library:
  1. Add the Code to Your Theme’s functions.php File:
function add_google_news_icon($content) {
    $icon_url = 'PASTE_YOUR_ICON_URL_HERE'; // Replace with the URL you copied 
    $google_news_url = 'YOUR_GOOGLE_NEWS_URL_HERE'; // Replace with your Google News URL
  
    // Append the icon with hyperlink to the content
    $content .= '<a href="' . $google_news_url . '" target="_blank" rel="noopener noreferrer"><img src="' .       $icon_url . '" alt="Follow us on Google News" style="margin-top:20px;" /></a>';

    return $content;
    }
 add_filter('the_content', 'add_google_news_icon');
  1. Save Changes:

Now, when you view a post on your website, you should see the “Follow us on Google News” icon at the end of the content. When clicked, it will open your Google News page in a new tab.




Exit mobile version