Action: siteorigin_panels_before_widget_form
The siteorigin_panels_before_widget_form
action will allow you to add markup before the widget form is output.
Parameters
the_widget
The WP_Widget of the current widget
$instance
The page builder widget instance.
Example code
The following example will add a notice to the WordPress Archives widget suggesting the user enables the "Show posts count" setting.
function so_add_text_prior_to_archives_widget_form( $the_widget, $instance ) {
if ( get_class( $the_widget ) == 'WP_Widget_Archives' ) {
echo __( 'We recommend ticking "Show posts count"', 'example-text-domain' );
}
}
add_action( 'siteorigin_panels_before_widget_form', 'so_add_text_prior_to_archives_widget_form', 10, 2 );
Filter: siteorigin_panels_widget_form
The siteorigin_panels_widget_form
filter allows you to filter the form HTML prior to output. This will allow you to override form markup and implement a custom renderer.
Parameters
form
The form markup generated by the widget.
widget_class
The class of the current widget
instance
The page builder widget instance.
Example Code
The following example code will replace the Calendar widgets form with a message.
function so_override_calendar_form( $form, $widget_class, $instance ) {
if ( $widget_class == 'WP_Widget_Calendar' ) {
return __( 'This is an example of the Calendar form being completely overridden.', 'example-text-domain' );
}
return $form;
}
add_filter( 'siteorigin_panels_widget_form', 'so_override_calendar_form', 10, 3 );