Insert a widget or multiple widgets or a entire widget area (sidebar) into a page using a shortcode.
Set up your widget first in a normal sidebar. Check it works.
THEN Drag your chosen widgets to the sidebar called “widgets for shortcode”.
Add the do_widget shortcode to the page where you would like the widget to appear (or the do_widget_area)
To use in the block editor, add a shortcode block, then type in (including the square brackets [do_widget widgetname] or copy the do_widget tip from the widget in the ‘Widgets for Shortcodes’ sidebar.
Please see detailed info on shortcodes and parameters under the installation tab (depending what the plugin directory developers have most recently done, this may be under the FAQ, or at the very least under the readme.)
Using a widget more than once?
Reference a specific widget instance from the do_widget shortcode, or the chosen sidebar from the do_widget_area shortcode. Eg: [do_widget id=widget-n]
For example: You could use the query posts widget in the page to create a archive within a page, or the rss widget to list feed content from other sites. For more details see anmari.com
The plugins default action is that it will magically find the settings for your themes sidebar and use the sidebar html to control the widgets output. In most cases this means the widget will be styled as per the rest of your theme. If that does not look good, parameters exist to try override this behaviour.
EG: in twenty-fourteen theme widget text ends up being white on white! widget_classes=none fixes that. Eg: [do_widget widget_classes=none yourwidget]
Changed your theme and worried about losing the sidebar settings ?
No problem, the plugin will save and restore the widgets_for_shortcode settings. On display it will then pick up the new themes sidebar settings.
PLEASE get your widgets working in a sidebar BEFORE activating this plugin, and please read https://wordpress.org/plugins/amr-shortcode-any-widget/installation/ and https://wordpress.org/plugins/amr-shortcode-any-widget/faq/ and/or see the settings page. To see a list of your widgets in their sidebars, add ?do_widget_debug to the page with the do_widget shortcode.
[do_widget id=widgetid] . eg: [do_widget id=tag-cloud-3]
[do_widget_area] (will use the “widgets in shortcodes” widget area / sidebar
[do_widget …] Parameters:
[do_widget_area …] Parameters:
Advanced users WARNING: using do_widget_area with a widget area other than the shortcode one means that if you changes themes and the new theme has different sidebars, then this shortcode with a named widget area will not work.
See the settings page for links to help your create the shortcodes in a page.
The plugin has been tested with most standard widgets (rss feeds, tag cloud, pages, meta, search, and of course my own plugins widgets – upcoming events list, calendar and user lists.
If you use a widget more than once for different reasons, you may need to use the widget id to isolate which widget instance and it’s settings to use. ie: [do_widget id=categories-6] . If you just use the name, it will display all widgets in the shortcode sidebar with that name (all instances).
If you liked this plugin, you might also like my other plugins:
PLEASE get your widgets working in a sidebar BEFORE activating this plugin, and PLEASE read the installation instructions (?is the plugin directory showing them!?) and the settings page before asking any questions.
Please get the widget working first in a normal sidebar without this plugin and ask for support on the widgets forum it is does not work in a normal sidebar.
To identify your widget in the shortcode, use the NAME or the ID.
The name is the generic NAME like “tag cloud”.
The id is how wordpress identifies the instance of the widget. The id is visible at the bottom of the widget settings box.
Yes anything could happen wrt the appearance.(There are tens of 1000s of themes and widgets. Multiply out the possible combinations. Add in css specifity, inheritance and cascading rules. Consider you are moving the widget out of the sidebar where the the theme and widget plugin expect it to be. ) The effects are very dependent on how your theme has specified the css that may apply to widgets and sidebars/widget areas.
It may work beautifully and have the content looking like it belongs with your theme.
This plugin tries to help encourage that ‘belonging’ look. If it fails then it offers ways to switch the html and/or the classes being generated.
* you may have undesired effects applying that do not work in the main content area
* You may have desired effects not applying because the css is specific to a themes sidebar and does not apply to the html in a page.
The plugin can help a bit – Via the plugin you can do the following to affect styling:
Remove the general wordpress ‘widget’ class from the widgets wrapping html and the ‘widget_title’ from the title html. ([do_widget widgetname widget_classes=none]
Change the ‘wrap’ html and the title html with parameters wrap=div title=h3. See the settings page.
Apply an existing class in your theme. Use [do_widget widgetname class=yourclass].
Use the additional class ‘amr-widget’ provided to specify alternate css in your themes stylesheet or with something like wordpress custom css.
One of the new features is as a default setting is that the plugin will try have your current themes first sidebar styling apply to the widgets inserted into a page via the shortcode.
Many folks requested this, insisting that absolutely this is what should be happening and why didn’t it? Well..This could be great – Imagine: a plugin that can pick up the theme styling and change it as your theme changes.
The success of this depends very much on how your theme specifies it’s css. Does it always use classes ? – more css will apply. Does it lock the css down by sidebar-id: that css will not apply.
It also depends on what the original widget plugin does with css and js. It may have done something thinking that the widget will always be inside a sidebar and not anticipated being in a page. This the shortcde-any-widget plugin has no control over.
For example: An unwanted effect could be white text on a white background as in the twenty fourteen theme.
You need to learn the joys of the ‘inspect element’ tools in various browsers or browser web developer, firebug add-ons, so you can see what css is applying to what html. Then you can either change some of the html or override or change the css.
Options if you don’t like the default result:
Use the ‘amr-widget’ class that has been added to the widget wrapping html to override any css.
Tap into a class you already have in your theme:
Change the html that the shortcode-any-widget plugin will use.
eg: don’t like the h3.widget-title styling ? change the title html to h2 in the shotcode parameters
eg: don’t like the ‘aside’ wrapping html styling? change the wrapping html:
If you only using widget, maybe inserting the whole sidebar or widgertarea would give an interesting effect. Sidebar background css may apply.
Insert a widget or multiple widgets or a entire widget area (sidebar) into a page using a shortcode.View Cart
This plugin inserts social share links at the top or bottom of each post.
Search & Replace data in your database with WordPress admin, replace do...
YITH WooCommerce Catalog Mode, a plugin for disabling sales in your e-comme...
Remove meta author and date information from posts and pages. Hide from Hum...