Shortcodes make life easier for a 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 shortcode functions in your widgets you can use the code below:
[php title=”functions.php”]add_filter(‘widget_text’, ‘do_shortcode’);
Add this code to
functions.php in your theme folder. This way you can easily use your theme/plugin based shortcodes on your sidebar. For example if you are using my adsense widget, you could easily add a square ad to your sidebar using:
Or you could list subpages of a page using:
[subpages exceptme="true" childof="253"]