I am trying to add custom tweet button to my website and all is well but it is not shortening the URL. I am using URL query string instead of javascript. Is that the case?
<a class="btn btn-tweet" target="_blank" href="https://twitter.com/share?text='.$title.'&url='.$url.'&via='.$user.'&wrap_links=true">Twitter</a>
I have read some API document and saying above 19 characters twitter shorten url itself. Just wonder why it is not converting with this.
I am also having trouble to open in popup instead of new window. Does this all possible without adding any separate javascript code but directly inline in anchor tag?
Links shared on Twitter, including links shared in Direct Messages, will automatically be processed and shortened to an http://t.co link. Learn how to shorten links. Please note: anyone with a t.co shortened link will be able to navigate to the destination URL.
How Do I Use Twitter Link Shortener? You use t.co whenever you post Twitter links. Simply copy and paste a URL into a tweet, reply, or DM, and t.co will automatically convert it into a link of 23 characters or less. This helps keep your tweets under the character limit so you can add more to your post.
You can shorten a URL by using an URL shortener website, which will shrink your URL for free. Popular link shorteners on the internet include Bitly, TinyURL, and Rebrandly. You'll need a premium account on these sites to unlock the full range of link customization options.
The Bitly platform allows you to connect to your Twitter account to share links right in your Tweets.
I was hung up on this and realized I was trying to shorten "http://localhost:5000/blog/url" which t.co is unable to do.
Change to a real, non-localhost URL and it worked fine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With