4 Different Ways To Embed Official Twitter Buttons In Thesis For WordPress

Social networking platforms like Facebook and Twitter have diversified the options of online marketing. Used appropriately, these platforms offer you multiple opportunities for directing traffic to your website. Embedding social media icons is one of the first things to get you started with experiencing the traffic boost triggered by social networking sites. And here are 4 different ways to embed official Twitter buttons (followed by FB buttons in the upcoming post). Take your pick and sit back to analyze the impact of Twitter buttons — tweet and follow buttons.

  1. Add Official Tweet Button On Single Post Page
  2. Add Official Tweet Button On Multiple Posts Page
  3. Create Custom Tweet Button For WordPress
  4. Add Official Twitter Follow Button

Add Official Tweet Button On Single Post Page

Placing the tweet button on single post page is an effective idea for initiating social networking. Especially placing the tweet button at the beginning or end of the post has a higher chance of getting clicked (i.e. if user likes your post). Here is the code to help you do just that — place the tweet button at the end of the post. [Add the following code to custom_functions.php as usual]


function tweet_single() {
if (is_single()) { ?>
<a href="http://twitter.com/share" data-count="horizontal" data-via="twitter_username">Tweet</a>
<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
<?php }
}

add_action('thesis_hook_after_post', 'tweet_single');

Replace twitter_username with your Twitter username. The above code displays the tweet count just next to the button, you can however change the data-count value to vertical to display the count above the tweet button.

Add Official Tweet Button On Multiple Posts Page

Adding the tweet button on the multiple posts page enables you to trigger social interaction through teasers itself. It acts as the indicator for popular posts. If you choose to add the tweet button on the multiple post page (the blog page), it is a good idea to place the button before the post-content. Here is the code to place the tweet button just before the post content (treating it as the byline item). [Add the following code to custom_functions.php]


function tweet_multiple() {
if (is_home()) { ?>
<a href="http://twitter.com/share" data-count="horizontal" data-via="twitter_username">Tweet</a>
<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
<?php }
}

add_action('thesis_hook_byline_item', 'tweet_multiple');

Replace twitter_username with your Twitter username. Use is_front() in if statement if is_home() doesn’t work for you.

Create Custom Tweet Button For WordPress

If you are DIY (Do It Yourself) types and want to control the appearance and behavior of the tweet button, there is nothing better than creating your own custom tweet button. You can do so with the help of open source plugin called Custom Tweet Button For WordPress available on GitHub. Along with the ability to customize HTML and CSS, the plugin also offers you the flexibility of adding Google Campaign and event tracking.

Add Official Twitter Follow Button

Following the success of tweet button, Twitter rolled out the follow button to actively compete with multiple FB buttons. Unlike tweet button, follow button enables you to give option to the twitter users to instantly follow you on Twitter for the latest updates. Add the following code to custom_functions.php to integrate follow button.


function twitter_follow(){
if (is_home() || is_single()){ ?>
<a href="http://twitter.com/Convertica" data-show-count="false">Follow @Convertica</a>
<script src="http://platform.twitter.com/widgets.js" type="text/javascript"></script>
<?php }
}

add_action('thesis_hook_before_sidebars', 'twitter_follow');

Replace Convertica with your Twitter username.

Note: You can use Twitter wizard to generate the code for buttons.

Posted In:

Support & Maintenance, Code Snippets

Comment on 4 Different Ways To Embed Official Twitter Buttons In Thesis For WordPress

Your email address will not be published. Required fields are marked *