wp-includes/block-template-utils.php


Lines:

1 to 81 of 81
<?php

/**
 * Utilities used to fetch and create templates and template parts.
 *
 * @package WordPress
 * @since 5.8.0
 */

// Define constants for supported wp_template_part_area taxonomy.
if ( ! defined( 'WP_TEMPLATE_PART_AREA_HEADER' ) ) {
  define( 'WP_TEMPLATE_PART_AREA_HEADER', 'header' );
}
if ( ! defined( 'WP_TEMPLATE_PART_AREA_FOOTER' ) ) {
  define( 'WP_TEMPLATE_PART_AREA_FOOTER', 'footer' );
}
if ( ! defined( 'WP_TEMPLATE_PART_AREA_SIDEBAR' ) ) {
  define( 'WP_TEMPLATE_PART_AREA_SIDEBAR', 'sidebar' );
}
if ( ! defined( 'WP_TEMPLATE_PART_AREA_UNCATEGORIZED' ) ) {
  define( 'WP_TEMPLATE_PART_AREA_UNCATEGORIZED', 'uncategorized' );
}

/* function get_block_theme_folders() – For backward compatibility reasons,
block themes might be using block-templates or block-template-parts,
this function ensures we fallback to these folders properly. */

/* function get_allowed_block_template_part_areas() – Returns a filtered list of allowed area values for template parts. */


/* function get_default_block_template_types() – Returns a filtered list of default template types, containing their
localized titles and descriptions. */

/* function _filter_block_template_part_area() – Checks whether the input ‘area’ is a supported value. */

/* function _get_block_templates_paths() – Finds all nested template part file paths in a theme’s directory. */

/* function _get_block_template_file() – Retrieves the template file from the theme for a given slug. */

/* function _get_block_templates_files() – Retrieves the template files from the theme. */

/* function _add_block_template_info() – Attempts to add custom template information to the template item. */

/* function _add_block_template_part_area_info() – Attempts to add the template part’s area information to the input template. */

/* function _flatten_blocks() – Returns an array containing the references of
the passed blocks and their inner blocks. */

/* function _inject_theme_attribute_in_block_template_content() – Parses wp_template content and injects the current theme’s
stylesheet as a theme attribute into each wp_template_part */

/* function _remove_theme_attribute_in_block_template_content() – Parses a block template and removes the theme attribute from each template part. */

/* function _build_block_template_result_from_file() – Build a unified template object based on a theme file. */

/* function _wp_build_title_and_description_for_single_post_type_block_template() – Builds the title and description of a post-specific template based on the underlying referenced post. */

/* function _wp_build_title_and_description_for_taxonomy_block_template() – Builds the title and description of a taxonomy-specific template based on the underlying entity referenced. */

/* function _build_block_template_result_from_post() – Builds a unified template object based a post Object. */

/* function get_block_templates() – Retrieves a list of unified template objects based on a query. */

/* function get_block_template() – Retrieves a single unified template object using its id. */

/* function get_block_file_template() – Retrieves a unified template object based on a theme file. */

/* function block_template_part() – Print a template-part. */

/* function block_header_area() – Print the header template-part. */

/* function block_footer_area() – Print the footer template-part. */

/* function wp_is_theme_directory_ignored() – Determines whether a theme directory should be ignored during export. */

/* function wp_generate_block_templates_export_file() – Creates an export of the current templates and
template parts from the site editor at the
specified path in a ZIP file. */

/* function get_template_hierarchy() – Gets the template hierarchy for the given template slug to be created. */
 

 View on GitHub View on Trac

Called by

    Invoked by

      Calls

      Call hooks

      API Letters: ,,,,