WordPress.org

Ready to get started?Download WordPress

Forums

CleanPrint
[resolved] Shortcode in text widget (8 posts)

  1. Scott
    Member
    Posted 1 year ago #

    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/

  2. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

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

    add_filter('widget_text', 'do_shortcode');

  3. Scott
    Member
    Posted 1 year ago #

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

  4. Scott
    Member
    Posted 1 year ago #

    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();
  5. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    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.

  6. Scott
    Member
    Posted 1 year ago #

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

  7. Arley McBlain
    Member
    Posted 9 months ago #

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

  8. Andrew Randazzo
    Member
    Posted 8 months ago #

    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?

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic