Are you thinking of using a plugin that uses shortcodes? (Shortcodes are tags in square brackets like [bubbles id=”10″] that some plugins use to embed content into posts and pages.) But what if you want to be able to use a shortcode in your blog’s sidebar instead of your post or page?
Normally, shortcodes are ignored if you try putting them in a sidebar Text widget — all that’s displayed is the shortcode itself. But there is a one-line tweak you can add to your theme that will enable you to put any shortcode you like in a sidebar Text widget. Here are some steps to get you started:
- Login to your blog’s administration pages and go to the Theme Editor — i.e. select Appearance > 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 <?php and ?> 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:
- Click on the Update File button to save the modified file.
Assuming you didn’t mess anything up, go to your Appearance > Widgets page. Drag a Text widget to the sidebar area. Add your shortcode into the widget and save. The shortcode will now be displayed in the sidebar of your blog.