fix: show structured fields in classic editor

This commit is contained in:
bisco
2026-06-25 18:02:40 +02:00
parent 9c5a51745f
commit 02e05ec3b6
3 changed files with 25 additions and 7 deletions
+11 -2
View File
@@ -20,7 +20,7 @@ function azionelab_register_content_types(): void {
'edit_item' => 'Modifica spettacolo',
),
'public' => true,
'show_in_rest' => true,
'show_in_rest' => false,
'menu_icon' => 'dashicons-tickets-alt',
'supports' => array( 'title', 'editor', 'excerpt', 'thumbnail', 'page-attributes' ),
'has_archive' => false,
@@ -39,7 +39,7 @@ function azionelab_register_content_types(): void {
),
'public' => false,
'show_ui' => true,
'show_in_rest' => true,
'show_in_rest' => false,
'menu_icon' => 'dashicons-format-gallery',
'supports' => array( 'title', 'thumbnail', 'page-attributes' ),
)
@@ -47,6 +47,15 @@ function azionelab_register_content_types(): void {
}
add_action( 'init', 'azionelab_register_content_types' );
function azionelab_use_classic_editor_for_structured_content( bool $use_block_editor, string $post_type ): bool {
if ( in_array( $post_type, array( 'azl_show', 'azl_gallery' ), true ) ) {
return false;
}
return $use_block_editor;
}
add_filter( 'use_block_editor_for_post_type', 'azionelab_use_classic_editor_for_structured_content', 10, 2 );
function azionelab_add_meta_boxes(): void {
add_meta_box( 'azl_show_details', 'Dettagli spettacolo', 'azionelab_show_meta_box', 'azl_show', 'normal' );
add_meta_box( 'azl_gallery_details', 'Dettagli foto', 'azionelab_gallery_meta_box', 'azl_gallery', 'normal' );