How to Add Twitter Share Button to Every WordPress Post

Social network share widgets are essential to add to your blog or business website so readers can share and promote your content. It’s important to position the widget correctly so readers can easily access them while reading. We recommended positioning the widget on  the top or bottom of a page. 

We recommend adding Facebook, Reddit, Pinterest and Twitter shareable buttons as these are the most popular networks.  Twitter has more than 300 millions active users so it’s effective in getting your content out there  and getting you more followers. In this article we’re going to show you how to easily add a Twitter / Retweet button to your website.

How to add a Twitter share button to your WordPress Blog without a plugin

  1. Go to https://publish.twitter.com/ (no Twitter account required)
  2. Select Twitter Buttons
  3. Select either the Twitter share button, follow, mention, hashtag or message button
  4. Copy the button link
  5. Insert into single.php loop within your WordPress theme

As shown below we embed our Twitter button at the top of the loop so it’s shown above the content. 

single.php - found within your WordPress theme directory.

<?php get_header(); ?>

<div id="content">
  <?php while ( have_posts() ) : the_post(); ?>
     <a href="https://twitter.com/share?ref_src=twsrc%5Etfw" class="twitter-share-button" data-show-count="false">Tweet</a><script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
     <?php get_template_part( 'content', 'single' ); ?>
     <?php comments_template( '', true ); ?>
  <?php endwhile;?>
</div>

<?php get_sidebar(); ?>

How to add a Twitter share buttons to your WordPress Blog with a plugin

Manually editing your WordPress theme requires some technical knowledge and there is a possibility when the theme is updated you’ll lose your button.  So if this seems a little techie we recommend adding a widget plugin to manage your social widgets. There are plenty of social widgets choose from but we personally recommend AddToAny for it’s ease of setup.

  1. Login to your WordPress dashboard
  2. Navigate to Plugins -> Add new
  3. Search for AddToAny Share Buttons 
  4. Install and activate the plugin
  5. Once activated share buttons will show on your posts
  6. To change plugin settings navigate to Setting -> AddToAny

Now your content is ready to be sharable across the web. Time to start planning your next viral campaign!