Add LinkedIn to "Share" options in news stories

Currently we have three options in our “share” list for news stories: facebook, twitter (yes, it still says twitter), and email.

I want to add LinkedIn to this list, as our readers have been moving there. But how do I make that happen?

Screenshot 2024-07-16 at 9.27.55 AM

Sure thing! From a little googling, it looks like the LinkedIn share URL syntax is

https://www.linkedin.com/sharing/share-offsite/?url={url}

So, what you can do is either manually add that to the templates where your save-and-share code is (probably more relevant to the calendar, depending on theming). Or, if you’re using the native save-and-share CMS widget, you can find this code in your client/public.config.php file:


/*
$_LW->REGISTERED_WIDGETS['saveandshare']['custom']['types']=[ // default set of save-and-share types
	'twitter'=>'<a href="http://twitter.com/intent/tweet?url={url}" target="_blank"><span class="lw-icon-twitter-square lw-icon-2x"></span></a>',
	'facebook'=>'<a href="http://www.facebook.com/sharer.php?u={url}" target="_blank"><span class="lw-icon-facebook-square lw-icon-2x"></span></a>',
	'email'=>'<a href="#" class="lw_saveandshare_email"><span class="lw-icon-envelope-o lw-icon-2x"></span></a>',
	'permalink'=>'<a href="#" class="lw_saveandshare_permalink"><span class="lw-icon-link lw-icon-2x"></span></a>',
];
*/

Adding something like

'linkedin'=>'<a href="https://www.linkedin.com/sharing/share-offsite/?url={url}" class="lw_saveandshare_linkedin">LinkedIn</a>',

into that config array should do the trick! The save and share widget just loops through that array to generate the list of links.

(PS: We did update the core Twitter share to use the “X” logo in LiveWhale 2.10.9. To mirror that change in your theming, you can peek at livewhale/theme/core/styles/frontend.css on your site and look for /* Override Twitter icon with "X" Icon */ – that might give you some CSS you could adapt into your theming to do the same with any existing custom twitter links.)

1 Like

This worked, thanks! (The sharing link. I’ve not yet tried the switch to “X.”)

1 Like