There might be times when it's necessary to count the number of times a URL has been shared to LinkedIn. Used by website owners as a type of vanity stamp, and used by marketers as a basic means of determining popularity, the shortcode below will retrieve the count, cache the result for a defined period, then return the share count to your page.
Twitter carelessly removed their own (unofficial) count API in 2015, and Google recently disabled their own +1 feature (and associated count), so it may be only a matter of time before LinkedIn follows precedent and does the same.
The Result
Given that the LinkedIn count for our BeliefMedia articles is low (the site is new), we'll use the count for the same article on the now-retired Internoetics. The shortcode of [linkedinshares url="http://www.internoetics.com/2012/05/16/co ... gleplus/"]
(snipped ). The result: 12.
WordPress Shortcode
Copy and paste the WordPress function into your theme's functions.php
file or, if you sensibly have one installed, your custom functions plugin. You may optionally download and install our plugin from the bottom of of the page.
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
url
n
n="0"
or hardcode into the function to disable.cache
PHP Function
Used outside of WordPress, the following function may be used. Usage of Simple Cache is required.
Download
Title: LinkedIn Share Count in WordPress or PHP (WP Plugin)
Description: Count the number of LinkedIn shares with WordPress shortcode or PHP.
Download • Version 0.2, 1.5K, zip, Category: WordPress Plugins (General)
WordPress Shortcodes, (707.0B) PHP Code & Snippets, (687.0B)