How to add social media button

How to Add Social Media Button in WordPress Using Code

How to add social media button share to articles is a question many blog and website authors ask. Why adding social media shares is important, because of the positive impact that social media users have on your website traffic.

You need to note, the way we will discuss is a way other than adding plugins or widgets. That is using html code that will be installed in the wordpress theme editor.

Adding social media buttons using code is more beneficial because it doesn’t use plugins that make your site load heavier. But you have to be careful because the wordpress theme editor can have errors. You need to back up the files before executing.

Benefits of Adding Social Media Button

Adding social media buttons to your website or digital content can offer several benefits, including:

1. Increased Social Engagement

Social media buttons make it easy for visitors to share your content with their social networks, which can lead to more likes, shares, and comments. This helps increase your content’s reach and engagement.

2. Enhanced Brand Visibility

When your content is shared on social media, it can expose your brand to a broader audience. This increased visibility can help attract new followers and customers.

3. Improved Website Traffic

Social media shares can drive traffic back to your website. This can be particularly valuable if you have a blog or e-commerce site, as it can lead to increased page views and potentially more sales.

4. Boosted SEO

Social signals, such as likes and shares, can indirectly impact your website’s search engine rankings. While they are not a direct ranking factor, the increased visibility and traffic from social media can positively influence your SEO efforts.

5. User Convenience

Social media buttons make it convenient for users to connect with your brand on their preferred social platforms. This can lead to more followers and a stronger online community.

6. Credibility and Trust

Having visible social media buttons on your website can convey credibility and trustworthiness. It shows that your brand is active on social media and encourages users to explore your presence there.

7. Audience Insights

Social media platforms often provide valuable insights and analytics about your audience’s behavior. By encouraging social sharing, you can gather more data about what content resonates with your audience.

8. Networking Opportunities

Social media buttons can facilitate networking and collaboration with other businesses, influencers, or individuals in your industry. It’s easier for people to connect with you when they can easily find your social profiles.

9. Easier Communication

Social media buttons can also serve as a direct communication channel with your audience. Users can click on these buttons to send messages or inquiries via social messaging platforms.

10. Cross-Promotion

If you have multiple social media profiles, adding buttons for each platform allows you to cross-promote your content and engage with your audience across various channels.

11. Mobile Friendliness

With the increasing use of mobile devices, social media buttons make it easy for mobile users to share and engage with your content.

13. Tracking and Analytics:

You can track the performance of social media buttons using analytics tools, which can help you understand which social networks are driving the most engagement and traffic.

14. User-Generated Content

Encouraging social sharing can lead to user-generated content, such as reviews, testimonials, and user-created posts, which can be valuable for your brand’s reputation.

How to Add Social Media Button Code in WordPress Articles

1. Logo

Download the logo, You can search for logs on Google search, or sites like pixabay, pexels, or freepict. Please Download in square size. Convert it to a 20x20px pixel scale between that. Or change it with paint on windows

2. Copy Code

Copy the html Code below, Copy and paste the code in notepad so that it’s easy to edit the url in the code.

3. Upload Logo

Upload the logo you downloaded and convert it to 20x20px. Copy the image url into the code <img src section. This is to display the image beside the share description. If you are an image designer, you can of course adjust the size and image file more properly.

4. WordPress Theme Editor

Login admin, look for Appearance, select Theme File Editor, on the right look for (single.php) expand the section to content-single.php. Paste on the part you want.

<div class="social-share">
     <a href="<?php echo esc_url(get_permalink()); ?>" target="_blank">
         <img src="" alt="Share on Facebook">Share on Facebook
     <a href="<?php echo esc_url(get_permalink()); ?>&text=<?php echo esc_attr(get_the_title()); ?>" target="_blank">
         <img src="" alt="Share on Twitter">Share on Twitter
     <a href="<?php echo esc_url(get_permalink()); ?>" target="_blank">
         <img src="" alt="Share on LinkedIn">Share on Linkedin
     <!-- Add  -->

If you put the code below the entry_bottom will appear after the article. Likewise entry_top which will appear above the article. Then make sure the code and url match your site. Update Files.

5. Trial and Evaluation

See your article, is there any change. If nothing changes, try clearing the cache on your browser and website. If it still doesn’t appear, there is something wrong with the placement in the theme editor. It should be noted that each theme has a different position and structure. But still inside (single.php).


That’s about How to add social media buttons. Adding social media buttons to your website or digital content is an effective way to increase your website engagement, brand visibility and traffic.

By providing easy sharing options on social media platforms, you can leverage a variety of benefits, including increasing engagement with your audience, driving website traffic, improving SEO, and building trust and credibility.

Add social media buttons using useful code to speed up website loading without having to install a plugin. But keep in mind, you have to be careful when editing in the WordPress theme editor, it’s better to back up the file first.

Also Read : 19 Ways to Optimize On-Page SEO on a Website

Leave a Comment

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