How to Use Shortcodes in Sidebar Widgets

What are shortcodes? Shortcodes are small codes that help you add additional features to the WordPress content area. Thanks to shortcodes, you can easily add tables, contact forms, and more to your post content. In addition, shortcodes are also used…

How to Use Shortcodes In Sidebar Widgets

What are shortcodes?

Shortcodes are small codes that help you add additional features to the WordPress content area. Thanks to shortcodes, you can easily add tables, contact forms, and more to your post content. In addition, shortcodes are also used in widgets, so you can easily add dynamic items to sidebars. In today’s blog, we would like to show you how to use shortcodes in the sidebar widgets of your site. Let’s get started now!

How to use shortcodes in WordPress sidebar widgets

Using the Shortcode widget

The first way we want to show you is using the Shortcode widget to add a shortcode to your sidebar.

First of all, on the admin dashboard, let’s go to Appearance -> Widgets. After that, you just need to add a new widget by clicking on the + icon at the top of the screen.

Now, scroll down to choose the Shortcode icon in the Widgets section. Then, all you need to do is add the shortcode you want to the text edit area. Finally, don’t forget to click the Update button to save all your settings.

use shortcodes in sidebar widgets 1

Using the Text widget

If you don’t want to use the shortcode widget to add the shortcode to the WordPress sidebar, you can also use Classic Widget to do that easily and effectively.

Firstly, if you haven’t installed this plugin, you need to access Plugins -> Add New. Then, type its name in the search bar and click the Install now -> Activate button.

use shortcodes in sidebar widgets 2

Once the plugin is activated, you simply need to go to Appearance -> Widgets. In the next step, let’s drag and drop the text widget to your sidebar. Now, you can easily add the shortcode into the text edit area.

The last step is pressing the Save button to make sure that all your settings are saved.

use shortcodes in sidebar widgets 3

Using the Custom HTML widget

If you want to add custom HTML code around the shortcode, this method makes it simple.

As you know, shortcodes don’t work in a Custom HTML widget. To change this, you need to add the code below to a site-specific plugin or theme’s functions.php file:

add_filter( 'widget_text', 'do_shortcode' );

After adding this code, you can add a Custom HTML widget to the sidebar, then simply add the shortcode into it. Finally, let’s click on the Save or Update button to save all your changes.

Conclusion

To sum up, we are happy to have shown you some ways to use shortcodes in sidebar widgets effectively. We hope that this blog today will be a big help in building a WordPress website. If you have any questions, don’t hesitate to leave your comment below so that we can answer you quickly. Moreover, don’t forget that we provide a lot of useful Free WordPress Themes, let’s take a look!

Build it with a template

Start from a finished design: Joomla templates, WordPress themes or the AI-ready block themes. Every template has a free version and a live demo.

Stuck on a template?

Pro customers can open a ticket; everyone can read the documentation.

Free download

We'll send the link, setup tips and update notices, and you can reach us anytime through our AI assistant and contact form.

The download starts at once. We email you the link and ask you to confirm your address. Privacy policy.