GC_Customize_Widgets::is_wide_widget()

最后更新于:2021-11-27 11:17:24

GC_Customize_Widgets::is_wide_widget( string$widget_id)

Determines whether the widget is considered “wide”.

参数

$widget_id

(string) (Required) Widget ID.

响应

(bool) Whether or not the widget is a “wide” widget.

源文件

文件: gc-includes/class-gc-customize-widgets.php

	public function is_wide_widget( $widget_id ) {
		global $gc_registered_widget_controls;

		$parsed_widget_id = $this->parse_widget_id( $widget_id );
		$width            = $gc_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 );
	}