How to Enable Shortcodes in Widgets for WordPress
Shortcodes make life easier for any WordPress blogger. I can easily list subpages, add post meta elements, and even query posts using shortcodes. You can do as much in your widgets too, you just need a quick fix to enable shortcodes in your widgets.
To enable shortcodes in your widgets you can use the PHP code below:
add_filter('widget_text', 'do_shortcode');
Just add this code to functions.php
in your theme folder. This way you can easily use your theme/plugin shortcodes on your widgets. For example, if you are using my Adsense Widget, you could easily add a square ad to your sidebar using:
[adsense type="small-square"]
Or you could list subpages of a page using:
[subpages exceptme="true" childof="253"]
I hope you liked this quick tutorial. Enjoy.