title = ucfirst( $slug ); } if( empty( $post_type ) ) { return; } $this->title = $title; $this->slug = $slug; $this->post_type = $post_type; $this->context = $context; $this->priority = $priority; $this->scene = new WPVR_Scene(); $this->video = new WPVR_Video(); $this->general = new WPVR_General(); add_action( 'add_meta_boxes', array( $this, 'register' ) ); } /** * Register custom meta box * * @param string $post_type * * @return void * @since 8.0.0 */ public function register( $post_type ) { if ( $post_type == $this->post_type ) { add_meta_box( $this->slug, $this->title, array( $this, 'render' ), $post_type, $this->context, $this->priority ); } } /** * Render custom meta box * * @param object $post * * @return void * @since 8.0.0 */ public function render( $post ) { $primary = WPVR_Meta_Field::get_primary_meta_fields(); $post_meta_data = get_post_meta($post->ID, 'panodata', true); $post_meta_data = (is_array($post_meta_data)) ? $post_meta_data : array($post_meta_data); $postdata = array_merge($primary, $post_meta_data); // active tab variables $active_tab = 'scene'; $scene_active_tab = 1; $hotspot_active_tab = 1; if (isset($_GET['active_tab'])) { $active_tab = sanitize_text_field($_GET['active_tab']); } if (isset($_GET['scene'])) { $scene_active_tab = sanitize_text_field($_GET['scene']); } if (isset($_GET['hotspot'])) { $hotspot_active_tab = sanitize_text_field($_GET['hotspot']); } // Start custom meta box rendering ob_start(); ?>
scene->render_scene($postdata); ?>
general->render_setting($postdata); ?>
video->render_video($postdata); ?>