PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.1.7.3.1
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.1.7.3.1
4.4.8 4.4.7 4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 4.4.0 4.3.9.1 4.3.9 4.3.8 4.3.7 4.1.6.9 4.1.6.9.1 4.1.6.9.2 4.1.6.9.3 4.1.6.9.4 4.1.7 4.1.7.1 4.1.7.2 4.1.7.3 4.1.7.3.1 4.1.7.3.2 4.2.0 All 139 releases
learnpress / inc / admin / views / meta-boxes / fields / extra.php

extra.php in LearnPress – WordPress LMS Plugin for Create and Sell Online Courses 4.1.7.3.1, at inc/admin/views/meta-boxes/fields/extra.php

61 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * LP_Meta_Box_Duration_Attribute
5 *
6 * @author tungnx
7 * @version 1.0.0
8 * @since 4.0.0
9 */
10 class LP_Meta_Box_Extra_Field extends LP_Meta_Box_Field {
11
12 /**
13 * Constructor.
14 *
15 * @param string $label
16 * @param string $description
17 * @param mixed $default
18 * @param array $extra
19 */
20 public function __construct( $label = '', $description = '', $default = '', $extra = array() ) {
21 parent::__construct( $label, $description, $default, $extra );
22 }
23
24 public function output( $thepostid ) {
25 $fields = $this->meta_value( $thepostid );
26 ?>
27
28 <div class="form-field lp_course_extra_meta_box">
29 <label for="<?php echo esc_attr( $this->id ); ?>">
30 <?php echo wp_kses_post( $this->label ); ?>
31 </label>
32 <div class="lp_course_extra_meta_box__content">
33 <div class="lp_course_extra_meta_box__fields">
34 <?php if ( ! empty( $fields[0][0] ) ) : ?>
35 <?php foreach ( $fields as $field ) : ?>
36 <div class="lp_course_extra_meta_box__field">
37 <span class="sort"></span>
38 <input name="<?php echo esc_attr( $this->id ); ?>[]"
39 value="<?php echo esc_attr( $field ); ?>"
40 type="text" class="lp_course_extra_meta_box__input">
41 <a href="#" class="delete"></a>
42 </div>
43 <?php endforeach; ?>
44 <?php endif; ?>
45 </div>
46
47 <a href="#" class="button button-primary lp_course_extra_meta_box__add" data-add="<?php echo esc_attr( '<div class="lp_course_extra_meta_box__field"><span class="sort"></span></a><input name="' . $this->id . '[]" value="" type="text" class="lp_course_extra_meta_box__input"><a href="#" class="delete"></a></div>' ); ?>">
48 <?php esc_html_e( '+ Add more', 'learnpress' ); ?>
49 </a>
50 </div>
51 </div>
52 <?php
53 }
54
55 public function save( $post_id ) {
56 $fields = isset( $_POST[ $this->id ] ) ? LP_Helper::sanitize_params_submitted( $_POST[ $this->id ], 'html' ) : array();
57
58 update_post_meta( $post_id, $this->id, $fields );
59 }
60 }
61