title: linkedin share button wordpress grab url of current page
body: <p>Hi there I have been trying to make my own share button for LinkedIn, for my wordpress site since my theme doesn't support it and I can't seem to get the developer option in the LinkedIn help to work for me.</p>
  
  <p>I have created this from what I have found on the net and my very limited knowledge of PHP and code. I have gotta to the point where I can create a window that lets you sign in to LinkedIn to post content, I just can't grab the URL from the address bar, so it will share that specific blog post.</p>
  
  <p>I have been putting this code at the bottom of single.php in my WP child theme.</p>
  
  <p>All I need to do is figure out how to grab the url from the address bar and insert it into the posting box.</p>
  
  <p>Thank you. Here is my code.</p>
  
  <pre><code>&lt;?php
  $Url = (@$_SERVER["HTTPS"] == "on") ? "https://" : "http://";
  $Url .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
  ?&gt;
  
  &lt;div class="linkedInButton"&gt;&lt;a class="linkedIn" href="javascript:void(0)" onclick="window.open( 'http://www.linkedin.com/shareArticle?mini=true&amp;amp;url=&lt;?php echo $Url; ?&gt;', 'sharer', 'toolbar=0, status=0, width=626, height=436');return false;" title="Linkedin" &gt;&lt;button class="linkedInButton"&gt;&lt;span class="character"&gt;&lt;img class="linkedInShare" src="uploads/2018/09/linkedin-logo.png"&gt;Share on LinkedIn&lt;/span&gt;&lt;/button&gt;&lt;/a&gt;&lt;/div&gt;
  </code></pre>