id ) ) { return; } $field = $this->extra; $field['id'] = $this->id; $field['default'] = $this->default; $field['description'] = $this->description; $field['label'] = $this->label; $field['class'] = isset( $field['class'] ) ? $field['class'] : 'short'; $field['style'] = isset( $field['style'] ) ? $field['style'] : ''; $field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : ''; $field['default'] = ( ! $this->meta_value( $thepostid ) && isset( $field['default'] ) ) ? $field['default'] : $this->meta_value( $thepostid ); $field['value'] = isset( $field['value'] ) ? $field['value'] : $field['default']; $field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id']; $field['mime_type'] = isset( $field['mime_type'] ) ? implode( ',', $field['mime_type'] ) : ''; $field['multil'] = ( isset( $field['multil'] ) && $field['multil'] ) ? true : false; $field['desc_tip'] = isset( $field['desc_tip'] ) ? $field['desc_tip'] : false; // Custom attribute handling $custom_attributes = array(); if ( ! empty( $field['custom_attributes'] ) && is_array( $field['custom_attributes'] ) ) { foreach ( $field['custom_attributes'] as $attribute => $custom_attribute ) { $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $custom_attribute ) . '"'; } } echo '
'; echo '
'; echo ''; echo ''; echo '

'; echo '' . esc_html__( '+ Add media', 'learnpress' ) . ''; if ( ! empty( $field['description'] ) && false !== $field['desc_tip'] ) { learn_press_quick_tip( $field['description'] ); } echo '

'; if ( ! empty( $field['description'] ) && false === $field['desc_tip'] ) { echo '' . wp_kses_post( $field['description'] ) . ''; } echo '
'; echo '
'; } public function save( $post_id ) { $value = ! empty( $_POST[ $this->id ] ) ? wp_unslash( array_filter( explode( ',', $_POST[ $this->id ] ) ) ) : ''; update_post_meta( $post_id, $this->id, $value ); } }