Widget Options Documentation
How do I create a shortcode for a widget?
Enabling Shortcode for a widget using the Widget Options plugin is a streamlined process that enhances the functionality and flexibility of your WordPress site. Widget Options is a powerful tool that lets users easily control widgets’ visibility and behavior via shortcode.
Here’s a guide on how to use the Widget Options’ shortcodes:
Installation and Activation
Start by installing and activating the Pro version of the Widget Options plugin. Once activated, navigate to the Widgets Options Setting page (Settings > Widget Options), and enable Shortcodes.
You also need to enable the classic widget screen to copy the shortcodes from the classic widget editor.
Copy Shortcode
The Shortcode can be found at the bottom part of each widget.
Integration
Paste the copied shortcode into the desired post, page, or custom post type where you want the widget and blocks to appear. You can also insert the shortcode directly into your theme files if you prefer to display the widget programmatically.
Testing
After integrating the shortcode, preview your website to ensure that the widget is displaying correctly and functioning as expected.
If you are unsure of the values you can check the shortcode below each widgets when this features is enabled.
For sidebars:
[do_sidebar name="Primary" container="div" container_id="div_id" container_class="div_class"]
Shortcode Parameters
name : the name or id of the sidebar you want to display.
container : optional content container for all the contents.
container_id : optional container id if you have container value.
container_class : optional container class if you have container value.
For widgets:
[do_widget id="widget-id" container="div" container_id="div_id" container_class="div_class"]
Shortcode Parameters
id : the id of the widget you want to display.
container : optional content container for the widget.
container_id : optional container id if you have container value.
container_class : optional container class if you have container value.