функция
since 5.9.0
get_allowed_block_template_part_areas()
Проверено на WordPress 6.9, обновлено Источник: WordPress Developer Resources.
Сигнатура
get_allowed_block_template_part_areas(): array[]
Описание
Возвращает отфильтрованный список допустимых значений области для частей шаблонов.
Возвращаемое значение
array[]
...$0 array Data for the allowed template part area. area stringTemplate part area name. label stringTemplate part area label. description stringTemplate part area description. icon stringTemplate part area icon. area_tag stringTemplate part area tag. Source function get_allowed_block_template_part_areas() { $default_area_definitions = array( array( 'area' => WP_TEMPLATE_PART_AREA_UNCATEGORIZED, 'label' => _x( 'General', 'template part area' ), 'description' => __( 'General templates often perform a specific role like displaying post content, and are not tied to any particular area.' ), 'icon' => 'layout', 'area_tag' => 'div', ), array( 'area' => WP_TEMPLATE_PART_AREA_HEADER, 'label' => _x( 'Header', 'template part area' ), 'description' => __( 'The Header template defines a page area that typically contains a title, logo, and main navigation.' ), 'icon' => 'header', 'area_tag' => 'header', ), array( 'area' => WP_TEMPLATE_PART_AREA_FOOTER, 'label' => _x( 'Footer', 'template part area' ), 'description' => __( 'The Footer template defines a page area that typically contains site credits, social links, or any other combination of blocks.' ), 'icon' => 'footer', 'area_tag' => 'footer', ), array( 'area' => WP_TEMPLATE_PART_AREA_NAVIGATION_OVERLAY, 'label' => _x( 'Navigation Overlay', 'template part area' ), 'description' => __( 'The Navigation Overlay template defines an overlay area that typically contains navigation links and can be toggled open and closed.' ), 'icon' => 'navigation-overlay', 'area_tag' => 'div', ), ); /** * Filters the list of allowed template part area values. * * @since 5.9.0 * * @param array[] $default_area_definitions { * The allowed template part area values. * * @type array ...$0 { * Data for the template part area. * * @type string $area Template part area name. * @type string $label Template part area label. * @type string $description Template part area description. * @type string $icon Template part area icon. * @type string $area_tag Template part area tag. * } * } */ return apply_filters( 'default_wp_template_part_areas', $default_area_definitions ); }
Исходный код
wp-includes/block-template-utils.php:73
function get_allowed_block_template_part_areas() {
$default_area_definitions = array(
array(
'area' => WP_TEMPLATE_PART_AREA_UNCATEGORIZED,
'label' => _x( 'General', 'template part area' ),
'description' => __(
'General templates often perform a specific role like displaying post content, and are not tied to any particular area.'
),
'icon' => 'layout',
'area_tag' => 'div',
),
array(
'area' => WP_TEMPLATE_PART_AREA_HEADER,
'label' => _x( 'Header', 'template part area' ),
'description' => __(
'The Header template defines a page area that typically contains a title, logo, and main navigation.'
),
'icon' => 'header',
'area_tag' => 'header',
),
array(
'area' => WP_TEMPLATE_PART_AREA_FOOTER,
'label' => _x( 'Footer', 'template part area' ),
'description' => __(
'The Footer template defines a page area that typically contains site credits, social links, or any other combination of blocks.'
),
'icon' => 'footer',
'area_tag' => 'footer',
),
array(
'area' => WP_TEMPLATE_PART_AREA_NAVIGATION_OVERLAY,
'label' => _x( 'Navigation Overlay', 'template part area' ),
'description' => __(
'The Navigation Overlay template defines an overlay area that typically contains navigation links and can be toggled open and closed.'
),
'icon' => 'navigation-overlay',
'area_tag' => 'div',
),
);
/**
* Filters the list of allowed template part area values.
*
* @since 5.9.0
*
* @param array[] $default_area_definitions {
* The allowed template part area values.
*
* @type array ...0 {
* Data for the template part area.
*
* @type string $area Template part area name.
* @type string $label Template part area label.
* @type string $description Template part area description.
* @type string $icon Template part area icon.
* @type string $area_tag Template part area tag.
* }
* }
*/
return apply_filters( 'default_wp_template_part_areas', $default_area_definitions );
}
История изменений
| Версия | Описание |
|---|---|
| 5.9.0 | Introduced. |

