I’ve often had the problem where a plugin author gives you a shortcode to use their plugin – which is great if you’re placing it in a post of page. But what if you want to use it in the sidebar? Well, shortcodes don’t work there by default. But this simple code that you can add into your functions.php file can change all that:
Find a place between the tags which is not in the middle one of the functions that may already be in the file (the very top or bottom of the file are both good places) and add the following line:
add_filter('widget_text', 'do_shortcode');
Simple and easy! Thanks to Reklamezonen for this great tip!
Oct 3, 2013 update
For template files, the code is a little different:
Just place your shortcode where it says your shortcode here. But- a special note about this code: if you are using double quotes within the shortcode, you must change the double quotes you see here to single quotes. If you don’t, this code will not work.
Good luck!
Leave a Reply