Search code examples
javascripthtmltwittersharethis

Remove or customise "via @ShareThis" when adding ShareThis button dynamically


I want to customise the "via @sharethis" part of the sharethis Twitter share button.

Everything I can find (http://blog.sharethis.com/2012/04/30/via-sharethis-is-here-2/ for example) says to add st_via="TwitterUsername" to the ShareThis span <span class="st_twitter" st_via="TwitterUsername">… however, I am dynamically adding the buttons so am unable to do this.

Here is how I create the buttons:

var defaults = {
            "service": "twitter",
            "element": …,
            … etc,
}

stWidget.addEntry(defaults);

How can I customise or remove the "via @ShareThis" part of the resulting twitter share button?


Solution

  • Boss, just add the st_via="[@theathere]" attribute to the span

    <span id='twitter' class='twitter' st_via='[@theathere]'></span>
    
    <script type='text/javascript'>
       var defaults = {
                "service": "twitter",
                "element": …,
                … etc,
       }
    
       stWidget.addEntry(defaults);
    
    </script>
    

    it will automatically add the st_via='' try it.