WordPress.org

Ready to get started?Download WordPress

Forums

WP Tweet Button
Disable or Set a Custom original_referer (2 posts)

  1. virtualgraffiti
    Member
    Posted 2 years ago #

    I was wondering if there is a way to disable or set a custom url for the original_referer on the tweet button.

    For example I want the tweet button to tweet the following text:

    "I want to win a NETGEAR Switch with @virtualgraffiti and @NETGEAR. Visit http://bit.ly/owif6Z and RT for your chance to win. #NetGuardStore"

    But right now when I specify that as the tweet text it automatically adds the blog post url to the end of the tweet so it shows up like this:

    "I want to win a NETGEAR with @virtualgraffiti and @NETGEAR. Visit http://bit.ly/owif6Z and RT for your chance to win. #NetGuardStore http://www.virtualgraffiti.com/blog/?p=15540"

    So is there a simple way to disable the blog url from getting added to the tweet?

    http://wordpress.org/extend/plugins/wp-tweet-button/

  2. Tanin
    Member
    Plugin Author

    Posted 2 years ago #

    Yes, but it's an ugly hack and it does have some consequences. You want to remove the URL that twitter uses to do all its magic. (If you remove it, the count won't really work)

    Here's how you remove it:
    1. Make sure you aren't using any URL shorteners.
    2. Add your custom text as usual.
    3. Open up your theme's function.php and add the following 2 lines to it:

    function wp_tweet_button_no_url(){return "#Something";}
    add_filter("wp_tweet_button_long_url","wp_tweet_button_no_url");

    You can replace #something with your own favorite hashtag. The result will be a button that won't count retweets, but it will have whatever text you want in the Twitter popup box. When users click on the count (0), they'll be taken to a Twitter search query with your selected hashtag.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic