L
L
ligisayan2016-02-04 10:26:30
PHP
ligisayan, 2016-02-04 10:26:30

Is it possible to add buttons to share on social networks on the site without plugins and scripts?

Hello! I have a site on wordpress, I want to add buttons to share in social networks (VKontakte, Facebook, Instagram) in a certain place without using plugins or scripts. Or is it impossible to do without connecting scripts? Tell me the best option

<header id="header">
  <a title="Поделиться ВКонтакте" class="btn btn-social-icon btn-vk" href="https://vk.com/share.php?url=<?php the_permalink(); ?>" target="_blank" rel="nofollow">
    <span class="fa fa-vk"></span>
  </a>
  <a title="Поделиться в Facebook" class="btn btn-social-icon btn-facebook" href="http://facebook.com/sharer.php?url=<?php the_permalink(); ?>" target="_blank" rel="nofollow">
    <span class="fa fa-facebook"></span>
  </a>
  <a title="Поделиться в Instagram" class="btn btn-social-icon btn-instagram" href="http://instagram.com/ссылка на группу" target="_blank" rel="nofollow">
    <span class="fa fa-instagram"></span>
  </a>
</header>

ps found for facebook and contact, link to group for instagram

Answer the question

In order to leave comments, you need to log in

4 answer(s)
A
Andrey, 2016-02-04
@ligisayan

Of course available. Everything is possible if you want!
And you just take it and parse the URL, everything is easy there.
Here's what I did for someone:

function decodsocial($text){

   $conv = array (
   "%D0%B0", "%D0%B1", "%D0%B2", "%D0%B3", "%D0%B4", "%D0%B5", "%D1%91", "%D0%B6", "%D0%B7",
   "%D0%B8", "%D0%B9", "%D0%BA", "%D0%BB", "%D0%BC", "%D0%BD", "%D0%BE", "%D0%BF", "%D1%80",
   "%D1%81", "%D1%82", "%D1%83", "%D1%84", "%D1%85", "%D1%86", "%D1%87", "%D1%88", "%D1%89",
   "%D1%8A", "%D1%8B", "%D1%8C", "%D1%8D", "%D1%8E", "%D1%8F",
   "%D0%90", "%D0%91", "%D0%92", "%D0%93", "%D0%94", "%D0%95", "%D0%81", "%D0%96", "%D0%97",
   "%D0%98", "%D0%99", "%D0%9A", "%D0%9B", "%D0%9C", "%D0%9D", "%D0%9E", "%D0%9F", "%D0%A0",
   "%D0%A1", "%D0%A2", "%D0%A3", "%D0%A4", "%D0%A5", "%D0%A6", "%D0%A7", "%D0%A8", "%D0%A9",
   "%D0%AA", "%D0%AB", "%D0%AC", "%D0%AD", "%D0%AE", "%D0%AF"
   );
$ssil = urlencode("http://".$_SERVER['HTTP_HOST']."/?r=$user");
$titles = decodsocial("Партнёрская программа ".$_SERVER['HTTP_HOST']."");
$mytitle= "Поделится своей рефссылкой в";

<div class="social_ico">	
<a id="jj" title="<?=$mytitle;?> Livjournal" href="http://www.livejournal.com/update.bml?subject=<?=$titles;?>&event=<?=$ssil;?>" target="_blank"></a>	
<a id="vk" title="<?=$mytitle;?> Vk" href="http://vk.com/share.php?url=<?=$ssil;?>&title=<?=$titles;?>&description=&image=" target="_blank"></a>
<a id="tw" title="<?=$mytitle;?> Twitter" href="http://twitter.com/intent/tweet?status=<?=$titles;?> <?=$ssil;?>" target="_blank"></a>	
<a id="mail" title="<?=$mytitle;?> Mail" href="http://connect.mail.ru/share?url=<?=$ssil;?>&title=<?=$titles;?>&description=&imageurl=" target="_blank"></a>
<a id="fb" title="<?=$mytitle;?> Facebook" href="http://www.facebook.com/sharer/sharer.php?src=sp&u=<?=$ssil;?>&t==<?=$titles;?>&description&picture" target="_blank"></a>
<a id="ok" title="<?=$mytitle;?> Odnoklassniki" href="http://www.odnoklassniki.ru/dk?st.cmd=addShare&st._surl=<?=$ssil;?>" target="_blank"></a>					
<a id="wm" title="<?=$mytitle;?> Events.Webmoney" href="//events.webmoney.ru/sharer.aspx?url=<?=$ssil;?>" target="_blank"></a></div>

Here are the styles:
.social_ico a{width: 16px;height: 16px;background: url(../images/prk.jpg) 100% 0 no-repeat;display: inline-block;margin: 0 2px;border-radius:3px}
.social_ico #jj {background-position: 0px 0;}.social_ico #fb {background-position: 0 -35px;}.social_ico #tw {background-position: 0 -18px;}.social_ico #mail {background-position: 0 -52px;}
.social_ico #ok {background-position: 0 -69px;}.social_ico #vk {background-position: 0 -86px;}.social_ico

here is a sprite image d1998971ec244eb7ac2042ddd5bf7291.jpg
in the same way and add a picture, see what attribute they have in the url that is responsible for the picture and substitute your variable for it, in which the desired picture will be indicated.
Ps function decodesocial may not be needed if you are using utf-8. I used it to transfer "Affiliate program" from the site with encoding 1251.=(

V
Violentov, 2016-02-04
@violentov

Basic social share buttons

X
xmoonlight, 2016-02-04
@xmoonlight

precosts.com - SOC CODE BUTTONS from the source code of the page - copy from here...

O
Oleg Krasnov, 2016-02-04
@OKrasnov

https://tech.yandex.ru/share/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question