max max - 1 year ago 128
Javascript Question

Use a custom URL with ShareThis social share plugin

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


<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>


<script type="text/javascript" src=""></script>
<script type="text/javascript">stLight.options({publisher: "ur-448a73fe-e6c1-f7a5-f0a5-3912c860fc9e"});</script>

Answer Source

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='' displayText='Facebook'></span>