Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
882 views
in Q2A Core by
I want to install the code on the page matter where I insert it?
 
<script type="text/javascript">(function() {
  if (window.pluso)if (typeof window.pluso.start == "function") return;
  if (window.ifpluso==undefined) { window.ifpluso = 1;
    var d = document, s = d.createElement('script'), g = 'getElementsByTagName';
    s.type = 'text/javascript'; s.charset='UTF-8'; s.async = true;
    s.src = ('https:' == window.location.protocol ? 'https' : 'http')  + '://share.pluso.ru/pluso-like.js';
    var h=d[g]('body')[0];
    h.appendChild(s);
  }})();</script>
<div class="pluso" data-background="transparent" data-options="medium,round,line,horizontal,nocounter,theme=04" data-services="vkontakte,odnoklassniki,facebook,google,twitter"></div>
Q2A version: 1.6.3

1 Answer

+1 vote
by

You could :

1) Download the q2a-widget-anywhere plugin from github and install it on your q2a website

2) On your q2a website go to Admin>Layout> "Custom HTML at top of every page" and post the script (1st part of your snippet)

<script type="text/javascript">(function() {
  if (window.pluso)if (typeof window.pluso.start == "function") return;
  if (window.ifpluso==undefined) { window.ifpluso = 1;
    var d = document, s = d.createElement('script'), g = 'getElementsByTagName';
    s.type = 'text/javascript'; s.charset='UTF-8'; s.async = true;
    s.src = ('https:' == window.location.protocol ? 'https' : 'http')  + '://share.pluso.ru/pluso-like.js';
    var h=d[g]('body')[0];
    h.appendChild(s);
  }})();</script>

and save.

3) Go to  Admin>Plugins>q2a-widget-anywhere>options, click on "Add New Widget", insert these values :

Title = Sharing Buttons
Position = After Question text
"Show widget in this position on all available pages" checked
Content (HTML) ) (2nd part of your snippet) :
<div class="pluso" data-background="transparent" data-options="medium,round,line,horizontal,nocounter,theme=04" data-services="vkontakte,odnoklassniki,facebook,google,twitter"></div>
and save.
Now you should see the sharing buttons under the questions.
by
Thank you very much, but when you always share the home page, and I need to share with the page issue? specify what address in section <div class = "pluso" data-background = "transparent" data-options = "medium, round, line, horizontal, nocounter, theme = 04 "data-services =" vkontakte, odnoklassniki, facebook, google, twitter "data-url =" http://site.ru/index.php "> </ div>
by
Sorry, I've not understood your comment.....
In my example the buttons are displayed only under the question text ---> share a question.
What do you want to share ?
by
Optimization update :

In step 3), you could check :
"Show widget in this position on the following pages" --> "Question pages"
instead of checking :
"Show widget in this position on all available pages"

so to have the html loaded only where it's needed, that is only on the question pages (in the example above it's loaded also in the pages where it's not needed)
...