Insert shortcodes into sidebar widgets

Shortcode can be very useful, when you want to insert dynamic content into a static page or a post. WordPress is offering some internal shortcodes such as the

shortcode (which is usually rendered in the backend). By default, shortcodes can only be used in the main content of a page or a post.

Insert shortcodes using the Text or HTML widget?

One might think, that you can simply use the Text or the HTML widget. This is possible for some shortcodes, but many of them will not work. The gallery shortcode fails on both and the syntax highlighting shortcode produces incorrect code or fails completely.

The Shortcode Widget plugin

As usually always with such issues, someone else already had the same problem and found a solution. The plugin Shortcode Widget was written just for that one task. When you install and active it, you will find a new widget, quite similar to the old text widget, with only a title and a textarea. In this textarea you can paste ans shortcode you want to use in any of the widget areas.

Posted by

Bernhard is a full time web developer who likes to write WordPress plugins in his free time and is an active member of the WP Meetups in Berlin and Potsdam.

Leave a Reply

Required fields are marked *.