RBA Cash Rate: 4.35% · 1AUD = 0.67 USD · Inflation: 4.1%  
Leading Digital Marketing Experts</strong | 1300 235 433 | Aggregation Enquires Welcome | Book Appointment
Example Interest Rates: Home Loan Variable: 5.69% (5.89%*) • Home Loan Fixed: 5.39% (6.59%*) • Fixed: 5.39% (6.59%*) • Variable: 5.69% (5.89%*) • Investment IO: 5.69% (6.48%*) • Investment PI: 5.39% (6.59%*)

Add a LinkedIn Company Widget To WordPress With Shortcode

Add a LinkedIn Company Widget To WordPress With Shortcode

LinkedIn provide an online tool to generate a company profile widget for use on your website. While not commonly used, we've seen it convert well in professional circles. The code in this article will provide the necessary shortcode to embed the Widget into a WordPress post or page. There are three primary types of Widgets: an inline widget, icon with name, and icon. Our shortcode provides for all three. The code is almost identical to our article showing how to add a LinkedIn Personal Profile Widget into your WP website.

Note (November 2020): Parts of this code are broken. We'll update it when time permits.

The Result

The result of the primary profile widget is as follows. Shortcode used is [linkedcompany style="1"]. The style="1" forces the container to be centered. No attributes are defined since they're included in the shortcode function.

To align the container within text, use [linkedcompany style="1" align="right"] (or left).

The inline icon format is useful when referencing an organisation or company in text. For example, the shortcode of [linkedcompany type="icon"] returns . Hover over the icon and my personal profile container will be returned to the screen. The same inline inclusion can be used with the icon and name format. Shortcode of [linkedcompany type="iconname"] returns: . By default no styling is applied. You can force alignment and padding by simply adding style="1".

Feel free to follow our lonely little company page .

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
 Add a LinkedIn Company Widget To WordPress With Shortcode
4
 https://www.beliefmedia.com.au/linkedin-company-widget-wordpress
5
*/
6
 
7
8
 
9
  $atts = shortcode_atts(array(
10
    'profile' => '17774020',
11
    'name' => 'BeliefMedia',
12
    'type' => 'inline', /* inline, iconname, icon */
13
    'format' => 'hover', /* hover, click */
14
    'style' => false,
15
    'padding' => '8px 15px 15px 15px',
16
    'align' => false,
17
  ), $atts);
18
 
19
   /* Formatting */
20
   $css = ($atts['style'] !== false) ? ($atts['align'] !== false) ? 'float: ' . $atts['align'] . '; padding:' . $atts['padding'] : 'text-align:center; padding:' . $atts['padding'] : 'margin: 0; display: inline;';
21
 
22
   switch ($atts['type']) {
23
      case 'inline':
24
        $format = ' data-id="' . $atts['profile'] . '" data-format="inline" data-related="false"';
25
        break;
26
      case 'iconname':
27
        $format = ' data-id="' . $atts['profile'] . '" data-format="' . $atts['format'] . '" data-related="false" data-text="' . $atts['name'] . '"';
28
        break;
29
      case 'icon':
30
        $format = ' data-id="' . $atts['profile'] . '" data-format="' . $atts['format'] . '" data-related="false"';
31
        break;
32
    }
33
 
34
   $return = '<script src="//platform.linkedin.com/in.js" type="text/javascript"></script>
35
   <script type="IN/CompanyProfile" data-id="' . $atts['profile'] . '" ' . $format . '></script>';
36
 
37
 return ($atts['style'] !== false) ? '<div id="linkedin-personal-profile" style="' . $css . '">' . $return . '</div>' : $return;
38
}
39
add_shortcode('linkedcompany', 'beliefmedia_linkedin_widget_company');

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.

profile

Your LinkedIn company ID.

name

The company name to be returned in the Widget.

type

The type may be inline, iconname, or icon as demonstrated above.

format

The format determines if a hover or click is required to return the profile badge. By default we use hover. Use format="click" to alter.

style

By default no styling is applied. Use style="1" to apply styles.

padding

If styling is true, the default padding of 8px 15px 15px 15px is applied. Alter as required.

align

By default we'll center all profile badges when styling is applied. Alter as required.

Download


Title: LinkedIn Company Profile Widget in WordPress (Shortcode)
Description: Add a LinkedIn company profile widget to WordPress. Returns either the inline, icon, or icon & name widget.
  Download • Version 0.1, 819.0B, zip, Category: WordPress Shortcodes

■ ■ ■

 
Download our complimentary 650-page guide on marketing for mortgage brokers. We'll show you exactly how we generate billions in volume for our clients.
Finance Guide, Cropped Top and Bottom
  Timezone: 1 · [ CHANGE ]

RELATED READING

Like this article?

Share on Facebook
Share on Twitter
Share on Linkdin
Share on Pinterest

Leave a comment