Managing Widgets Overview#
In Jalpi Page Builder, every widget is a decoupled entity consisting of:
- A PHP Element Class (extending
Jalpi_Element_Base) inincludes/elements/that defines the widget metadata, controls schema, and public HTML/CSS rendering methods. - A React Canvas Component inside the visual editor bundle (
admin/editor/src/components/widgets/) that provides real-time DOM representation and inline content manipulation.
Widget management is handled centrally by Jalpi_Element_Registry during the WordPress init hook.
Registration Lifecycle#
When WordPress boots, Jalpi auto-loads all core widget classes and passes their class names through the jalpi_widgets filter before registration:
add_action( 'init', function() {
$registered_widgets = Jalpi_Element_Registry::get_instance()->get_all_elements();
// Returns array of instantiated Jalpi_Element_Base objects
}, 20 );The jalpi_widgets Filter
To register a custom widget into the system, append your custom PHP element class to the array passed to jalpi_widgets:
add_filter( 'jalpi_widgets', function( $widgets ) {
require_once get_stylesheet_directory() . '/widgets/class-my-custom-widget.php';
$widgets[] = 'My_Custom_Widget';
return $widgets;
} );Widget Categories & Sorting#
Widgets are grouped in the editor's left drawer into standard categories: basic, media, layout, interactive, and woocommerce. Override the get_categories() method in your element class:
public function get_categories(): array {
return [ 'interactive', 'marketing' ];
}You can also register custom categories using the jalpi_widget_categories filter.
Deregistering Core Widgets#
To simplify the builder interface for clients or disable unwanted widgets, remove them by class name or slug from the registry:
add_filter( 'jalpi_widgets', function( $widgets ) {
// Disable core Marquee and Split Text widgets
return array_diff( $widgets, [
'Jalpi_Element_Marquee',
'Jalpi_Element_Split_Text'
] );
} );Managing Control Schemas#
Each widget declares its properties via register_controls(). Controls can be organized into Content, Style, and Advanced tabs:
$this->start_controls_section( 'section_title', [
'label' => __( 'Title Settings', 'jalpi' ),
'tab' => 'content'
] );
$this->add_control( 'title_text', [
'type' => 'text',
'label' => __( 'Title Text', 'jalpi' ),
'default' => __( 'Hello World', 'jalpi' )
] );
$this->end_controls_section();Related Documentation#
Related Widget Documentation
- Widget Registry Reference β Complete index of all 42 registered widgets.
- Your First Widget β Step-by-step walkthrough to build a custom element.
- Code Examples β Practical copy-paste recipes for custom widgets.
Last updated: November 2026