Adding a Shortcode to a Sidebar Widget

Login to your blog’s administration pages and go to the Theme Editor — i.e. select Design >> Theme Editor from the admin menu.
Look in the list of Template Files on the right of the page for one called Theme Functions or functions.php and click on it to load it into the editor.
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');
Click on the Update File button to save the modified template.

That’s all you need to do. Now any shortcodes you add to a sidebar widget will be correctly processed by the plugin they belong to. The easiest way to test this is as follows:

Go to Design >> Widgets using the administration menu.
Find the Text widget in the list on the left, and click its Add button.
Click on the new widget’s Edit link, and enter a title for the widget and then add the shortcode below it.
Click the Change button, then click the Save Changes button (easy to forget) and then go to the front page of your blog to see your new shortcode-enabled widget.

(Note: your theme must support widgets for the new text widget to show up. If it doesn’t then you will have to “widgetize” your theme or find another theme that does support widgets.)

Source :


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s