Social media share code in popup window without any third party provider.html

You can find lots of social media share widget,plugins from other websites like https://www.addthis.com/ , www.sharethis.com but if you want to use without any third party provider and open in popup window ,follow below tutorial

Step 1:

Put below code inside closing of ‘head’ tag

<script type="text/javascript">// <![CDATA[
// Popup window code function social_media_popup(social_media,page_url,text) { var url; switch (social_media){ case "facebook": url="https://www.facebook.com/sharer/sharer.php?u="+page_url; break; case "twitter": url="https://twitter.com/intent/tweet?text="+text+"&#038;url="+page_url; break; case "linkedin": url= "https://www.linkedin.com/shareArticle?mini=true&#038;url="+page_url+ "&#038;title="+text+ "&#038;summary="+text+ "&#038;source=LinkedIn"; break; case "googleplus": url="https://plus.google.com/share?url="+page_url+"&#038;hl=en-US"; break; } popupWindow = window.open( url,'popUpWindow','height=500,width=600,left=250,top=100,resizable=yes,scrollbars=yes,toolbar=yes,menubar=no,location=no,directories=no,status=yes' ) }
// ]]></script>

Step 2:

Put below code where you want to appear your social media icons

<span class="social_media_icons">
				<!--?php $current_page_url="http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; $text_to_share=get_post_field("post_content",$post_id); $text_to_share=str_replace("'"," ",$text_to_share); ?-->

<a><img src="&lt;?php bloginfo('template_directory'); ?&gt;/images/facebook_16.png" alt="" /></a>

<a><img src="&lt;?php bloginfo('template_directory'); ?&gt;/images/googleplus_16.png" alt="" /></a>

<a><img src="&lt;?php bloginfo('template_directory'); ?&gt;/images/linkedin_16.png" alt="" /></a>

<a><img src="&lt;?php bloginfo('template_directory'); ?&gt;/images/twitter_16.png" alt="" /></a>

</span>

Online Web Development Training,Video Tutorials