Displaying WordPress shortcode in widget

The other day I struggled getting a WordPress plugin “WP Customer Reviews” to display properly in a sidebar widget. You are supposed to enter a shortcode where you want the reviews displayed. Unfortunately wordpress and most of the themes that come with it do not natively support shortcode in widgets. To get this functionality you must add the following code in the theme file functions.php:

add_filter('widget_text', 'do_shortcode');

You must also make sure you enter the shortcode in the plain text / html widget. I tried it in a widget with php parsing capability and that did not work at all (for obvious reasons in hindsight).

Comments are closed.