Title: No shortcode functionality&#8230;
Last modified: August 21, 2016

---

# No shortcode functionality…

 *  Resolved [WriterDan](https://wordpress.org/support/users/writerdan/)
 * (@writerdan)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/no-shortcode-functionality/)
 * Hey, I’m a developer that was asked to implement this plugin onto a site and 
   was surprised that there was no shortcode functionality present in the plugin.
   Doing so allows users to put the custom buttons where they want them to go instead
   of being limited to the top and/or bottom of a page.
 * So, I added a shortcode functionality to the plugin. Took me about 15 minutes.
   Thought I’d share:
 *     ```
       function st_customized_buttons_shortcode() {
       	global $post;
   
       	$widgetTag= stripslashes(get_option('st_widget'));
       	$publisher_id= get_option('st_pubid');
       	if(empty($publisher_id)) {
       		$toShow="";
       		// Re-generate new random publisher key
       		$publisher_id=trim(makePkey());
       	} else $toShow= $widgetTag;
       	$content= $toShow;
       	$services= get_option('st_services');
       	if(empty($services)) $services="facebook,twitter,linkedin,email,sharethis,fblike,plusone,pinterest";
       	$tags= stripslashes(get_option('st_tags'));
       	if(empty($tags)) {
       		foreach(explode(',', $services) as $svc) {
       			$tags.= "<span class='st_".$svc."_large' st_title='".get_the_title($post->ID)."' st_url='".get_permalink($post->ID)."' displayText='".$svc."'></span>";
       		}
       	} else {
       		$tagsArray= explode('<?php the_title(); ?>', $tags);
       		$myTitle= get_the_title($post->ID);
       		$tags= implode($myTitle, $tagsArray);
       		$tagsArray= explode('<?php the_permalink(); ?>', $tags);
       		$myPermalink= get_permalink($post->ID);
       		$tags= implode($myPermalink, $tagsArray);
       	}
       	$content.= $tags;
       	return $content;
       }
       add_shortcode('st_buttons', 'st_customized_buttons_shortcode');
       ```
   
 * I’m sure you’ll find some happy users by implementing this code, or at least 
   something else akin to it. I just put this code at the bottom of the main plugin
   file and it worked like a charm.
 * Cheers
 * [https://wordpress.org/plugins/share-this/](https://wordpress.org/plugins/share-this/)

Viewing 8 replies - 1 through 8 (of 8 total)

 *  [sharethissupport](https://wordpress.org/support/users/sharethissupport/)
 * (@sharethissupport)
 * [11 years, 10 months ago](https://wordpress.org/support/topic/no-shortcode-functionality/#post-4939951)
 * @ WriterDan
    Thanks for suggesting the “short code” method.
 *  [jonathanr89](https://wordpress.org/support/users/jonathanr89/)
 * (@jonathanr89)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/no-shortcode-functionality/#post-4940074)
 * [@writerdan](https://wordpress.org/support/users/writerdan/)
 * Thanks for the post. I am having trouble with the code. I inserted it into the
   main sharethis file but I don’t know what to use as the short code to display
   the button on my page.
 * If you could help me.
 * Thanks
 *  Thread Starter [WriterDan](https://wordpress.org/support/users/writerdan/)
 * (@writerdan)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/no-shortcode-functionality/#post-4940076)
 * The shortcode is called st_buttons (as defined by the add_shortcode function 
   call at the end of the code block). So to get the buttons to render, place this
   into your content box:
 * `[st_buttons]`
 * Works out great for us.
 * Note: If you directly alter the plugin file by using this code, you’ll have to
   be careful when you upgrade the plugin (and re-insert the code in the new plugin
   file) or you will lose the shortcode functionality.
 * Dan
 *  [jonathanr89](https://wordpress.org/support/users/jonathanr89/)
 * (@jonathanr89)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/no-shortcode-functionality/#post-4940077)
 * Thanks Dan.
 * Inserted the shortcode. Not displaying, although I have being having the problem
   with my site showing effects of changes I make a couple hours after I actually
   make the changes. So I will wait and hopefully it will take effect. Tried it 
   on a test domain I’m using. [http://draft.recycling-centers.org/10must-seedocumentariesforentrepreneurs/](http://draft.recycling-centers.org/10must-seedocumentariesforentrepreneurs/)
 *  Thread Starter [WriterDan](https://wordpress.org/support/users/writerdan/)
 * (@writerdan)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/no-shortcode-functionality/#post-4940078)
 * Looking at that page, I’m not sure which of the buttons are supposed to be there
   and which are not. Right now I’m seeing a Share This button near the top of the
   content block and another one near the bottom. Right now, if I had to guess, 
   I’d say that the one at the top of the page is showing up because of the shortcode,
   and the one near the bottom is showing up because of the plugin settings (mainly
   because I see the same button at the bottom of other pages on your site, but 
   not on the top).
 * To use the shortcode I’ve supplied, you do still need to define which buttons
   you want to see rendered on the page within the plugin’s settings page. My shortcode
   only renders the buttons that you’ve defined in the locations where you put it.
 * If you run into the situation where a text version of the shortcode is showing,
   then the theme you’re using is probably showing the content without running the
   WordPress shortcode parsing functions. (Not sure if you’ll need that info or 
   not).
 * The issue with effects of changes showing up hours after you make them makes 
   it sound like some kind of caching is going on. Whether that’s happening within
   WordPress (with a plugin like W3 Total Cache or Super Cache), or if it’s something
   that your hosting company is doing is beyond me at this point. Typically, if 
   there’s no caching going on, changes you make should translate to the rendered
   page immediately. If you don’t have an active caching plugin on this site, or
   caching functionality built into your theme, I’d call your hosting company and
   see what they can tell you.
 * Best of luck.
 *  [jonathanr89](https://wordpress.org/support/users/jonathanr89/)
 * (@jonathanr89)
 * [11 years, 8 months ago](https://wordpress.org/support/topic/no-shortcode-functionality/#post-4940079)
 * Thanks so much for the help. I found where I was messing up. I was inserting 
   the code right at the end of the main sharethis file. I needed to move it above
   the first “add_action” commands at the bottom of the file.
 * Thanks man. Don’t know why this isn’t a standard bit of functionality for the
   sharethis plugin.
 * Be safe
 * Jonathan
 *  [Nilang Patel](https://wordpress.org/support/users/nilang-patel/)
 * (@nilang-patel)
 * [11 years ago](https://wordpress.org/support/topic/no-shortcode-functionality/#post-4940123)
 * Thanks Buddy,
 * You have save almost 1 hour of mine. heads off !!
 *  [_rg_](https://wordpress.org/support/users/arriba/)
 * (@arriba)
 * [11 years ago](https://wordpress.org/support/topic/no-shortcode-functionality/#post-4940124)
 * You save my day!!! thanks for code, woks perefect.

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘No shortcode functionality…’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/share-this_b9babb.svg)
 * [ShareThis: Free Sharing Buttons and Tools](https://wordpress.org/plugins/share-this/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/share-this/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/share-this/)
 * [Active Topics](https://wordpress.org/support/plugin/share-this/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/share-this/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/share-this/reviews/)

## Tags

 * [shortcode](https://wordpress.org/support/topic-tag/shortcode/)

 * 8 replies
 * 5 participants
 * Last reply from: [_rg_](https://wordpress.org/support/users/arriba/)
 * Last activity: [11 years ago](https://wordpress.org/support/topic/no-shortcode-functionality/#post-4940124)
 * Status: resolved