How to execute shortcodes in WordPress text widgets
Updated On May 23, 2015 October 27, 2012 -Written ByWe have already seen quick and easy way to execute PHP code in widgets. We can also execute and run any shortcode within default text widgets. WordPress starters are usually not familiar with shortcode concept. On the face, it look difficult but in fact it is very easy to understand and implement. You can check the example of shortcode usage in post for showing adsense ads anywhere within posts that uses shortcode concept to implement specific functionality.
1. Manual code to execute shortcodes in text widgets
Just add following code in functions.php file. From there on, all shortcodes used in text widgets will execute just fine.
add_filter( 'widget_text', 'do_shortcode' );
2. “Use Shortcodes in Sidebar Widgets” plugin
Use Shortcodes in Sidebar Widgets plugins add the functionality of running shortcodes in text widgets without need to add any manual code. It is very light plugin (just one line as seen in first section above). For user who do not like to mess around with manual code, this is an alternative method to execute shortcodes in text widgets on WordPress website.