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
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
- The topic ‘No shortcode functionality…’ is closed to new replies.