PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.4.9
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.4.9
4.4.9 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 All 140 releases
← All changes | config/elementor/course/list-courses-by-page.php +200 -200 4.3.9 → 4.4.9 View file →
@@ -1,200 +1,200 @@
1 -<?php
2 -/**
3 - * Elementor Controls for widget Courses.
4 - *
5 - * @since 4.2.3
6 - * @version 1.0.1
7 - */
8 -
9 -use Elementor\Controls_Manager;
10 -use LearnPress\ExternalPlugin\Elementor\LPElementorControls;
11 -use LearnPress\Models\Courses;
12 -
13 -$option_data = [];
14 -if ( isset( $options ) ) {
15 - $option_data = $options;
16 -}
17 -
18 -$filter = new LP_Course_Filter();
19 -$filter->limit = - 1;
20 -$filter->only_fields = array( 'ID', 'post_title' );
21 -$filter->post_status = [ 'publish' ];
22 -$courses_obj = (array) Courses::get_courses( $filter );
23 -$courses = [];
24 -$categories = [];
25 -
26 -// Only show courses and categories in Admin
27 -if ( is_admin() ) {
28 - foreach ( $courses_obj as $course ) {
29 - $courses[ $course->ID ] = $course->post_title;
30 - }
31 -
32 - $categories_obj = LP_Course::get_all_categories();
33 - foreach ( $categories_obj as $category ) {
34 - $categories[ $category->term_id ] = $category->name;
35 - }
36 -}
37 -
38 -// Fields tab content
39 -$content_fields = array_merge(
40 - LPElementorControls::add_fields_in_section(
41 - 'skin',
42 - esc_html__( 'Skin', 'learnpress' )
43 - ),
44 - LPElementorControls::add_fields_in_section(
45 - 'option_load_rest_api',
46 - esc_html__( 'Option load REST API', 'learnpress' ),
47 - Controls_Manager::TAB_CONTENT,
48 - [
49 - 'courses_rest' => LPElementorControls::add_control_type(
50 - 'courses_rest',
51 - 'Courses REST API enable',
52 - 'no',
53 - Controls_Manager::SWITCHER,
54 - [
55 - 'label_on' => esc_html__( 'Yes', 'learnpress' ),
56 - 'label_off' => esc_html__( 'No', 'learnpress' ),
57 - 'return_value' => 'yes',
58 - 'default' => 'no',
59 - ]
60 - ),
61 - 'courses_rest_no_load_page' => LPElementorControls::add_control_type(
62 - 'courses_rest_no_load_page',
63 - 'Courses REST no load page',
64 - 'yes',
65 - Controls_Manager::SWITCHER,
66 - [
67 - 'label_on' => esc_html__( 'Yes', 'learnpress' ),
68 - 'label_off' => esc_html__( 'No', 'learnpress' ),
69 - 'return_value' => 'yes',
70 - 'default' => 'no',
71 - 'condition' => [
72 - 'courses_rest' => 'yes',
73 - ],
74 - ]
75 - ),
76 - ]
77 - ),
78 - LPElementorControls::add_fields_in_section(
79 - 'layout',
80 - esc_html__( 'Layout', 'learnpress' ),
81 - Controls_Manager::TAB_CONTENT,
82 - [
83 - 'el_result_count' => LPElementorControls::add_control_type(
84 - 'el_result_count',
85 - 'Show result count',
86 - 'yes',
87 - Controls_Manager::SWITCHER,
88 - [
89 - 'label_on' => esc_html__( 'Yes', 'learnpress' ),
90 - 'label_off' => esc_html__( 'No', 'learnpress' ),
91 - 'return_value' => 'yes',
92 - 'default' => 'yes',
93 - ]
94 - ),
95 - 'el_sorting' => LPElementorControls::add_control_type(
96 - 'el_sorting',
97 - 'Show sorting',
98 - 'yes',
99 - Controls_Manager::SWITCHER,
100 - [
101 - 'label_on' => esc_html__( 'Yes', 'learnpress' ),
102 - 'label_off' => esc_html__( 'No', 'learnpress' ),
103 - 'return_value' => 'yes',
104 - 'default' => 'yes',
105 - ]
106 - ),
107 - ]
108 - ),
109 - LPElementorControls::add_fields_in_section(
110 - 'query',
111 - esc_html__( 'Query', 'learnpress' ),
112 - Controls_Manager::TAB_CONTENT,
113 - [
114 - 'courses_limit' => LPElementorControls::add_control_type(
115 - 'courses_limit',
116 - esc_html__( 'Courses limit', 'learnpress' ),
117 - 0,
118 - Controls_Manager::NUMBER,
119 - [
120 - 'min' => 0,
121 - 'step' => 1,
122 - 'description' => esc_html__( 'Total courses you want to query, default 0 is no limit', 'learnpress' ),
123 - ]
124 - ),
125 - 'courses_per_page' => LPElementorControls::add_control_type(
126 - 'courses_per_page',
127 - esc_html__( 'Courses Per Page', 'learnpress' ),
128 - 8,
129 - Controls_Manager::NUMBER,
130 - [
131 - 'min' => 0,
132 - 'step' => 1,
133 - 'description' => esc_html__( 'Number courses show on 1 page. Default 0 is show all of Courses Limit', 'learnpress' ),
134 - ]
135 - ),
136 - 'courses_order_by_default' => LPElementorControls::add_control_type_select(
137 - 'courses_order_by_default',
138 - esc_html__( 'Order By Default', 'learnpress' ),
139 - [
140 - 'post_date' => esc_html__( 'Newest', 'learnpress' ),
141 - 'post_title' => esc_html__( 'Title a-z', 'learnpress' ),
142 - 'post_title_desc' => esc_html__( 'Title z-a', 'learnpress' ),
143 - 'price' => esc_html__( 'Price High to Low', 'learnpress' ),
144 - 'price_low' => esc_html__( 'Price Low to High', 'learnpress' ),
145 - 'popular' => esc_html__( 'Popular', 'learnpress' ),
146 - ],
147 - 'post_date'
148 - ),
149 - 'courses_category_ids' => LPElementorControls::add_control_type(
150 - 'courses_category_ids',
151 - esc_html__( 'Select Categories', 'learnpress' ),
152 - [],
153 - Controls_Manager::SELECT2,
154 - [
155 - 'multiple' => true,
156 - 'options' => $categories,
157 - ]
158 - ),
159 - ]
160 - ),
161 - LPElementorControls::add_fields_in_section(
162 - 'pagination',
163 - esc_html__( 'Pagination', 'learnpress' ),
164 - Controls_Manager::TAB_CONTENT,
165 - [
166 - 'pagination_type' => LPElementorControls::add_control_type_select(
167 - 'pagination_type',
168 - esc_html__( 'Pagination type', 'learnpress' ),
169 - [
170 - '' => esc_html__( 'Nonce', 'learnpress' ),
171 - 'number' => esc_html__( 'Number', 'learnpress' ),
172 - 'load-more' => esc_html__( 'Load more', 'learnpress' ),
173 - 'infinite' => esc_html__( 'Infinite scroll', 'learnpress' ),
174 - ],
175 - 'number'
176 - ),
177 - ]
178 - ),
179 - []
180 -);
181 -
182 -// Fields tab style
183 -$style_fields = array_merge(
184 - [],
185 - []
186 -);
187 -
188 -return apply_filters(
189 - 'learn-press/elementor/list-courses-by-page',
190 - array_merge(
191 - apply_filters(
192 - 'learn-press/elementor/list-courses-by-page/tab-content',
193 - $content_fields
194 - ),
195 - apply_filters(
196 - 'learn-press/elementor/list-courses-by-page/tab-styles',
197 - $style_fields
198 - )
199 - )
200 -);
1 +<?php
2 +/**
3 + * Elementor Controls for widget Courses.
4 + *
5 + * @since 4.2.3
6 + * @version 1.0.1
7 + */
8 +
9 +use Elementor\Controls_Manager;
10 +use LearnPress\ExternalPlugin\Elementor\LPElementorControls;
11 +use LearnPress\Models\Courses;
12 +
13 +$option_data = [];
14 +if ( isset( $options ) ) {
15 + $option_data = $options;
16 +}
17 +
18 +$filter = new LP_Course_Filter();
19 +$filter->limit = - 1;
20 +$filter->only_fields = array( 'ID', 'post_title' );
21 +$filter->post_status = [ 'publish' ];
22 +$courses_obj = (array) Courses::get_courses( $filter );
23 +$courses = [];
24 +$categories = [];
25 +
26 +// Only show courses and categories in Admin
27 +if ( is_admin() ) {
28 + foreach ( $courses_obj as $course ) {
29 + $courses[ $course->ID ] = $course->post_title;
30 + }
31 +
32 + $categories_obj = LP_Course::get_all_categories();
33 + foreach ( $categories_obj as $category ) {
34 + $categories[ $category->term_id ] = $category->name;
35 + }
36 +}
37 +
38 +// Fields tab content
39 +$content_fields = array_merge(
40 + LPElementorControls::add_fields_in_section(
41 + 'skin',
42 + esc_html__( 'Skin', 'learnpress' )
43 + ),
44 + LPElementorControls::add_fields_in_section(
45 + 'option_load_rest_api',
46 + esc_html__( 'Option load REST API', 'learnpress' ),
47 + Controls_Manager::TAB_CONTENT,
48 + [
49 + 'courses_rest' => LPElementorControls::add_control_type(
50 + 'courses_rest',
51 + 'Courses REST API enable',
52 + 'no',
53 + Controls_Manager::SWITCHER,
54 + [
55 + 'label_on' => esc_html__( 'Yes', 'learnpress' ),
56 + 'label_off' => esc_html__( 'No', 'learnpress' ),
57 + 'return_value' => 'yes',
58 + 'default' => 'no',
59 + ]
60 + ),
61 + 'courses_rest_no_load_page' => LPElementorControls::add_control_type(
62 + 'courses_rest_no_load_page',
63 + 'Courses REST no load page',
64 + 'yes',
65 + Controls_Manager::SWITCHER,
66 + [
67 + 'label_on' => esc_html__( 'Yes', 'learnpress' ),
68 + 'label_off' => esc_html__( 'No', 'learnpress' ),
69 + 'return_value' => 'yes',
70 + 'default' => 'no',
71 + 'condition' => [
72 + 'courses_rest' => 'yes',
73 + ],
74 + ]
75 + ),
76 + ]
77 + ),
78 + LPElementorControls::add_fields_in_section(
79 + 'layout',
80 + esc_html__( 'Layout', 'learnpress' ),
81 + Controls_Manager::TAB_CONTENT,
82 + [
83 + 'el_result_count' => LPElementorControls::add_control_type(
84 + 'el_result_count',
85 + 'Show result count',
86 + 'yes',
87 + Controls_Manager::SWITCHER,
88 + [
89 + 'label_on' => esc_html__( 'Yes', 'learnpress' ),
90 + 'label_off' => esc_html__( 'No', 'learnpress' ),
91 + 'return_value' => 'yes',
92 + 'default' => 'yes',
93 + ]
94 + ),
95 + 'el_sorting' => LPElementorControls::add_control_type(
96 + 'el_sorting',
97 + 'Show sorting',
98 + 'yes',
99 + Controls_Manager::SWITCHER,
100 + [
101 + 'label_on' => esc_html__( 'Yes', 'learnpress' ),
102 + 'label_off' => esc_html__( 'No', 'learnpress' ),
103 + 'return_value' => 'yes',
104 + 'default' => 'yes',
105 + ]
106 + ),
107 + ]
108 + ),
109 + LPElementorControls::add_fields_in_section(
110 + 'query',
111 + esc_html__( 'Query', 'learnpress' ),
112 + Controls_Manager::TAB_CONTENT,
113 + [
114 + 'courses_limit' => LPElementorControls::add_control_type(
115 + 'courses_limit',
116 + esc_html__( 'Courses limit', 'learnpress' ),
117 + 0,
118 + Controls_Manager::NUMBER,
119 + [
120 + 'min' => 0,
121 + 'step' => 1,
122 + 'description' => esc_html__( 'Total courses you want to query, default 0 is no limit', 'learnpress' ),
123 + ]
124 + ),
125 + 'courses_per_page' => LPElementorControls::add_control_type(
126 + 'courses_per_page',
127 + esc_html__( 'Courses Per Page', 'learnpress' ),
128 + 8,
129 + Controls_Manager::NUMBER,
130 + [
131 + 'min' => 0,
132 + 'step' => 1,
133 + 'description' => esc_html__( 'Number courses show on 1 page. Default 0 is show all of Courses Limit', 'learnpress' ),
134 + ]
135 + ),
136 + 'courses_order_by_default' => LPElementorControls::add_control_type_select(
137 + 'courses_order_by_default',
138 + esc_html__( 'Order By Default', 'learnpress' ),
139 + [
140 + 'post_date' => esc_html__( 'Newest', 'learnpress' ),
141 + 'post_title' => esc_html__( 'Title a-z', 'learnpress' ),
142 + 'post_title_desc' => esc_html__( 'Title z-a', 'learnpress' ),
143 + 'price' => esc_html__( 'Price High to Low', 'learnpress' ),
144 + 'price_low' => esc_html__( 'Price Low to High', 'learnpress' ),
145 + 'popular' => esc_html__( 'Popular', 'learnpress' ),
146 + ],
147 + 'post_date'
148 + ),
149 + 'courses_category_ids' => LPElementorControls::add_control_type(
150 + 'courses_category_ids',
151 + esc_html__( 'Select Categories', 'learnpress' ),
152 + [],
153 + Controls_Manager::SELECT2,
154 + [
155 + 'multiple' => true,
156 + 'options' => $categories,
157 + ]
158 + ),
159 + ]
160 + ),
161 + LPElementorControls::add_fields_in_section(
162 + 'pagination',
163 + esc_html__( 'Pagination', 'learnpress' ),
164 + Controls_Manager::TAB_CONTENT,
165 + [
166 + 'pagination_type' => LPElementorControls::add_control_type_select(
167 + 'pagination_type',
168 + esc_html__( 'Pagination type', 'learnpress' ),
169 + [
170 + '' => esc_html__( 'Nonce', 'learnpress' ),
171 + 'number' => esc_html__( 'Number', 'learnpress' ),
172 + 'load-more' => esc_html__( 'Load more', 'learnpress' ),
173 + 'infinite' => esc_html__( 'Infinite scroll', 'learnpress' ),
174 + ],
175 + 'number'
176 + ),
177 + ]
178 + ),
179 + []
180 +);
181 +
182 +// Fields tab style
183 +$style_fields = array_merge(
184 + [],
185 + []
186 +);
187 +
188 +return apply_filters(
189 + 'learn-press/elementor/list-courses-by-page',
190 + array_merge(
191 + apply_filters(
192 + 'learn-press/elementor/list-courses-by-page/tab-content',
193 + $content_fields
194 + ),
195 + apply_filters(
196 + 'learn-press/elementor/list-courses-by-page/tab-styles',
197 + $style_fields
198 + )
199 + )
200 +);