Skip to content

Instantly share code, notes, and snippets.

@heyjoecampbell
Last active May 7, 2016 08:34
Show Gist options
  • Save heyjoecampbell/a3181beec8116ccd4fee to your computer and use it in GitHub Desktop.
Save heyjoecampbell/a3181beec8116ccd4fee to your computer and use it in GitHub Desktop.
AddThis Non-JavaScript Social Share (@heyjoecampbell)
// Produce and size pop-up
<script>
function PopupCenter(pageURL, title,w,h) {
var left = (screen.width/2)-(w/2);
var top = (screen.height/2)-(h/2);
var targetWin = window.open (pageURL, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left);
}
</script>
<a rel="nofollow" href="javascript:void(0);" onclick="PopupCenter('http://api.addthis.com/oexchange/0.8/forward/facebook/offer?url=<?php echo $this->item->absoluteURL; ?>&amp;pubid=ra-XXXXXX', 'FacebookShare',650,400);" title="Facebook Share">Facebook</a>
<a rel="nofollow" href="javascript:void(0);" onclick="PopupCenter('http://api.addthis.com/oexchange/0.8/forward/twitter/offer?url=<?php echo $this->item->absoluteURL; ?>&amp;title=<?php echo $this->item->title; ?> - &amp;pubid=ra-XXXXXX', 'Tweet',550,450);" title="Tweet">Twitter</a>
<a rel="nofollow" href="javascript:void(0);" onclick="PopupCenter('http://pinterest.com/pin/create/bookmarklet/?media=<?php echo $this->item->image; ?>&amp;url=<?php echo $this->item->absoluteURL; ?>&amp;is_video=false&amp;description=<?php echo $this->item->title; ?> - <?php echo $this->item->introtext; ?>', 'PinIt',750,350);" title="Pin It">Pinterest</a>
<a rel="nofollow" href="javascript:void(0);" onclick="PopupCenter('http://api.addthis.com/oexchange/0.8/forward/linkedin/offer?url=<?php echo $this->item->absoluteURL; ?>&amp;pubid=ra-XXXXXX', 'LinkedinShare',600,450);" title="Share on Linkedin">LinkedIn</a>
<a rel="nofollow" href="javascript:void(0);" onclick="PopupCenter('http://api.addthis.com/oexchange/0.8/forward/google_plusone_share/offer?url=<?php echo $this->item->absoluteURL; ?>&amp;pubid=ra-XXXXXX', 'PlusOne',550,500);" title="Google Plus One">Google+</a>
<a rel="nofollow" href="javascript:void(0);" onclick="PopupCenter('http://api.addthis.com/oexchange/0.8/forward/tumblr/offer?url=<?php echo $this->item->absoluteURL; ?>&amp;pubid=ra-XXXXXX', 'TumblrPost',600,550);" title="Post to Tumblr">Tumblr</a>
[/code]
// Change "XXXXXX" to your AddThis ID. Change/style each social media text name to your desire.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment