From f9ed205f1b33737908001df484f36e8ebd19959b Mon Sep 17 00:00:00 2001 From: "Soare Robert Daniel (Mac 2023)" Date: Thu, 9 Jan 2025 17:36:45 +0200 Subject: [PATCH] fix: use post type label in meta box settings --- inc/admin/metabox/manager.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/inc/admin/metabox/manager.php b/inc/admin/metabox/manager.php index 726483e379..5c829dee42 100755 --- a/inc/admin/metabox/manager.php +++ b/inc/admin/metabox/manager.php @@ -116,10 +116,12 @@ public function save( $post_id ) { * Register meta box to control layout on pages and posts. */ public function add() { - $post_type = 'Neve'; + $post_type_label = 'Neve'; $post_type_from_db = get_post_type(); - if ( $post_type_from_db ) { - $post_type = ucfirst( $post_type_from_db ); + $post_type_object = get_post_type_object( $post_type_from_db ); + + if ( $post_type_object && isset( $post_type_object->labels ) && isset( $post_type_object->labels->name ) ) { + $post_type_label = $post_type_object->labels->name; } add_meta_box( @@ -127,7 +129,7 @@ public function add() { sprintf( /* translators: %s - post type */ __( '%s Settings', 'neve' ), - $post_type + $post_type_label ), array( $this, 'render_metabox' ), array( 'post', 'page', 'product' ), @@ -144,7 +146,7 @@ public function add() { sprintf( /* translators: %s - post type */ __( '%s Settings', 'neve' ), - $post_type + $post_type_label ), array( $this, 'render_metabox_notice' ), Supported_Post_Types::get( 'block_editor' ),