Force template on post type

When using “legacy” plugins (meaning those that are not yet compatible with full site editing) that create their own post type and have a php template for singles posts is there a way to force the FSE template on them?
Just setting the conditions or selecting the template inside a post won’t work.

For those who are having a similar problem, the solution I found is to replace the single post php template of the of the plugin you are using (using the overwrite structure they provide, like same folder structure in your child theme) with this code:

<?php
/**
 * Template canvas file to render the current 'wp_template'.
 *
 * @package gutenberg
 */

/**
 * Get the template HTML.
 * This needs to run before <head> so that blocks can add scripts and styles in wp_head().
 */
$template_html = gutenberg_get_the_template_html();
?><!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
	<meta charset="<?php bloginfo( 'charset' ); ?>" />
	<?php wp_head(); ?>
</head>

<body <?php body_class(); ?>>

<?php wp_body_open(); ?>

<?php echo $template_html; // phpcs:ignore WordPress.Security.EscapeOutput ?>

<?php wp_footer(); ?>
</body>
</html>

Works as expected!

1 Like