Detect Visitors From Twitter in WordPress blog

If you have significant visitor base from Twitter then will it not be a great idea to detect Twitter visitors and offer them a warm welcome, remind them that their re-tweets are appreciated. You might also want them to point towards some specific blog posts or some freebies that they might interested in.

For that you can add following code in your single.php file and add your welcome message.

  1. <?php if (strpos(“twitter.com”,$_SERVER[HTTP_REFERER])==0) {
  2. echo “Welcome, Twitter visitor! If you enjoy this post, don’t hesitate to retweet!”;
  3. } ?>

Tags: , ,