Home Blog Add a LinkedIn Share Button To WordPress With Shortcode

Add a LinkedIn Share Button To WordPress With Shortcode


This quick article will show you how to include a LinkedIn ‘Share Widget’ into your WordPress post or page with shortcode. The small snippet of JavaScript the function returns is minimal, but shortcode is still the most efficient means of returning the same snippet of code or text in multiple locations. If LinkedIn were to alter their widget code, as they often do, you would only correct a single function to alter every occurrence of the widget code on your website.

The Result

The shortcode of [linkedinshare] returns the following:

If you were to include the widget wrapped into paragraph text, use [linkedinshare align="right"]. The result:

When aligning left or right you may also alter the padding around the widget. The share page and language may also be altered (as described below).

Shortcode Function

Copy and paste the WordPress function into your theme's functions.php file or, if you sensibly have one installed, your custom functions plugin.

If you require shortcode to work in a sidebar widget, you'll have to enable the functionality with a filter. If you're using our custom functions plugin, you'll have that feature enabled by default.

Shortcode Attributes

The following shortcode attributes are available:


Alter the language to any other that’s supported by LinkedIn.


To share any URL other than the current page, reference the URL in your shortcode. Example: [linkedinshare url="http://www.beliefmedia.com/"]


If the widget is aligned left or right you may alter the padding as required. If left as false, we’ll simply center it.


Alignment can be left or right. The widget will center by default.


Title: Add a LinkedIn Share Button To WordPress With Shortcode
Description: Add a LinkedIn share button To WordPress with shortcode. Attributes to alter the URL & styling.
Download: Shortcode (V0.1) | Plugin Page

■ ■ ■

Interested in WordPress and Web Design? Subscribe to our list and we'll send you subscriber-only tools and plugins

Short URL for this post: http://shor.tt/Jog


Please enter your comment!
Please enter your name here