view my SEO resume
Las Vegas SEO & Marketing Director

Twitter’s New Tweet Button is TWEETACULAR: A How To Guide!

How to Customize the Twitter Tweet Button for WordPress Blogs

Twitter recently came out with a button similar to Facebook’s “Like button” (move over Facebook).

The Tweet Button is “a small widget which allows users to easily share your website with their followers.” (Twitter dev page)

A user clicks on the Tweet Button and is prompted with a login to enter Twitter login info. If a user is new to Twitter, he/she can create an account, The Share box will appear with information on the item to be tweeted about. This usually will include a short subject, link to the article/site and the twitter account associated with the article or site.

The tweet is submitted and users are offered a chance to follow the twitter account of the person who owns the website or whom created the article.

Twitter is offering a number of ways to you can add the Tweet Button to your website. The most direct way is just copying and pasting some javascript code into your html:

<script src="http://platform.twitter.com/widgets.js" type="text/javascript"></script>
<a href="http://twitter.com/share" class="twitter-share-button">Tweet</a>

You can also use an iframe or you can build your own.

Here’s an example for building the Twitter Tweet Button into your website, specifically your PHP based WordPress blog.

You’ll need to open up two php files:

single.php
index.php

Both of these files should be the php files in your template folder, not in the main WordPress folder.

You’ll have to locate the ideal place for your your Tweet Button. In the index.php page locate the <?php if ( have_posts() ) : ?>. Your code should be placed within the loop that follows. Here’s sample code:

&lt;a href="http://twitter.com/share" class="twitter-share-button" 
data-url="&lt;?php the_permalink(); ?&gt;" data-via="steffanlv" data-text="&lt;?
php the_title(); ?&gt;" data-related="steffan haeberle: web design & seo consultant" 
data-count="horizontal"&gt;Tweet&lt;/a>&lt;script type="text/javascript" 
src="http://platform.twitter.com/widgets.js"&gt;&lt;/script&gt;

The code above contains the standard Tweet Button as well as five other variables to complete the Tweet Button functionality.

  • data-url=”<?php the_permalink(); ?>”
  • data-via=”steffanlv”
  • data-text=”<?php the_title(); ?>”
  • data-related=”steffan haeberle: web design & seo consultant”
  • data-count=”horizontal”

data-url=”<?php the_permalink(); ?>” – “the_permalink” will use the textual link to the article you will use.

data-via=”steffanlv” – “data-via” is the name of the Twitter account associated with the article or website.

data-text=”<?php the_title(); ?> – “data-text” is the textual title you want to use.

data-related=”steffan haeberle: web design & seo consultant” – “data-related” is the title of the Twitter account that the user will see when he/she is prompted to Follow the originator of the website or article.

data-count=”horizontal” – “Vertical” or “Horizontal” is the format the Tweet Button count will show, either above the button or beside it.

Here’s a screenshot layout for each variable:

tweet button wordpress

Feel free to copy and paste the code, change the variables to your like and integrate it into your own WordPress site. Got any questions or comments feel free to leave them below or contact Steffan.

Leave a Reply

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

I design with an eye towards the aesthetic and I approach every project by asking "what's the best way to attract the most qualified visitors?" Every project I complete follows web standards and best practices for ensuring eventual top rankings for relevant keyword terms. Ask me about my las vegas seo, boca raton seo and los angeles seo services.
read more

Latest from Flickr

Inquiries

Steffan Haeberle
9047 W Torino Ave
Las Vegas, NV 89148
Twitter: steffanlv
Facebook: steffan.haeberle
LinkedIn: steffanh

Latest Video