block_template_part

The timeline below displays how wordpress function block_template_part has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 6.5

/**
 * Prints a block template part.
 *
 * @since 5.9.0
 *
 * @param string $part The block template part to print. Either 'header' or 'footer'.
 */
function block_template_part($part)
{
    $template_part = get_block_template(get_stylesheet() . '//' . $part, 'wp_template_part');
    if (!$template_part || empty($template_part->content)) {
        return;
    }
    echo do_blocks($template_part->content);
}

WordPress Version: 6.1

/**
 * Prints a block template part.
 *
 * @since 5.9.0
 *
 * @param string $part The block template part to print. Use "header" or "footer".
 */
function block_template_part($part)
{
    $template_part = get_block_template(get_stylesheet() . '//' . $part, 'wp_template_part');
    if (!$template_part || empty($template_part->content)) {
        return;
    }
    echo do_blocks($template_part->content);
}

WordPress Version: 5.9

/**
 * Print a template-part.
 *
 * @since 5.9.0
 *
 * @param string $part The template-part to print. Use "header" or "footer".
 */
function block_template_part($part)
{
    $template_part = get_block_template(get_stylesheet() . '//' . $part, 'wp_template_part');
    if (!$template_part || empty($template_part->content)) {
        return;
    }
    echo do_blocks($template_part->content);
}