How to Create an Official Tweet Button

The simplest way to get the official tweet button is to log into your Twitter account and go to http://twitter.com/goodies/tweetbutton and choose the options that you want.


Note under #1: "Button" "Tweet text" "URL" and "Language" are all options of where to click to further customize the button.


You copy the code that is generated and put it on your static site where you want it.


I didn't use the above method to get the button on our WordPress-based site http://www.millermosaicllc.com — rather I created a tweet button myself.


I used insights from Twitter's official Tweet Button documentation and WPBeginner's How to Add Twitter's Official Tweet Button in WordPress.


First, let's look at what my tweet button outputs. Click on the tweet button at the bottom of our most recent post at http://www.millermosaicllc.com/blog


The text that starts off the tweet is the title of a post (on a page it would be the title of the page). Next is the URL of the post (or page) as an official Twitter shortened-URL. Next it says "via @MillerMosaicLLC"


I use "via @username" on Twitter in a specific way. If I'm visiting someone's site and I see a blog post (or page) I really want to share and the person is on Twitter, I will put on the tweet "via @usernameofblogpostwriter"


I customized my code because I didn't want a tweet counter and I didn't want to recommend a person follow me. Below is the code I use:



Tweet

Instead of manually inserting the tweet button on every page and post, you need to tell WordPress to auto-generate the button. Here's where it can get a little tricky.


If you use a WordPress theme that uses hooks (a hook is a pre-established position in a site's layout where custom functions can be added), it's much easier. The theme's hooks will give you a list of where you can insert the tweet button.


If there's a hook plugin for your theme, you install it and just drop the above code where you want it. (I tested Thesis Openhook for Thesis and Genesis Simple Hooks for Genesis and both worked)


If you prefer not to use hook plugins, below is what I did for our site which uses Thesis. (Place below in custom_functions.php):


function custom_after_post () {
?>

Tweet
<?php
}
add_action ('thesis_hook_after_post', 'custom_after_post');

If your theme doesn't use hooks, as WPBeginner says: "This code [the first code in my post] can be installed in single.php, loop.php, index.php, page.php, category.php, and archive.php as long as it is placed within the post loop."


Please note that if you have HTTPS for Twitter enabled, the tweet button does not appear and you only see a clickable link that says "Tweet." When you click on the link, it might only output the URL of the post (or page) as an official Twitter shortened-URL. Then you must fill in the post or page information.


© 2011 Miller Mosaic, LLC


Yael K. Miller (@MillerMosaicLLC on Twitter) is the co-founder of the social media marketing company Miller Mosaic. Download the company's free report "5 Tips for Staying Top of Mind With Your Prospective Target Markets" at www.millermosaicllc.com/los-angeles-s...


 •  0 comments  •  flag
Share on Twitter
Published on February 13, 2011 12:06
No comments have been added yet.


Phyllis Zimbler Miller Author

Phyllis Zimbler Miller
This blog shares book-related information including news about Amazon opportunities for authors.
Follow Phyllis Zimbler Miller's blog with rss.