How to add the official LinkedIn share button in WordPress

Make it easy for your readers to share content you publish to your website and you’ll quickly build your audience. Alongside popular social networks such as Twitter and Facebook, you can also add an official LinkedIn share button that can be used to promote your content.

The first step is to visit the LinkedIn Share Plugin Generator page.

LinkedIn Developer site

Enter your website’s URL and choose its language from the adjacent dropdown menu. Now click the Get Code button and you should see a code snippet appear on the page. You now need to copy and paste that code into your site theme to create the LinkedIn share button. You can easily do this by creating a sidebar widget.

Log into the WordPress admin dashboard and select Appearance > Widgets. Create a new text widget and simply paste the code into the text box. Save the widget, then head to the front-end of the site to test.

WordPress widget

If you would like the button to appear on above or below your posts, log into the HostPapa dashboard and visit My cPanel. Head to Files > cPanel File Manager to view the files and folders stored on your server.

cPanel

Navigate to your WordPress folder then enter the wp-content > themes folder. Open the folder for your current theme, then select functions.php and click Edit in the command bar.

cPanel File Manager

Scroll to the bottom of the page. If you wish the button to appear before your post content, enter the following code (don’t forget to include the LinkedIn code snippet where referenced).

function linkedin_share_before($content) {
$sharecode .= '// Your LinkedIn share button code goes here';
$newcontent = $sharecode .$content;
return $newcontent;
}
add_filter('the_content', 'linkedin_share_before');

functions.php

Alternatively, to display the button after your post content, enter this code:

function linkedin_share_after($content) {
$sharecode .= '// Your LinkedIn share button code goes here';
$newcontent = $content . $sharecode;
return $newcontent;
}
add_filter('the_content', 'linkedin_share_after');

functions.php

If you notice any problems or if you need any help, please open a new support ticket from your HostPapa Dashboard. More details on how to open a support ticket can be found here.

Was this article helpful?

  • Was this article helpful ?

  • yes   no

Related Articles

Leave A Comment?