Shortcodes and Sidebars

Can I use a shortcode or an auto-embedded URL in a sidebar
widget?
Ordinarily, WordPress doesn’t check sidebar text for autoembed
URLs and shortcodes. For example, if you add a Text
widget (page 166) and put a Flickr URL in it, that URL will appear
in your sidebar as ordinary text, not as an image preview.
If you use WordPress.com, you need to live with this restriction.
If you’re on a self-hosted site, there’s a fairly easy workaround,
but you need to be familiar with theme editing, an advanced
topic explored in Part 4.
The solution is to add two commands (shown on page 500) to
a file called functions.php. These commands tell WordPress to
process widget text in the same way that it processes the text
in a post or page—in other words, to check for auto-embedded
URLs and shortcodes. Using this technique, you can put tiny
videos, slideshows, galleries, and more in your sidebar without
relying on a specialized widget.

Shortcodes and Sidebars