Hi there I have been having trouble with a LinkedIn custom share button. My theme didn’t seem to provide one and I like this theme so wanted to create my own.
I have gotten as far as getting a window to open that signs you in to LinkedIn and takes you to post about something, I just can’t get the code to work so it also inputs the URL of the WordPress single post you are currently visiting.
Here is my code, this is what I am putting at the bottom of my single_post.php, thank you.
<?php
$Url = (@$_SERVER["HTTPS"] == "on") ? "https://" : "http://";
$Url .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
?>
<div class="linkedInButton"><a class="linkedIn"href="javascript:void(0)"onclick="window.open(
'http://www.linkedin.com/shareArticle?mini=true&url=<?php echo $Url;
?>', 'sharer', 'toolbar=0, status=0, width=626, height=436');return false;
" title="Linkedin"><button class="linkedInButton">
<span class="character"><img class="linkedInShare"
src="uploads/2018/09/linkedin-logo.png">Share on LinkedIn</span></button></a></div>