Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
This is a very simple code snippet to add social button as sortcode in wordpress
<?php
// paste this section in your functions.php
function j_add_this_social() {
return '<div class="addthis_toolbox addthis_default_style ">
<a class="addthis_button_facebook_like" fb:like:layout="button_count"></a>
<a class="addthis_button_tweet"></a>
<a class="addthis_button_pinterest_pinit" pi:pinit:layout="horizontal"></a>
<a class="addthis_counter addthis_pill_style"></a>
</div>
<script type="text/javascript">var addthis_config = {"data_track_addressbar":true};</script>
<script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-4e6ddb0b0891cd1c"></script>';
}
add_shortcode('j_add_this_social', 'j_add_this_social');
//end addthis section
// use this sortcode in your page/post/sidebar
// [j_add_this_social]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment