I have an MB Block and the template file to display the block is not showing on the front end. Do I need to do anything with my theme? The template.php in render_template is showing on the back end (in Gutenberg).
add_filter( 'rwmb_meta_boxes', function( $meta_boxes ) {
$meta_boxes[] = [
'title' => 'My Post Picker',
'id' => 'my-post-picker',
'type' => 'block', // Important.
'icon' => 'admin-post', // Or you can set a custom SVG if you don't like Dashicons
'category' => 'text',
//'mode' => 'edit', //The default mode of the block: edit to make it shows the edit fields when loaded, preview (default) to show the rendered HTML when loaded.
'context' => 'side', // The block settings will be available on the right sidebar.
'render_template' => get_stylesheet_directory() . '/blocks/template.php', // The PHP template that renders the block.
// Now register the block fields.
'fields' => [
[
'id' => 'vpp_post',
'type' => 'post',
'name' => 'Link:',
'post_type' => ['post','page','attachment'],
'field_type' => 'select_advanced',
'query_args' => [
'post_status' => ['any'],
'posts_per_page' => - 1,
],
],
],
];
return $meta_boxes;
});