I have had a couple of questions about putting an index in the sidebar of a blog so that it is visible on every page. After a bit of testing and fiddling, it turns out that, yes indeed it is possible, and it’s actually quite easy to do. The trick is to use a sidebar widget, and here are the step-by-step instructions on how to do it:
- Log in to your blog and go to Design >> Theme Editor.
- In the Theme Files list on the right you should see an entry called something like “Theme Functions (functions.php).” Click on the link and the file will be loaded into the editor window.
- Now we have to add the following line at the top of the file to enable WordPress shortcodes in sidebar widgets:
IMPORTANT: It must be inside a PHP tag: i.e. somewhere between <?php and ?>
For example, if there is a line containing <?php at the top of the file, then add it on the following line. (Just make sure you don’t put it inside a PHP function). If the file is empty, or doesn’t have those tags, you will have to add them yourself:
- Click Update File at the bottom of the page to save your changes.
- Now go to Design >> Widgets and add a Text Widget to your sidebar.
- All you have to add to the content of the text widget is the AZIndex shortcode for your index. For example, if your AZindex index has an id of 2 (check the AZIndex admin page for the id), add the shortcode:
[az-index id=”2″ escape=”true”]
- Save your changes and go take a look at your new sidebar.
These instructions assume that you are already using a theme with a widget-enabled sidebar. If you do not see the new text widget, then it’s possible you will need to “widgetize” your theme (search for that term on Google for more information). Most popular themes are already widgetized these days.
I have tried this, and it works fine, though obviously there isn’t much room for large entries in your index. There is one site I know that is using this trick to display an index of movies in their sidebar. If you try this yourself and have any questions, just leave me a comment.