Shortcodes in WordPress allows you to add various new features and functionalities to your website. By using Short codes, you can add dynamic items like contact form, tables, and much more in your WordPress content. One can also use short codes to insert prefabricated code snippets into your articles, pages, and particular regions of your theme’s layout.
Let’s go through the three different methods on how to easily add and use short codes in the sidebar widgets on your WordPress website.
You can also watch the video tutorial:
METHOD 1: Adding Shortcode in WordPress Sidebar Using Shortcode Widget
- First, you are required to visit the Appearance menu.
- Under that, go to the Widgets screen on your dashboard and click on the ‘+’ icon to add a new widget.
- Next, scroll down to the Shortcode Widget and drag it to the sidebar.’
- Once you have added the widget, the Shortcode can be easily added inside the text edit section of the widget.
- Also, make sure to click on the Update button to save your settings.
Once you are done with these steps, you may visit your website and check for your Shortcodes in action.
METHOD 2: Adding Shortcode in WordPress Sidebar Using Text Widget
This method is basically for those WordPress users who are using an older version or have the Classic Widgets plugin installed.
- Firstly, visit the Appearance menu.
- Next, go to the Widgets screen on your dashboard.
- Next, you are required to drag and drop a Text Widget to your sidebar.
- After adding the widget, you can now add your shortcodes inside the text edit section of the widget.
- Make sure to save your settings by clicking on the Update button.
You may check your website and see the shortcodes working properly once you are done with these steps.
METHOD 3: Adding Shortcodes in WordPress Sidebar Using Custom HTML Widget
If you wish to use an HTML code to add your shortcode, you would be needed to use the Custom HTML widget.
- Shortcodes cannot be executed in a Custom HTML widget. Hence, you will be required to add the following code to your theme’s function.php file-
add_filter( 'widget_text', 'do_shortcode' );
- Once the code is added, a Custom HTML widget can be easily added to your sidebar.
- Add the desired shortcode inside your widget.
- Make sure you save your settings by clicking on the Update button.
Once these steps are done, you may visit your WordPress website and see your shortcodes working properly.
We hope that through this guide of ours, you would be able to easily use short codes in your WordPress Sidebar Widgets. In case you are unable to follow any of the methods/steps or find yourself in a problem in any related content, you can check out our website or contact us anytime.