Block-Template

$html = template_block( 'Template-Test', [
		"Ursprung" => "Helmut Herrmann",
		"Zitat"    => "Einfachheit ist kein primitiver Anfang, sondern durchdachte Vollendung",
] );

// Strings in dem Template-Block, die mit {{ }} gekennzeichnet sind, werden durch das Key => Value-Paar ersetzt.

function template_block( $paramTemplate, $paramArray ): string
{

	$html     = "";
	$my_post  = det_get_page_by_title( $paramTemplate, '', 'wp_block' );
	$template = $my_post->post_content;

	foreach ( $paramArray as $key => $value ) {
		$template = str_replace( '{{' . $key . '}}', $value, $template );
	}

	$blocks       = parse_blocks( $template );
	$renderedHtml = "";
	foreach ( $blocks as $block ) {
		$renderedHtml .= apply_filters( 'the_content', render_block( $block ) );
	}
	$html .= $renderedHtml;

	return $html;
}


function det_get_page_by_title( $page_title, $output = OBJECT, $post_type = 'page' )
{

	$query = new WP_Query(
		array(
			'post_type'              => $post_type,
			'title'                  => $page_title,
			'post_status'            => 'all',
			'posts_per_page'         => 1,
			'no_found_rows'          => true,
			'ignore_sticky_posts'    => true,
			'update_post_term_cache' => false,
			'update_post_meta_cache' => false,
			'orderby'                => 'date',
			'order'                  => 'ASC',
		)
	);

	if ( ! empty( $query->post ) ) {
		$_post = $query->post;

		if ( ARRAY_A === $output ) {
			return $_post->to_array();
		}
		elseif ( ARRAY_N === $output ) {
			return array_values( $_post->to_array() );
		}

		return $_post;
	}

	return null;
}