| [ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Source view] [Print] [Project Stats]
Block template loader functions.
| File Size: | 521 lines (18 kb) |
| Included or required: | 0 times |
| Referenced: | 0 times |
| Includes or requires: | 0 files |
| _add_template_loader_filters() X-Ref |
| Adds necessary hooks to resolve '_wp-find-template' requests. |
| wp_render_empty_block_template_warning( $block_template ) X-Ref |
| Renders a warning screen for empty block templates. return: string The warning screen HTML. param: WP_Block_Template $block_template The block template object. |
| locate_block_template( $template, $type, array $templates ) X-Ref |
| Finds a block template with equal or higher specificity than a given PHP template file. Internally, this communicates the block content that needs to be used by the template canvas through a global variable. return: string The path to the Site Editor template canvas file, or the fallback PHP template. param: string $template Path to the template. See locate_template(). param: string $type Sanitized filename without extension. param: string[] $templates A list of template candidates, in descending order of priority. |
| resolve_block_template( $template_type, $template_hierarchy, $fallback_template ) X-Ref |
| Returns the correct 'wp_template' to render for the request template type. return: WP_Block_Template|null template A template object, or null if none could be found. param: string $template_type The current template type. param: string[] $template_hierarchy The current template hierarchy, ordered by priority. param: string $fallback_template A PHP fallback template to use if no matching block template is found. |
| _block_template_render_title_tag() X-Ref |
| No description |
| get_the_block_template_html() X-Ref |
| Returns the markup for the current template. return: string Block template markup. |
| _block_template_add_skip_link( string $template_html ) X-Ref |
| Inserts the block template skip-link into the template HTML. When a `MAIN` element exists in the template, this function will ensure that the element contains an `id` attribute, and it will insert a link to that `MAIN` element before the first `DIV.wp-site-blocks` element, which is the wrapper for all blocks in a block template as constructed by {@see get_the_block_template_html()}. Example: // Input. <div class="wp-site-blocks"> <nav>...</nav> <main> <h2>... // Output. <a href="#wp--skip-link--target" id="wp-skip-link" class="..."> <div class="wp-site-blocks"> <nav>...</nav> <main id="wp--skip-link--target"> <h2>... When the `MAIN` element already contains a non-empty `id` value it will be used instead of the default skip-link id. return: string Modified markup with skip link when applicable. param: string $template_html Block template markup. |
| insert_before( string $text ) X-Ref |
| Inserts text before the current token. param: string $text Text to insert. |
| _block_template_viewport_meta_tag() X-Ref |
| Renders a 'viewport' meta tag. This is hooked into {@see 'wp_head'} to decouple its output from the default template canvas. |
| _strip_template_file_suffix( $template_file ) X-Ref |
| Strips .php or .html suffix from template file names. return: string Template file name without extension. param: string $template_file Template file name. |
| _block_template_render_without_post_block_context( $context ) X-Ref |
| Removes post details from block context when rendering a block template. return: array Filtered context. param: array $context Default context. |
| _resolve_template_for_new_post( $wp_query ) X-Ref |
| Sets the current WP_Query to return auto-draft posts. The auto-draft status indicates a new post, so allow the the WP_Query instance to return an auto-draft post for template resolution when editing a new post. param: WP_Query $wp_query Current WP_Query instance, passed by reference. |
| register_block_template( $template_name, $args = array() X-Ref |
| Register a block template. return: WP_Block_Template|WP_Error The registered template object on success, WP_Error object on failure. param: string $template_name Template name in the form of `plugin_uri//template_name`. param: array|string $args { |
| unregister_block_template( $template_name ) X-Ref |
| Unregister a block template. return: WP_Block_Template|WP_Error The unregistered template object on success, WP_Error object on failure or if the param: string $template_name Template name in the form of `plugin_uri//template_name`. |
| Generated : Wed Apr 15 08:20:10 2026 | Cross-referenced by PHPXref |