WordPress.org

Support

Support » Plugins and Hacks » [Plugin: Twitter Tools] Using Ugly Permalinks in tweets

[Plugin: Twitter Tools] Using Ugly Permalinks in tweets

  • I’m having a serious case of the brain farts.

    In THEORY I know that I should be able to use a function filter to have Twitter Tools use ugly permalinks in tweets (to force shorter urls and yet keep ‘branding’).

    Since I KNOW I’m way short on sleep, does this look right in theory?

    // Add hook for Twitter Tools URL shortening filter
    add_filter('tweet_blog_post_url','makeShortURL');
    
    // Function to make the short URL
    function makeShortURL($url) {
      global $post;
      $shortpost = $post->ID;
      $shortpost = "http://domain.com/" . $shortpost;
      return $shortpost;
    }
Viewing 2 replies - 1 through 2 (of 2 total)
  • You’d need a plugin to map http://domain.com/123 to the post, but yes, that should work.

    Doy. So I added in a p?= in there 😉

    // Add hook for Twitter Tools URL shortening filter
    add_filter('tweet_blog_post_url','makeShortURL');
    
    // Function to make the short URL
    function makeShortURL($url) {
      global $post;
      $shortpost = $post->ID;
      $shortpost = "http://domain.com/p?=" . $shortpost;
      return $shortpost;
    }

    And that kicks back domain.com/p?= … dang it. $post->ID is wrong.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: Twitter Tools] Using Ugly Permalinks in tweets’ is closed to new replies.