Display Retweet Link to Twitter Visitors Only!

Discussion in 'WordPress' started by fisherking, Oct 2, 2009.

  1. #1
    Many webmasters are taking to a more "on-demand" approach to displaying call to action content on their websites ...

    We can see this in use case examples such as:

    Showing pay per click advertisements to search engine visitors, instead of everyone who views your site.
    Displaying social buttons relevant to the end user based on where he came from, or what is available to their Open ID.

    Well, I'm going to teach you how to display your "retweet" links to only visitors who are coming from Twitter.

    It's quite simple, really. You can place the following code anywhere in your templates, and it will display that content only to users whose referrer shows they came from the twitter.com domain.

    <?php if(strpos("twitter.com", $_SERVER['HTTP_REFERER']) == 0) {  ?>
    REPLACE THIS TEXT WITH YOUR RETWEET LINK / CONTENT  
    <?php } ?>
    Code (markup):
     
    fisherking, Oct 2, 2009 IP