Events Made Easy Forums How do I … Shortcode in a Widget

Tagged: ,

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #42241
    Anonymous
    Inactive

    I was just curious what your thoughts were on adding

    if (!is_admin()) add_filter(‘widget_text’, ‘do_shortcode’, SHORTCODE_PRIORITY);

    to your plugin so that people could run the shortcode from text widgets. I just added it to my theme’s functions.php file but thought it’d be useful for your users to be able to run any combination as a widget.

    RE: http://hackadelic.com/the-right-way-to-shortcodize-wordpress-widgets

    Thanks again for all you do!

    Andrew

    #45416
    Franky
    Keymaster

    Well, I could add it of course. Does this mean that people could use all the shortcodes outside pages, in widgets? An implementation example would be nice 🙂

    #45417
    Franky
    Keymaster

    Well, I won’t add this since it influences all widgets and all shortcodes and I don’t like it when my plugin changes generic behaviour. But the correct way to do it is either:

    – add the following to your functions.php:

    if (!is_admin()) add_filter('widget_text', 'do_shortcode', 11);

    – or use http://hackadelic.com/wordpress-online-tools/wordpress-tweaks-composer to create a small plugin that just activates this for you.

    #45418
    Franky
    Keymaster

    For reference: I added an option that allows this to to be set in the settings page (shortcodes in widgets)

Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘How do I …’ is closed to new topics and replies.
Scroll to Top