‘wp_template’,
);
$query = new \WP_Query( $args );
$templates = $query->posts;
wp_reset_postdata();
foreach ( $templates as $template ) {
if( ‘archive course’ === $template->post_title ) {
function parse( $post_content ) {
global $wp_version;
$blocks = version_compare( $wp_version, ‘5’, ‘>=’ ) ? parse_blocks( $post_content ) : gutenberg_parse_blocks( $post_content );
return $blocks;
}
function get_blocks( $post_content ) {
$blocks = parse( $post_content );
return $blocks;
}
$blocks = get_blocks( $template->post_content );
foreach( $blocks as $block ) {
echo render_block( $block );
}
}
}
?>