WordPress.org

Support

Support » Plugins and Hacks » CleanPrint » [Resolved] Shortcode in text widget

[Resolved] Shortcode in text widget

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

    @alchymyth

    Forum Moderator

    add this line for instance into functions.php of your theme;

    add_filter('widget_text', 'do_shortcode');

    Sometimes I hate how simple an answer is. Gotta love it.

    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

    @alchymyth

    Forum Moderator

    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.

    arrg. Sorry. I’m so not a developer. Thanks.

    add_filter('widget_text', 'do_shortcode'); Worked wonderfully for me! Thanks!

    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 ‘[Resolved] Shortcode in text widget’ is closed to new replies.
Skip to toolbar