Title: [Plugin: AddThis] How to Create a Shortcode
Last modified: August 20, 2016

---

# [Plugin: AddThis] How to Create a Shortcode

 *  [htmlfx](https://wordpress.org/support/users/htmlfx/)
 * (@htmlfx)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-addthis-how-to-create-a-shortcode/)
 * Hello All,
    I wanted the output of this plugin to appear in a sidebar via a shortcode.
 * So I added:
    add_shortcode( ‘sharethis_button’, ‘sharethis_button’ );
 * Which allows you to use [sharethis_button] as a short code anywhere.
 * This worked, but it caused an issue due to the fact that the function that creates
   the ShareThis content used “echo” vs “return”. The issue was the code was being
   sent to the browser earlier then the the widget so the code was in the wrong 
   place.
 * I was unable to overwrite this function in the functions.php file so I modify
   the plugin (I know I am not supposed to do this). The change I made was in sharethis.
   php line 214.
    function sharethis_button() { return st_makeEntries(); //changed
   echo to return on this line }
 * My questions is two fold… am I breaking anything in the plugin with this change,
   and if not, you add this change to the next version so others can use this shortcode
   and not have to tweak the plugin to make it work.
 * Let me know,
    Dave
 * [http://wordpress.org/extend/plugins/addthis/](http://wordpress.org/extend/plugins/addthis/)

The topic ‘[Plugin: AddThis] How to Create a Shortcode’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/addthis_70cced.svg)
 * [WordPress Share Buttons Plugin – AddThis](https://wordpress.org/plugins/addthis/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/addthis/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/addthis/)
 * [Active Topics](https://wordpress.org/support/plugin/addthis/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/addthis/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/addthis/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [htmlfx](https://wordpress.org/support/users/htmlfx/)
 * Last activity: [14 years, 3 months ago](https://wordpress.org/support/topic/plugin-addthis-how-to-create-a-shortcode/)
 * Status: not resolved