WordPress.org

Ready to get started?Download WordPress

Forums

WP Tweet Button
[resolved] Use WP local URLs (own domain) (11 posts)

  1. wprunner
    Member
    Posted 3 years ago #

    Hello,

    I would like to have an option added for "URL Shortener". It is possible to use WordPress local URLs as a short URL for tweeting. Even when using pretty permalinks the WP ugly URLs can still work and redirect to the pretty ones.

    The URL would look like this:
    http://mydomain.com/?p=123

    The "Tweet This" plugin has such feature but I don't use it and don't really like this plugin.

    I would like to have this feature added to the WP Tweet Button plugin. It is perfect for me except for the lack of support for Local URLs.

    Thanks.

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

  2. Tanin
    Member
    Plugin Author

    Posted 3 years ago #

    The plugin already has this for WP3 and up. All you have to do is select the "WordPress 3 shortener function" as the shortener. What WP version are you running?

  3. wprunner
    Member
    Posted 3 years ago #

    Hello,

    I use WP3.

    Actually, that is what I thought the "WordPress 3 shortener function" does but it didn't !!!

    I saw the URL, it uses WordPress's own URL shortner service wp.me
    Test it and see the twitter URL argument (url=)

  4. richardxthripp
    Member
    Posted 3 years ago #

    Are you using the WordPress.com Stats plugin? By default, it adds a filter to get_shortlink which replaces local short URLs with wp.me short URLs. You can disable this in the WordPress.com Stats options.

    My plugin Tweet This does the same thing if you are not using local URLs. You can disable this by unchecking "Pass shortened URLs to WordPress via the get_shortlink filter if the URL service is not set to Local" in the Advanced Options section of the Tweet This options.

  5. wprunner
    Member
    Posted 3 years ago #

    Hi,

    Yes of course I am using the WordPress.com Stats plugin, who doesn't ? lol

    unchecked that in the options page of that plugin and it worked, thanks :)

    Though, the www. prefix will still bug me, a modified version of the function should be used to eliminate it if a blog uses the www.

  6. richardxthripp
    Member
    Posted 3 years ago #

    I haven't looked at WP Tweet Button, but if you just replace all instances of get_bloginfo('url') with str_replace('www.', '', get_bloginfo('url')) it will work if the plugin author uses get_bloginfo('url'). Tweet This does.

  7. Tanin
    Member
    Plugin Author

    Posted 3 years ago #

    Have you tried removing the WWW in your General settings (WordPress address)?

  8. richardxthripp
    Member
    Posted 3 years ago #

    He wants to use the www prefix elsewhere but not use it on short URLs.

  9. Tanin
    Member
    Plugin Author

    Posted 3 years ago #

    In that case I would suggest adding this at the end of your theme's functions.php

    remove_filter('get_shortlink', 'wpme_get_shortlink_handler', 10, 4);
    add_filter('get_shortlink','tw_strip_www',10,1);
    function tw_strip_www($content){
    	$str = str_replace('http://www.','http://',$content);
    	$str = str_replace('https://www.','https://',$str);
    	return $str;
    }

    The first line disables the wp.org shortener and the rest removes the www.

  10. Tanin
    Member
    Plugin Author

    Posted 3 years ago #

    I went ahead and added them both as options. It'll be included in the next release.

  11. wprunner
    Member
    Posted 3 years ago #

    Thank you :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic