get_block_file_template

FUNCTION wp-includes\block-template-utils.php (ligne 1277) github
Filters the block template object before the query takes place. Return a non-null value to bypass the WordPress queries.

Paramètres

Entrée :
$id, $template_type = 'wp_template'
Sortie :
@param WP_Block_Template|null $block_template Return block template object to short-circuit the default query,
@param string                 $id             Template unique identifier (example: 'theme_slug//template_slug').
@param string                 $template_type  Template type. Either 'wp_template' or 'wp_template_part'.
@param WP_Block_Template|null $block_template The found block template, or null if there isn't one.
@param string                 $id             Template unique identifier (example: 'theme_slug//template_slug').
@param string                 $template_type  Template type. Either 'wp_template' or 'wp_template_part'.
@param string $id            Template unique identifier (example: 'theme_slug//template_slug').
@param string $template_type Optional. Template type. Either 'wp_template' or 'wp_template_part'.
@return WP_Block_Template|null The found block template, or null if there isn't one.

Utilisation

// Utilisation de la fonction get_block_file_template
$result = get_block_file_template($id, $template_type = 'wp_template');

if ($result) {
    // Votre logique ici
}

Actualités

Chargement des actualités...