title: Way to get Twitter button, with count, with custom bit.ly URL, working?
body: <p>I'm stuck. I <a href="https://wordpress.stackexchange.com/questions/25483/way-to-get-twitter-button-with-count-with-custom-bit-ly-url-working">posted this on WordPress.StackExchange</a> and they suggested I try at <a href="https://webapps.stackexchange.com/questions/17994/way-to-get-twitter-button-with-count-with-custom-bit-ly-url-working">WebApps.StackExchange</a>, and they suggested I try here. So, apologies for the multiple posts if you follow all those!</p>
  
  <p>I have a client blog using bit.ly pro to generate custom short urls (ie foo.co). I want to show the regular horizontal version of the Twitter button, with tweet-count, and have the link that goes to the post use their custom bit.ly pro url. </p>
  
  <p>I have installed <a href="http://yoast.com/wordpress/bitly-shortlinks/" rel="nofollow noreferrer">Joost de Valk's Bit.ly Shortlinks plugin</a>, which successfully converts normal WP shortlinks (<code>wp_get_shortlink()</code>) to the custom Bit.ly pro URL elsewhere in the site, but Twitter seems to trump that and render everything with the default t.co domain instead. </p>
  
  <p>I've looked at the suggestions from <a href="https://webapps.stackexchange.com/questions/14363/twitter-tweet-button-dont-use-built-in-url-shortener">this question</a> but using the # as the data-url doesn't work, and the suggested Twitter support pages don't seem to contain any info on how to get Bit.ly to work (though they say they're going to). </p>
  
  <p>Here's the function I created to insert the button in my theme - any ideas on where I'm going wrong? this is used to insert the button both within the Loop and on single-post pages.</p>
  
  <pre><code>function tweet_this() {
      global $post;
      ob_start();
      $tweet = wp_get_shortlink();
      echo '&lt;script src="http://platform.twitter.com/widgets.js" type="text/javascript"&gt;&lt;/script&gt;&lt;a href="http://twitter.com/share" class="twitter-share-button" data-url="' .  $tweet . '" data-counturl="' . $tweet . '" data-count="horizontal" data-via="clietname" data-text="' . get_the_title() . '"&gt;Tweet&lt;/a&gt;';
      return ob_get_clean();  
  }
  </code></pre>
  
  <p>In case it helps, this function <em>does</em> work, except it doesn't render the tweet-count:</p>
  
  <pre><code>function tweet_this() {
      global $post;
      ob_start();
      $tweet = sprintf( __('%1$s %2$s'), $post-&gt;post_title, wp_get_shortlink() );
      echo '&lt;a class="tweethis" href="http://twitter.com/intent/tweet?text=' . urlencode( $tweet ) . ' via @clientname"&gt;Tweet this&lt;/a&gt;';
      return ob_get_clean();  
  }
  </code></pre>
  
  <p>Let me know if you need more info - and thanks in advance for any help you can throw my way!
  Michelle</p>