Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use a custom URL with ShareThis social share plugin

Tags:

javascript

php

i would like to know how to use a custom URL with ShareThis social share plugin. for a example i have a post summery on my index.php page taht is linking to my-post.php so what i want to do is to make users share my-post.php from my index page.

here is the code from sharethis.com

Buttons:

<span class='st_facebook_hcount' displayText='Facebook'></span>
<span class='st_twitter_hcount' displayText='Tweet'></span>
<span class='st_googleplus_hcount' displayText='Google +'></span>
<span class='st_pinterest_hcount' displayText='Pinterest'></span>

JS:

<script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script>
<script type="text/javascript">stLight.options({publisher: "ur-448a73fe-e6c1-f7a5-f0a5-3912c860fc9e"});</script>
like image 957
max Avatar asked Sep 28 '12 19:09

max


People also ask

What is ShareThis com content management plugins?

It offers free website tools and plugins for online content creators. ShareThis collects data on user behavior, and provides this to advertisers and technology companies for ad targeting, analytics, and customer acquisition purposes.

What is the share this app?

SHAREit is a cross platform sharing tool which requires no mobile data. It's over 200 times faster than Bluetooth. Share the photos, videos, audios and files of any formats with your friends at any time on your phone or computer. No need for a Wi-Fi network or a mobile data plan.


2 Answers

You can append a st_url property to each of your span tags which will control the URL that is shared.

<span class='st_facebook_hcount' st_url='http://my.custom.com/url' displayText='Facebook'></span>

Source: https://support.sharethis.com/hc/en-us/articles/218441477-How-to-Customize-which-URL-Text-and-IMG-to-Share

like image 75
Mike Avatar answered Oct 06 '22 08:10

Mike


Just use st_url attribute like this:

<span class="st_sharethis" st_url="http://www.yoursite.com/innerpage.php" st_title="inner page title" displayText="ShareThis"></span>
like image 42
Develoger Avatar answered Oct 06 '22 07:10

Develoger