• Home
  • Blog
  • Contact Us
  • Home
  • Blog
  • Contact Us

Add Twitter Follower Count To A WordPress Page

Last Updated: 29 September 2016 By Mike Haydon

I wanted to have a page on my site say something like “Mike Haydon currently has xyz number of followers on Twitter” as a social proof that I have some idea when it comes to social media.

The xyz needed to be regularly updated to reflect the current number. I figured php would be my best option. However, as Twitter is known to frequently go down, I didn’t want it to pull completely live data. Also, if the page gets lots of traffic, an additional php call would needlessly slow down the page.

The best way to overcome this problem is to cache the result and have a backup in case a scheduled check doesn’t pull a result (due to twitter being down or too many API calls). In case you don’t know, caching in this instance would fetch the follower count and store it for easy access until it was fetched again. Each time the page was accessed, it would display that stored result.

Sure enough, there’s a WordPress plugin that can do this and display it as inline text. It’s Followers Count, available at https://wordpress.org/plugins/social-media-followers-counter/

To use it, you’ll need to be able to execute php in the page (which doesn’t happen naturally). Just install Exec PHP: http://wordpress.org/extend/plugins/exec-php/

Once you’ve installed the two plugins and checked your settings, go to the Page or Post and put

<?php followers_count( ‘mikehaydon’, 70000 ); ?>

where you want the followers count to display, changing mikehaydon to your username and 70000 to the number of followers you want displayed when it fails to fetch the followers count.

In my example, I put:

He currently has <?php followers_count( ‘mikehaydon’, 70000 ); ?> followers on Twitter…

You can see it in action here: https://seoperth.net.au/social-media/

*Note: to use Exec PHP, you need to put the php code in the html editor and not view the editing area of that post with the visual editor again. Just make sure you finish the post before you put the code in and don’t go back to it later.

Filed Under: Wordpress
Originally Posted: 22 December 2010

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Learn Web Design

marketing banner

Want to learn how to build your own websites? Check out the course we jointly developed here.

Recent Posts

  • Moving Wordpress Without Plugins
  • Redirection Problem When Installing Wordpress
  • Edit The Default Wordpress RSS Widget
  • Best Wordpress Spam Filtering Plugin
  • Optimize Your Wordpress Site For Mobile
  • Wordpress Delete Post Revisions
  • Add Twitter Follower Count To A Wordpress Page

How Can We Help You?

  • Website Design Service
  • Google Penalty Recovery Service
  • Search Engine Optimization Service

Categories

  • Online Marketing
  • SEO
  • Social Media
  • Website Design
  • Wordpress

At A Glance

  • Ranking
  • Website Design
  • WordPress
  • Social Media
  • Contact
  • Google Penalties
  • Earnings Disclosure
  • Privacy Policy

Contact Us

Local SEO Perth

Contact Us Here

Copyright © 2023