Twitter is one of the largest social media platforms. This tutorial shows you how to add Twitter button to WordPress website and allow your visitors to share content from your website to Twitter. We will be adding the tweet button on every post in WordPress.
Table of Contents
What you’ll need
Before you begin this guide you’ll need the following:
Step 1 — Opening your post page template
Navigate to your WordPress Admin Area and open up Editor under Appearance:
After that, open up a template file for single posts. It is called single.php:
Step 2 — Updating post template file
In your single.php file find a line
<?php get_template_part( 'content', 'single' ); ?> and after it add the following code:
XXXXXX is your Twitter username:
Don’t forget to save changes by clicking Update File.
Open up any post on your WordPress website and you will see a Twitter button at the end:
Now you know how to add a Twitter button to WordPress and it lets your visitors share your content. Just like a button can be added on posts, it can also be added on pages or in sidebar.