What are shortcodes?
Shortcodes are understood as codes that help you add additional features to the WordPress content area. Thanks to the shortcode, you can easily add tables, contact forms, or more in the post content. In addition, shortcodes are also used in widgets, so you are effectively able to add dynamic items to sidebars. In the blog today, we would like to introduce to you the ways how to use shortcodes in the sidebar widgets of your site. Let’s get started now!
Instructions to use shortcodes in sidebar widgets of WordPress site
Utilizing shortcode widget
The first way we want to show you is by using the shortcode widget to add the shortcode in 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 press on Update button to save all your settings.
Using text widget
If you don’t want to use the shortcode widget to add the shortcode in 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 the name of it on the search bar, click on Install now -> Activate button.
Once activating this plugin, 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.
Using custom HTML Wiget
If you desire to add custom HTML code around the shortcode, this way can assist you to do that simply.
As you know, in a custom HTML widget, the shortcodes can’t work. If you are looking for a way to change this, it’s necessary for you 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 are able to insert 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.
To sum up, we are happy and pleased to introduce to you some ways to use shortcodes in sidebar widgets effectively. We hope that this blog today will be your powerful assistance in building a WordPress website. If you have any question, don’t hesitate to leave your comment below so that we can answer you quickly. Moreover, don’t forget that we are providing a lot of useful and Free WordPress Themes, let’s take a look!