Custom Share Button for WordPress Custom Theme

Add share button without any type of plugin or thirdparty app on wordpress, Just paste given code where you want to show share button.

How to add share button on theme

  • Open active theme’s folder then open header.php file and paste given code between <head> ….. </head>.
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
  • Then paste share button where you want to show

Facebook share button-

<a href="http://www.facebook.com/sharer.php?u=<?php the_permalink() ?>" target="_blank" title="Facebook"> <i class="fa fa-facebook-square" style="font-size:26px;color: #483D8B"></i></a>

Twitter share button-

<a href="https://twitter.com/share?url=<?php the_permalink() ?>" target="_blank" title="Twitter"> <i class="fa fa-twitter-square" style="font-size:26px;color: #1E90FF"></i></a>

Whatsapp share button-

<a href="whatsapp://send?text=<?php the_permalink() ?>" target="_blank" title="WhatsApp">
<i class="fa fa-whatsapp" style="font-size:26px; color: green;"></i></a>

Facebook Messenger share button-

<a href="fb-messenger://share/?link=<?php the_permalink() ?>" target="_blank" title="fb-messenger"><i class='fab fa-facebook-messenger' style='font-size:26px;color:red'></i></a>

Telegram share button-

<a href="tg://msg_url?url=<?php the_permalink() ?>" target="_blank" title="Telegram"><i class="fa fa-telegram" style="font-size:26px;color: #1E90FF"></i></a>

Linked share button-

<a href="https://www.linkedin.com/sharing/share-offsite/?url<?php the_permalink() ?>" target="_blank" title="Linkedin"><i class="fa fa-linkedin-square" style="font-size:26px;color: #4682B4"></i></a>

Email share button-

<a href="mailto:?body=<?php the_permalink() ?>" target="_blank" title="E-mail"><i class="fa fa-envelope-square" style="font-size:26px; color:red"></i></a>

if you want to share button for blogger website – click here.