Twitter is obviously a very useful tools for bloggers. Did you ever wanted to know how many times your posts are sent to Twitter by your readers? If yes, just read on and learn how to know it, and display it on your blog, in full text mode.

paste the following function in your functions.php file:


function tweetscount ($url){

$content = file_get_contents(“”.$url);

$x = new SimpleXmlElement($content);

$tweets = $x->story->url_count;

echo “Tweets: “.$tweets;


Once done, you can get the number of tweets for any web page you want, for exemple:

<?php tweetscount(“”); ?>

To automatically display how many times your posts has been tweet, open the single.php file file and paste the following code:

<?php tweetscount($post->permalink); ?>

Previous articlePHP 5.3.0RC2 Release Announcement
Next articleHow to Only Show Posts With a Specific Custom Field


  1. Great post. I need to thank you for this informative read, I actually appreciate sharing this great post. Keep up your work.


Please enter your comment!
Please enter your name here