Shortcodes and Sidebars

Can I use a shortcode or an auto-embedded URL in a sidebar
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, 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

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