true, ) ); if ( in_array( $post_type, $types ) && ( 'attachment' !== $post_type ) ) { add_meta_box( 'botiga_single_page_metabox' ,__( 'Botiga page options', 'botiga' ) ,array( $this, 'render_meta_box_content' ) ,$types ,'side' ,'low' ); } } public function save( $post_id ) { // Check if our nonce is set. if ( ! isset( $_POST['botiga_single_page_box_nonce'] ) ) return $post_id; $nonce = sanitize_key( wp_unslash( $_POST['botiga_single_page_box_nonce'] ) ); // Verify that the nonce is valid. if ( ! wp_verify_nonce( $nonce, 'botiga_single_page_box' ) ) return $post_id; if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return $post_id; if ( ! current_user_can( 'edit_page', $post_id ) ) return $post_id; //Page builder mode $activate_page_builder_mode = ( isset( $_POST['botiga_page_builder_mode'] ) && '1' === $_POST['botiga_page_builder_mode'] ) ? 1 : 0; update_post_meta( $post_id, '_botiga_page_builder_mode', $activate_page_builder_mode ); //Sidebar layout $sidebar_layout_choices = array( 'customizer', 'sidebar-left', 'sidebar-right', 'no-sidebar' ); $sidebar_layout = $this->sanitize_selects( sanitize_key( $_POST['botiga_sidebar_layout'] ), $sidebar_layout_choices ); // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotValidated update_post_meta( $post_id, '_botiga_sidebar_layout', $sidebar_layout ); } public function render_meta_box_content( $post ) { // Add an nonce field so we can check for it later. wp_nonce_field( 'botiga_single_page_box', 'botiga_single_page_box_nonce' ); $page_builder_mode = get_post_meta( $post->ID, '_botiga_page_builder_mode', true ); $sidebar_layout = get_post_meta( $post->ID, '_botiga_sidebar_layout', true ); ?>