
Twitter will be officially releasing a Tweet button later this month, but it appears as if the codebase is already in place for developers to start using if they know how. Twitter plans to offer both a Javascript API for creating the tweet button as well as an iframe version. While the documentation is not [...]
Twitter will be officially releasing a Tweet button later this month, but it appears as if the codebase is already in place for developers to start using if they know how. Twitter plans to offer both a Javascript API for creating the tweet button as well as an iframe version.
While the documentation is not quite released for either the iframe version is the easiest to figure out, and that’s what we’ll use and show you how to integrate into a WordPress theme.
There are several parameters you can pass including, url (if it’s different than the current page), via (to set a tweet via “XXX”) and related, which allows you to specify a profile that a user will have the option to follow after posting their tweet.
All urls will be shortened using Twitter’s URL shortening service, so that may be one reason why you want to use the url parameter of the iframe call.
Let’s get to the code below, this will work on your current website even if it’s using WordPress or some other content management system as this bit of code will read the current URL and pass that to Twitter’s service. This is the chunk of code that is powering the Tweet Button on this blog.
Now the above code will provide a Tweet Button that will use the current URL using Twitter’s URL shortening service. If for some reason you find that wasn’t working correctly for you, you could change the code to the following (assuming it’s a WordPress site)
Leave Your Response