How To Add The Official LinkedIn Share Button To WordPress Blogs

Social Media is one of the most important parts of any website. It is the great way to spread your blogs to the world. With the social icons, you can easily share your latest updates. Just like twitter retweet button, facebook like button, Business-oriented social network LinkedIn has launched their own share button. These buttons are a great way to share the blogs on social media. In this article, we will show how we can add Official LinkedIn Share Button To WordPress Blogs.

Linkedin provides service for an educated business client for social interaction. You can easily manage your profession information and Create and seek opportunity for the project including information collecting and file sharing. You can also specify your other important details on Linkedin.
 

Adding Official LinkedIn Share Button in WordPress

First, you have to visit LinkedIn Share Plugin page and get the code from here.

You will be asked to enter your domain name, language and button style. Then click on Get Code button to get the code for your website as shown in the screenshot:
 

 

Display Official LinkedIn Share Button in post and pages

You have to paste this code into your theme’s functions.php file.You can also paste this code into any site-specific plugin. For more details read our previous article how to create a custom plugin in WordPress.

You can add the share button before the content of the post by pasting the following code in functions.php file:
 

function wpb_linkedin_share_before($content) { 
// Share code you copied from LinkedIn goes here
$sharecode .= '<script src="//platform.linkedin.com/in.js" type="text/javascript"> lang: en_US</script>
<script type="IN/Share" data-counter="top"></script>'; 
$newcontent = $sharecode .$content; 
return $newcontent; 
} 
add_filter('the_content', 'wpb_linkedin_share_before');

 
To add the share button after the post content, paste the following code:
 

function wpb_linkedin_share_after($content) { 
$sharecode .= '<script src="//platform.linkedin.com/in.js" type="text/javascript"> lang: en_US</script>
<script type="IN/Share" data-counter="top"></script>'; 
$newcontent = $content . $sharecode; 
return $newcontent; 
} 
add_filter('the_content', 'wpb_linkedin_share_after');

 

You can also paste the script code which you get in starting of the tutorial, in widget to display the share button in widgets.

We hope you like this article. If you have any query, you can ask in below comment box.

You can also check How to Add a Retweet Button on Your Blog.

Spread the love

Kapil Garg

Kapil Garg has 7 years of experience in building professional websites. He is a leading web developer, web designer and Google adwords certified partner. His passion is to designed and developed most impressive websites.

Leave a Reply

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