Adding a Tweet Button to WordPress

Tweet ThisAfter I completed the redesign for bavotasan.com, I was looking for some social media links to add to the bottom of my single post pages. The main two buttons I wanted were a Facebook Like button and a Tweet This type button. The Facebook Like button was easy to find and install, but it took me a while to find the official Twitter button, since I never really looked at the footer links on Twitter.
If you click on the Goodies link, you will see three options: Tweet Button, Widgets and Buttons. All three are useful, but for my purposes, the Tweet Button was all I needed. You will probably have to sign in to Twitter before you can check out the Goodies.

Tweet Button
Twitter's Tweet Button options page

There are many options you can tweak to get the Tweet Button working the way you want. I left everything on the defaults and ended up with this bit of code:


Including this code anywhere in your single.php file will work. If you wanted to include it on a category page or your index page, you would need to make a few changes.


Include that within the loop and it will include the post specific URL for each button. You can even take it one step further if you’re using shortlinks:


The last code snippet is the one I use on this site. You can see the Tweet Button directly below.

Fat Twitter Bird image by Qiun, provided by Pixmac, and modified slightly by c.bavota.

Share this:

Email
Facebook
Twitter
Pinterest
Pocket

Premium Themes for WordPress

Looking for an easy-to-use Premium Theme for WordPress? Check out Themes by bavotasan.com and have your site up and running in no time.

Use this WordPress website builder to build powerful websites in no time for your or your clients.

WordPress Hosting

WP Engine – designed from the ground-up to support and enhance the workflow of web designers.

Bluehost – providing quality web hosting solutions since 1996.

About the author

Picture of Luke Perrie

Luke Perrie