How to add a linkedin share button in wordpress
There are many plugins for social networks that allow you to add “Share” buttons, but most of them are not official buttons. In this article I will tell you how to add the official LinkedIn button in the WordPress.
Click here : Website Designing Services UAE
To add this button you will have to edit the site theme files. If you still do not know how to do this, then read the instructions on how to copy and paste codes in WordPress.
So go to the LinkedIn plugin page . You will be asked to select the language of your site and the button style that you want to use.
You can leave the URL field blank because the share button can automatically get the page url.
Then click on “Get Code” to copy the code of the button to share LinkedIn.
We also recommend that you read the article - How to Install Social Networking Buttons on Your Site
Copy the code of the share button to the site
Now you have the necessary code, let's add the official button to the site.
If you want to add the LinkedIn share button before recording, then use the following code. You will need to copy it and paste it into the functions.php theme file or into the site-specific plugin.
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');
1
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');
Save the changes and go to the site to see how everything looks.
If you want to add the share button under the post, then you need this 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');
1
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 add this code directly to the standard HTML widget. To do this, go to the Appearance »Widgets page and add the standard HTML widget to the sidebar.
Then add the LinkedIn button code to the standard HTML widget and save the changes.
Add the Linkedin button code to the widget
Visit the site to see how everything works.
WordPress Blog Share Linkedin Button
I hope this article helped you figure out how to add the official LinkedIn share button to a WordPress site. You might also be interested in reading about social media promotion.
For more information visit our website Digital Marketing Services in UAE