Hosting Tutorial & Guide

How to Insert LinkedIn Share Button in WordPress

updated on Dec 21, 2017
How to Insert LinkedIn Share Button in WordPress We have already shared a lot of social media marketing tips for the most popular network options, such as Facebook, Twitter and Google Plus. This time, we will talk about another one - LinkedIn. To put it simply, this is a business oriented social media platform that can operate on websites and the mobile devices. It was founded in 2002 and launched in 2003. Since now, it has more than 500 million members covering around 200 different countries, among which over 105 million members are already active. So, looking to add it to your website? In the following, we have come out the simple tutorial about how to insert LinkedIn share button in WordPress.

Here, you need to know that LinkedIn is mainly used for the professional networking, especially for some employers to post the current jobs and job hunters to showcase their personal CV. Note that most traffic and revenue of LinkedIn come from the selling of access to information about the members to the reliable recruiters and professionals. In the most cases, the adding of the LinkedIn share button is suitable for you when you are in the following situations.
  • Your personal website shows your expertise and knowledge and you are looking for a job.
  • Your website is a business one and your company needs some professional staffs.

Insert LinkedIn Share Button in WordPress

The adding process is quite simple and can be finished by most of newbies. However, it requires you to edit the theme file of your WordPress site. Don't worry. Just follow us for the right steps.

Get the LinkedIn Code for Share Button

To begin with, you need to visit this page for LinkedIn share plugin. Here, you need to choose the language and determine the count mode between the vertical option and the horizontal option. Surely, you can decide to show no count.

LinkedIn Share Plugin Page

Here, you can leave the URL field blank. After all, the share button can detect and get the page URL automatically.

After that, the code of this button can appear automatically in the box, along with a preview section.

Embed the Code into Your Website

There are three occasions you can consider.

Firstly, you can use the text widget and paste the code into it to show the share button in the sidebar. Or, you can show the share button before your post content. If so, you should edit your theme function.php file with the following code.

function wpb_linkedin_share_before($content) { 
// Share code copied from LinkedIn
$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');

If you want to display the button after the content, you should insert the below lines of code.

function wpb_linkedin_share_after($content) { 
// Share code copied from LinkedIn 
$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');

Better Customize the Display

If you want to customize the button display freely, you can consider the use of the AddToAny Share Buttons plugin. With it, you can decide the icon type by choosing the pixels, background and foreground, choose the exact LinkedIn share button among around 150 options, determine the appearance of the universal button, choose the button placement and select the floating style.

AddToAny Share Buttons Settings