Social share button is very useful to share post on social networking websites like facebook, twitter and google plus. this will boost visitor traffic to your website from these websites. there is lots of social share plugins available but problem is these will increase page load time by loading unnecessary css and js files. that will also cause SEO issue in future for your website. so you should keep simple for social sharing button to avoid long page load time. in this post, I will show you how to add social sharing button without any plugin.

How to add social share button?

Here is the code you need to add on your theme  functions.php file

function dartthemes_post_view_count_display($content){

    // Check the post type you want to count view is_singular('post')
      // get the current post id
      $post_id = get_the_ID();
      $post_link = get_permalink($post_id);
      $post_title = get_the_title($post_id);

      $count_html= '';
      $count_html.='<div class="social-share">';
      $count_html.=' <link rel="stylesheet" type="text/css" href="">';
      $count_html.= '<a href="'.$post_link.'"><i class="fa fa-facebook-square" aria-hidden="true"></i></a>';
      $count_html.= '<a href="'.$post_link.'&text='.$post_title.'"><i class="fa fa-twitter-square" aria-hidden="true"></i></a>';
      $count_html.= '<a href="'.$post_link.'"><i class="fa fa-twitter-square" aria-hidden="true"></i></a>';

            .social-share a {
              display: inline-block;
              margin: 0 3px;
            .social-share a .fa {
              font-size: 30px;

      return $content.$count_html;
      return $content;


We have used font awesome icons for social buttons, you can use background image as button icons if you don’t like font awesome. here is the output will be looked like.

social share button