Widgets
Widgets are the content units placed inside columns. Widgets are defined in a registry and render using shortcodes on the frontend.
Where to find widget definitions
- Registry and dialog tab definitions: admin/assets/js/src/page-builder/config/widgetTypes.js
- Dialog state mapping:
usePageBuilderStore.js(look forDIALOG_ID_MAP/TYPE_FROM_DIALOG_ID) - Frontend renderer: public/class-sanil-website-builder-public.php
Common widget fields and patterns
widget_uid— unique id for each widget instancewidget_type— string type from registrywidget_values— JSON string containing widget-specific settingsshow_desktop/show_mobile— visibility flags
Adding a widget
- Add an entry to
WIDGET_TYPESinwidgetTypes.jswithtype,label,icon,defaultValues, anddialogTabs. - Update
usePageBuilderStore.jsmappings so the dialog state maps back to the widget type. - Update frontend handler (shortcode renderer) in
public/class-sanil-website-builder-public.phpto render the widget output.
Widget examples
posts— posts listing grid withsanilwb_columns,sanilwb_type, etc.image— responsive image with link optionsbutton— CTA button with style and alignment options