• Moderator Ipstenu (Mika Epstein)

    (@ipstenu)


    ?????? Advisor and Activist

    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 = "https://domain.com/" . $shortpost;
      return $shortpost;
    }
Viewing 2 replies - 1 through 2 (of 2 total)
  • You’d need a plugin to map https://domain.com/123 to the post, but yes, that should work.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    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 = "https://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.