How to Use Shortcodes in your WordPress Sidebar Widgets

Shortcodes make it easier to increase the efficiency in text areas when writing. The most frequent questions we face on this issue revolves around adding shortcodes to sidebar widgets. Often when writing, you may presume that shortcodes will function by default, due to the fact that there is a text widget in your sidebar. However, any text written is taken through some parent filters, which don’t permit execution of shortcodes. Therefore, you will end up seeing the shortcode itself rather than the final result. In this article, we shall illustrate to you various ways of using shortcodes sidebar widget.

Option 1: Adding Shortcode-Enabled Text Widget

We shall use a WordPress plugin, as this option is easy for those who don’t want to manually add the code.

You need to first download the Shortcode Widget plugin and activate it (see our guide on installing the plugin for more information).

After activation, click on Appearance in the Widgets page. You will find a shortcode widget among the available widgets.

Just add it to a sidebar widget, then add it to the text box and click save.

This shortcode widget is similar to WordPress default text widget, only that shortcodes can be added.

Option 2: Enabling Shortcodes in the Text Widget

Then only add the code below to a site-specific plugin or to functions php on your theme.

 add_filter('widget_text','do_shortcode');

How to use shortcode in your wordpress widgetThen, visit Appearance in Widgets page, to the sidebar, add text widget and paste the shortcode in text box and save the settings.

Go to your website to confirm the shortcode is working in text widgets.

Leave a Reply

Your email address will not be published. Required fields are marked *