I've chosen a custom page(-post) to be my front page. Now I want to use a block template only on that page, when editing it in the Gutenberg editor. As I understand it I have to add it on "init" or close to it, before I know the post_ID so I can't do a if ( get_option( 'page_on_front' ) === $post_ID )
.
What are my options?
Edit: I've tried this but since is_front_page() is returning 'false' it doesn't work:
function home_block_template() {
$post_type_object = get_post_type_object( 'post' );
if ( is_front_page() ) {
$post_type_object->template = array(
array( 'core/image', array() ),
);
}
}
add_action( 'init', 'home_block_template' );