Display a widget area.
beans_widget_area( string $id )
Return: (string|bool) The output, if a widget area was found and called. False if not found.
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
$id | string | true | - | The ID of the registered widget area. |
Source
function beans_widget_area( $id ) {
// Stop here if the widget area is not registered.
if ( ! beans_has_widget_area( $id ) ) {
return false;
}
_beans_setup_widget_area( $id );
/**
* Fires after a widget area is initialized.
*
* @since 1.0.0
*/
do_action( 'beans_widget_area_init' );
ob_start();
/**
* Fires when {@see beans_widget_area()} is called.
*
* @since 1.0.0
*/
do_action( 'beans_widget_area' );
$output = ob_get_clean();
// Reset widget area global to reduce memory usage.
_beans_reset_widget_area();
/**
* Fires after a widget area is reset.
*
* @since 1.0.0
*/
do_action( 'beans_widget_area_reset' );
return $output;
}