How to add custom editor with Gutenberg blocks?

Today I’m having a custom post type where I have a custom editor added like this:

function add_meta_boxes()
{
add_action(‘edit_form_advanced’, ‘intro_editor’);
}
add_action(‘do_meta_boxes’, ‘add_meta_boxes’);

And the intro_editor() looks likes this;

/**
* Custom WP-Editor
*/
function course_intro_editor($post)
{
$text_domain = ‘jakompetens’;

if ($post->post_type == get_stylesheet().’_course’)
{
?>
<h2><?php echo __(‘Intro’, $text_domain); ?></h2>
<?php
$editor_settings = array(
‘textarea_rows’ => 5
, ‘editor_css’ => ‘<style type=”text/css”>#post-body #normal-sortables { min-height: 0 }</style>’
, ‘media_buttons’ => false
, ‘teeny’ => true
);
wp_editor(html_entity_decode(stripcslashes($post->intro)), ‘intro’, $editor_settings);
}
}

But I want this to be able to edit from the Gutenberg Blocks mode too. How do I manage that? Cause right now, they disappears. It’s only the custom meta data I have in the right sidebar that is shown.

Read more here:: How to add custom editor with Gutenberg blocks?

Leave a Reply

Your email address will not be published. Required fields are marked *