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
1 2 3 |
<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+"&url="+page_url; break; case "linkedin": url= "https://www.linkedin.com/shareArticle?mini=true&url="+page_url+ "&title="+text+ "&summary="+text+ "&source=LinkedIn"; break; case "googleplus": url="https://plus.google.com/share?url="+page_url+"&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
1 2 3 4 5 6 7 8 9 10 11 12 |
<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="<?php bloginfo('template_directory'); ?>/images/facebook_16.png" alt="" /></a> <a><img src="<?php bloginfo('template_directory'); ?>/images/googleplus_16.png" alt="" /></a> <a><img src="<?php bloginfo('template_directory'); ?>/images/linkedin_16.png" alt="" /></a> <a><img src="<?php bloginfo('template_directory'); ?>/images/twitter_16.png" alt="" /></a> </span> |