_add_block_template_info()
Attempts to add custom template information to the template item.
Эта функция считается внутренней для использования самим ядром. Не рекомендуется использовать эту функцию в своем коде.
Хуков нет.
Возвращает
Массив
. Template item.
Использование
_add_block_template_info( $template_item );
- $template_item(массив) (обязательный)
- Template to add information to (requires 'slug' field).
Список изменений
С версии 5.9.0 | Введена. |
Код _add_block_template_info() add block template info WP 6.1.1
function _add_block_template_info( $template_item ) { if ( ! WP_Theme_JSON_Resolver::theme_has_support() ) { return $template_item; } $theme_data = WP_Theme_JSON_Resolver::get_theme_data()->get_custom_templates(); if ( isset( $theme_data[ $template_item['slug'] ] ) ) { $template_item['title'] = $theme_data[ $template_item['slug'] ]['title']; $template_item['postTypes'] = $theme_data[ $template_item['slug'] ]['postTypes']; } return $template_item; }