Adding Twitter Follow Button With Count To WordPress Blog Manually

0

Recently i wanted to add a twitter follow button showing my current followers count to my WordPress blog and had to do a research on that via Google, i couldn’t find what am looking for at the first few pages and decided to visit the twitter official development page but still couldn’t find what i wanted because all i could see there was the follow button with no count showing.

Oh well, maybe i didn’t get it right but i tried sourcing still no way to adding the twitter count, i wondered how other bloggers did theirs and decided to do a little tweak on the default script code.

Basically the twitter follower button comes in two sizes, the big and the small, am actually using the big button on the blog, probably that would make my readers notice it better.

The default twitter button from the official twitter development page has the following scripts

<a href=”https://twitter.com/trueinternet” data-show-count=”false” data-size=”large”>Follow @trueinternet</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=”//platform.twitter.com/widgets.js”;fjs.parentNode.insertBefore(js,fjs);}}(document,”script”,”twitter-wjs”);</script>

That’s an example with the username @trueinternet(my twitter handle) but the problem with the above script is that, it doesn’t show my current twitter followers count which am in need of.

Adding Twitter Follow Button With Count To WordPress Blog

twitter follow button with count on wordpress blogWhat i actually did to get the count working was to edit the script code since am sort of used to some codes, i just changed the false to true and that got it work.


Here is the new script to get the followers count working

<a href=”https://twitter.com/trueinternet” data-show-count=”true” data-size=”large”>Follow @trueinternet</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=”//platform.twitter.com/widgets.js”;fjs.parentNode.insertBefore(js,fjs);}}(document,”script”,”twitter-wjs”);</script>

Adding This Code To WordPress Blog

Just navigate to what position you want your followers count to show on your WordPress blog via your WordPress DashBoard » Appearance » Widgets

Drag ‘Text‘ To Where you want the Widget To Show(header, sidebar or footer) and simply Copy/Paste the second code then save.

Be sure you change @trueinternet and twitter.com/trueinternet to your twitter handle

View your blog now and you should find the twitter follow button with counts showing your current twitter follow count.

Hope this helps?

kindly Leave a Reply