Title: Shortcode in text widget
Last modified: August 20, 2016

---

# Shortcode in text widget

 *  Resolved [Scott](https://wordpress.org/support/users/sdc05/)
 * (@sdc05)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/shortcode-in-text-widget-1/)
 * Is there a add filter that can be put in the hooks so that the shortcode could
   be dropped in a sidebar widget?
 * [http://wordpress.org/extend/plugins/cleanprint-lt/](http://wordpress.org/extend/plugins/cleanprint-lt/)

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

 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/shortcode-in-text-widget-1/#post-3199717)
 * add this line for instance into functions.php of your theme;
 * `add_filter('widget_text', 'do_shortcode');`
 *  Thread Starter [Scott](https://wordpress.org/support/users/sdc05/)
 * (@sdc05)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/shortcode-in-text-widget-1/#post-3199719)
 * Sometimes I hate how simple an answer is. Gotta love it.
 *  Thread Starter [Scott](https://wordpress.org/support/users/sdc05/)
 * (@sdc05)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/shortcode-in-text-widget-1/#post-3199726)
 * Hmmm. I spoke too soon. that didn’t work. I followed the shortcode install directions.
   and then added the above code because I add the shortcode to the widget. It just
   displays as text. When adding this code to my fuctions.php file does it need 
   to be wrapped in a function?
 *     ```
       add_shortcode('cleanprint_print_button', 'get_cleanprint_print_button');
           function get_cleanprint_print_button() {
              if( function_exists('cleanprint_add_print_button') ){
                 return cleanprint_add_print_button();
       ```
   
 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/shortcode-in-text-widget-1/#post-3199732)
 * have you got all the curly closing brackets with the code for functions.php?
   (
   the code in your last reply is missing some of them):
 *     ```
       add_shortcode('cleanprint_print_button', 'get_cleanprint_print_button');
           function get_cleanprint_print_button() {
              if( function_exists('cleanprint_add_print_button') ){
                 return cleanprint_add_print_button();
              }
           }
       ```
   
 * the code just needs to be added into functions.php as it is.
 *  Thread Starter [Scott](https://wordpress.org/support/users/sdc05/)
 * (@sdc05)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/shortcode-in-text-widget-1/#post-3199735)
 * arrg. Sorry. I’m so not a developer. Thanks.
 *  [Arley McBlain](https://wordpress.org/support/users/arleym/)
 * (@arleym)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/shortcode-in-text-widget-1/#post-3199828)
 * `add_filter('widget_text', 'do_shortcode');` Worked wonderfully for me! Thanks!
 *  [Andrew Randazzo](https://wordpress.org/support/users/theologian88/)
 * (@theologian88)
 * [12 years, 6 months ago](https://wordpress.org/support/topic/shortcode-in-text-widget-1/#post-3199829)
 * The snippet works, but it causes all my widgets to want to align horizontally,
   and it changes the font and size of my other widget titles. Do you have a snippet
   I could use to fix this?

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

The topic ‘Shortcode in text widget’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/cleanprint-lt_3c3c3c.svg)
 * [CleanPrint](https://wordpress.org/plugins/cleanprint-lt/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/cleanprint-lt/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/cleanprint-lt/)
 * [Active Topics](https://wordpress.org/support/plugin/cleanprint-lt/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/cleanprint-lt/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/cleanprint-lt/reviews/)

 * 7 replies
 * 4 participants
 * Last reply from: [Andrew Randazzo](https://wordpress.org/support/users/theologian88/)
 * Last activity: [12 years, 6 months ago](https://wordpress.org/support/topic/shortcode-in-text-widget-1/#post-3199829)
 * Status: resolved