id ) ) { return; } $field = $this->extra; $field['id'] = $this->id; $field['default'] = $this->default; $field['description'] = $this->description; $field['label'] = $this->label; $field['class'] = $field['class'] ?? 'short'; $field['style'] = $field['style'] ?? ''; $field['wrapper_class'] = $field['wrapper_class'] ?? ''; $field['default'] = ( ! $this->meta_value( $thepostid ) && isset( $field['default'] ) ) ? $field['default'] : $this->meta_value( $thepostid ); $field['value'] = $field['value'] ?? $field['default']; $field['name'] = $field['name'] ?? $field['id']; $field['mime_type'] = isset( $field['mime_type'] ) ? implode( ',', $field['mime_type'] ) : ''; $field['multil'] = isset( $field['multil'] ) && $field['multil']; $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 = LP_Request::get_param( $this->id ); if ( ! empty( $value ) ) { $value = explode( ',', $value ); if ( ! empty( $value ) ) { $value = array_map( 'absint', $value ); } } else { $value = $this->default ?? ''; } update_post_meta( $post_id, $this->id, $value ); return $value; } }