> */ public static function fields() { return array( 'headline' => array( 'label' => __( 'Headline / Review Title', 'advanced-testimonial' ), 'type' => 'text', ), 'video' => array( 'label' => __( 'Video URL (YouTube, Vimeo or MP4)', 'advanced-testimonial' ), 'type' => 'url', ), 'company' => array( 'label' => __( 'Company', 'advanced-testimonial' ), 'type' => 'text', ), 'designation' => array( 'label' => __( 'Designation / Job Title', 'advanced-testimonial' ), 'type' => 'text', ), 'location' => array( 'label' => __( 'Location', 'advanced-testimonial' ), 'type' => 'text', ), 'website' => array( 'label' => __( 'Website', 'advanced-testimonial' ), 'type' => 'url', ), 'email' => array( 'label' => __( 'Email (optional)', 'advanced-testimonial' ), 'type' => 'email', ), 'rating' => array( 'label' => __( 'Rating', 'advanced-testimonial' ), 'type' => 'rating', ), 'review_date' => array( 'label' => __( 'Review Date', 'advanced-testimonial' ), 'type' => 'date', ), 'verified' => array( 'label' => __( 'Verified Customer', 'advanced-testimonial' ), 'type' => 'checkbox', ), 'company_logo' => array( 'label' => __( 'Company Logo', 'advanced-testimonial' ), 'type' => 'media', ), 'social_twitter' => array( 'label' => __( 'X / Twitter URL', 'advanced-testimonial' ), 'type' => 'url', ), 'social_linkedin' => array( 'label' => __( 'LinkedIn URL', 'advanced-testimonial' ), 'type' => 'url', ), 'social_facebook' => array( 'label' => __( 'Facebook URL', 'advanced-testimonial' ), 'type' => 'url', ), ); } /** * Register the meta box. * * @return void */ public function add_meta_box() { add_meta_box( 'advanced-testimonial-details', __( 'Testimonial Details', 'advanced-testimonial' ), array( $this, 'render' ), CPT::POST_TYPE, 'normal', 'high' ); } /** * Render the meta box. * * @param \WP_Post $post Current post. * @return void */ public function render( $post ) { wp_nonce_field( self::NONCE_ACTION, self::NONCE_NAME ); echo '
'; echo ''; } /** * Render a single field control. * * @param string $name Field name. * @param array $field Field definition. * @param mixed $value Stored value. * @param string $id Element id. * @return void */ private function render_control( $name, $field, $value, $id ) { $key = Helpers::meta_key( $name ); switch ( $field['type'] ) { case 'rating': $rating_val = Helpers::clamp_rating( $value ); echo ''; break; case 'checkbox': echo ''; break; case 'media': $attachment_id = (int) $value; $preview = $attachment_id ? wp_get_attachment_image( $attachment_id, 'thumbnail', false, array( 'class' => 'at-media-preview-img' ) ) : ''; echo '