Australia's Leading Digital Marketing Experts. T. 1300 235 433  |  Aggregation Enquires Welcome

Example Interest Rates: Home Loan Variable: 2.54% (2.74%*) • Home Loan Fixed: 3.74% (3.8%*) • Fixed: 2.48% (2.94%*) • Variable: 2.54% (2.74%*) • Investment IO: 2.3% (3.76%*) • Investment PI: 2.04% (3.8%*)

Create A LinkedIn Company Follow Button With WordPress Shortcode

Create A LinkedIn Company Follow Button With WordPress Shortcode

This article will show you how to include a LinkedIn Company Follow Button in your WordPress website or PHP application. While the cut-and-paste code provided on the LinkedIn page is more than adequate, usage of shortcode permits you to globally alter all occurrences of the button if the need presents itself. The shortcode provides minimal styling options to ensure it's easily aligned as required on your page.

At the time of writing the LinkedIn plugin as provided by LinkedIn is poorly maintained and doesn't work nearly as well as advertised. In fact, all their plugins don't work very well at all.

Use the LinkedIn button with caution.

The Result

The result of using just [linkedinfollow] returns a follow button centered on the page and wrapped in paragraph tags. Feel free to follow us!

The shortcode of [linkedinfollow align="right" type="right"] will align the button to the right (type="right" adds the count horizontally). To align the button to the left we would use [linkedinfollow align="left"]. When aligning the button left or right we apply a default padding. In both cases the default language of English will be applied, and we'll use a button that does not include a count; additional buttons are available as described below.

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.

1
<?php 
2
/*
3
 Create A LinkedIn Company Follow Button With WordPress Shortcode Or PHP
4
 http://www.beliefmedia.com/linkedin-follow-company
5
*/
6
 
7
8
 
9
  $atts = shortcode_atts(array(
10
    'id' => '17774020',
11
    'type' => '', /* leave empty (no count), top, right */
12
    'language' => 'en_US',
13
    'align' => 0,
14
    'padding' => '8px 15px 5px 15px',
15
  ), $atts);
16
 
17
  /* Embed code */
18
  $return .= '<script src="//platform.linkedin.com/in.js" type="text/javascript"> lang: ' . $atts['language'] . '</script><script type="IN/FollowCompany" data-id="' . $atts['id'] . '"';
19
  $return .= ($atts['type'] != '') ? ' data-counter="right"></script>' : '></script>';
20
 
21
  /* Formatting */
22
  $css = ($atts['align']) ? 'float: ' . $atts['align'] . '; padding:' . $atts['padding'] : 'text-align:center;';
23
  $return = '<div style="' . $css . '">' . $return . '<div style="clear: both;"></div>
24
</div>';
25
 
26
 /* Result */
27
 return ($atts['align']) ? $return : '' . $return . '';
28
}
29
add_shortcode('linkedinfollow', 'beliefmedia_linkedin_company_follow');

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 apply.

id

This is the ID of your company page. If you're unfamiliar with the ID there are a number of ways in which to retrieve it. The easiest way is navigate to 'Me' (from your company page) and scroll down to 'Manage -> Company: YourCompany'.

type

the type relates to the type of button. Options are no count (leave empty), top (a vertical button with a count), and right (a horizontal button with a count). Note that 'right' relates to the position of the data-count - not the actual button. We display the plain button without a count by default.

language

The button language defaults to en_US. If your country is supported, use the appropriate country code.

align

By default we'll center the button in paragraph tags. To align right of left use align="right" or align="left".

padding

Padding around the button defaults to 8px 15px 5px 15px (top, right, bottom, left). Alter as required.

Considerations

  • If you choose not to use shortcode, generate your button here .
  • A number of other plugins are available. It's likely we'll build them all on a single page soon.
  • By using the LinkedIn plugins you agree to their terms of use .

Download


Title: Create A LinkedIn Company Follow Button (WP Shortcode)
Description: Create A LinkedIn Company Follow Button With WordPress Shortcode Or PHP.
  Download • Version 0.1, 744.0B, zip, Category: WordPress Shortcodes

Download our 650-page guide on Finance Marketing. We'll show you exactly how we generate Billions in volume for our clients.

  AUS Eastern Standard Time (Washington)

  Want to have a chat?
 

RELATED READING

Like this article?

Share on facebook
Share on Facebook
Share on twitter
Share on Twitter
Share on linkedin
Share on Linkdin
Share on pinterest
Share on Pinterest

Leave a comment