Want to encourage professional networking by adding the official LinkedIn share button to your WordPress site? Many social sharing plugins use unofficial buttons, but we'll show you how to implement LinkedIn's genuine widget for better reliability and branding.

As experienced WordPress developers, we've safely added these buttons to countless sites. This requires editing theme files—if you're new to code, review our guide on copying and pasting code in WordPress first.
Head to LinkedIn's share button generator. Choose your site's language and preferred button style (compact, small, etc.).
Leave the URL field empty—the button auto-detects the current page.
Click 'Get Code' to copy the embed snippet (typically script tags from platform.linkedin.com).

With the code ready, let's integrate it into your site.
To show the button before post content, add this PHP to your theme's functions.php file or a site-specific plugin:
function wpb_linkedin_share_before( $content ) {
$sharecode = '<!-- Paste your full LinkedIn share code here -->
<script type="IN/Share" data-counter="right"></script>'; // Replace with your copied code
$newcontent = $sharecode . $content;
return $newcontent;
}
add_filter( 'the_content', 'wpb_linkedin_share_before' );Save changes and refresh your site to test.

For after content, use this instead:
function wpb_linkedin_share_after( $content ) {
$sharecode = '<!-- Paste your full LinkedIn share code here -->
<script type="IN/Share" data-counter="right"></script>'; // Replace with your copied code
$newcontent = $content . $sharecode;
return $newcontent;
}
add_filter( 'the_content', 'wpb_linkedin_share_after' );You can also embed it via a Custom HTML widget: Go to Appearance » Widgets, drag in 'Custom HTML' to a sidebar, paste the LinkedIn code, and save.

Preview your site—it should now display seamlessly.

This method ensures a native, trackable share button trusted by LinkedIn. For more options, check our roundup of the best LinkedIn plugins for WordPress.
If this helped, subscribe to our WordPress YouTube Channel for video tutorials. Follow us on Twitter and Facebook too.