On this page
WP_Customize_Widgets::is_wide_widget( string $widget_id ): bool
Determines whether the widget is considered “wide”.
Description
Core widgets which may have controls wider than 250, but can still be shown in the narrow Customizer panel. The RSS and Text widgets in Core, for example, have widths of 400 and yet they still render fine in the Customizer panel.
This method will return all Core widgets as being not wide, but this can be overridden with the ‘is_wide_widget_in_customizer’ filter.
Parameters
$widget_idstring Required-
Widget ID.
Return
bool Whether or not the widget is a "wide" widget.
Source
File: wp-includes/class-wp-customize-widgets.php. View all references
public function is_wide_widget( $widget_id ) {
global $wp_registered_widget_controls;
$parsed_widget_id = $this->parse_widget_id( $widget_id );
$width = $wp_registered_widget_controls[ $widget_id ]['width'];
$is_core = in_array( $parsed_widget_id['id_base'], $this->core_widget_id_bases, true );
$is_wide = ( $width > 250 && ! $is_core );
/**
* Filters whether the given widget is considered "wide".
*
* @since 3.9.0
*
* @param bool $is_wide Whether the widget is wide, Default false.
* @param string $widget_id Widget ID.
*/
return apply_filters( 'is_wide_widget_in_customizer', $is_wide, $widget_id );
}
Hooks
- apply_filters( 'is_wide_widget_in_customizer',
bool $is_wide ,string $widget_id ) -
Filters whether the given widget is considered “wide”.
Related
Uses
| Uses | Description |
|---|---|
| WP_Customize_Widgets::parse_widget_id() wp-includes/class-wp-customize-widgets.php | Converts a widget ID into its id_base and number components. |
| apply_filters() wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
Used By
| Used By | Description |
|---|---|
| WP_Customize_Widgets::get_available_widgets() wp-includes/class-wp-customize-widgets.php | Builds up an index of all available widgets for use in Backbone models. |
| WP_Customize_Widgets::customize_register() wp-includes/class-wp-customize-widgets.php | Registers Customizer settings and controls for all sidebars and widgets. |
Changelog
| Version | Description |
|---|---|
| 3.9.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_customize_widgets/is_wide_widget