PluginProbe
UiCore Elements – Free widgets and templates for Elementor / 1.3.17
UiCore Elements – Free widgets and templates for Elementor v1.3.17
1.3.17 1.3.16 trunk 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.16 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 All 41 releases
← All changes | includes/widgets/post-grid.php +204 -204 1.2.21.3.17 View file →
@@ -1,5 +1,6 @@
1 1 <?php
2 +
2 3 namespace UiCoreElements;
3 4
4 5 use Elementor\Controls_Manager;
5 6 use Elementor\Group_Control_Border;
@@ -69,12 +70,13 @@
69 70 public function get_scripts()
70 71 {
71 72 return [];
72 73 }
73 - public function has_widget_inner_wrapper(): bool {
74 - // TODO: remove after 3.30, when the full deprecation of widget innet wrapper is ready
75 - return ! \Elementor\Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
76 - }
74 + public function has_widget_inner_wrapper(): bool
75 + {
76 + // TODO: remove after Optmized Markup experiment is merged to the core
77 + return ! \Elementor\Plugin::$instance->experiments->is_feature_active('e_optimized_markup');
78 + }
77 79
78 80 public function on_import($element)
79 81 {
80 82 if (!get_post_type_object($element['settings']['posts-filter_post_type'])) {
@@ -142,236 +144,236 @@
142 144 $this->start_controls_section('section_post_grid_layout', [
143 145 'label' => esc_html__('Layout', 'uicore-elements'),
144 146 ]);
145 147 $this->add_control(
146 - 'layout',
147 - [
148 - 'label' => __( 'Item Style', 'uicore-elements' ),
149 - 'type' => Controls_Manager::SELECT,
150 - 'default' => 'default',
151 - 'options' => [
152 - 'default' => __( 'Default', 'uicore-elements' ),
153 - 'classic' => __( 'classic', 'uicore-elements' ),
154 - 'grid' => __( 'Grid', 'uicore-elements' ),
155 - 'horizontal' => __( 'Horizontal', 'uicore-elements' ),
156 - 'masonry' => __( 'Masonry', 'uicore-elements' ),
157 - ],
148 + 'layout',
149 + [
150 + 'label' => __('Item Style', 'uicore-elements'),
151 + 'type' => Controls_Manager::SELECT,
152 + 'default' => 'default',
153 + 'options' => [
154 + 'default' => __('Default', 'uicore-elements'),
155 + 'classic' => __('classic', 'uicore-elements'),
156 + 'grid' => __('Grid', 'uicore-elements'),
157 + 'horizontal' => __('Horizontal', 'uicore-elements'),
158 + 'masonry' => __('Masonry', 'uicore-elements'),
159 + ],
158 160 'condition' => array(
159 161 'posts-filter_post_type!' => 'portfolio',
160 162 ),
161 - ]
162 - );
163 + ]
164 + );
163 165
164 166 $this->add_control(
165 - 'box_style',
166 - [
167 - 'label' => __( 'layout', 'uicore-elements' ),
168 - 'type' => Controls_Manager::SELECT,
169 - 'default' => 'default',
170 - 'options' => [
171 - 'default' => __( 'Default', 'uicore-elements' ),
172 - 'boxed' => __( 'Boxed', 'uicore-elements' ),
173 - 'boxed-creative' => __( 'Boxed Creative', 'uicore-elements' ),
174 - 'cover' => __( 'Cover', 'uicore-elements' ),
175 - ],
167 + 'box_style',
168 + [
169 + 'label' => __('layout', 'uicore-elements'),
170 + 'type' => Controls_Manager::SELECT,
171 + 'default' => 'default',
172 + 'options' => [
173 + 'default' => __('Default', 'uicore-elements'),
174 + 'boxed' => __('Boxed', 'uicore-elements'),
175 + 'boxed-creative' => __('Boxed Creative', 'uicore-elements'),
176 + 'cover' => __('Cover', 'uicore-elements'),
177 + ],
176 178 'condition' => array(
177 179 'posts-filter_post_type!' => 'portfolio',
178 180 ),
179 - ]
180 - );
181 + ]
182 + );
181 183
182 184 $this->add_control(
183 - 'box_ratio',
184 - [
185 - 'label' => __( 'Image Ratio', 'uicore-elements' ),
186 - 'type' => Controls_Manager::SELECT,
187 - 'default' => 'default',
188 - 'options' => [
189 - 'default' => __( 'Default', 'uicore-elements' ),
190 - 'square' => __( 'Square', 'uicore-elements' ),
191 - 'landscape' => __( 'Landscape', 'uicore-elements' ),
192 - 'portrait' => __( 'Portrait', 'uicore-elements' ),
193 - ],
185 + 'box_ratio',
186 + [
187 + 'label' => __('Image Ratio', 'uicore-elements'),
188 + 'type' => Controls_Manager::SELECT,
189 + 'default' => 'default',
190 + 'options' => [
191 + 'default' => __('Default', 'uicore-elements'),
192 + 'square' => __('Square', 'uicore-elements'),
193 + 'landscape' => __('Landscape', 'uicore-elements'),
194 + 'portrait' => __('Portrait', 'uicore-elements'),
195 + ],
194 196 'condition' => array(
195 197 'posts-filter_post_type!' => 'portfolio',
196 198 ),
197 - ]
198 - );
199 + ]
200 + );
199 201 $this->add_control(
200 - 'extra_author',
201 - [
202 - 'label' => __( 'Author', 'uicore-elements' ),
203 - 'type' => Controls_Manager::SWITCHER,
204 - 'return_value' => 'yes',
205 - 'default' => '',
202 + 'extra_author',
203 + [
204 + 'label' => __('Author', 'uicore-elements'),
205 + 'type' => Controls_Manager::SWITCHER,
206 + 'return_value' => 'yes',
207 + 'default' => '',
206 208 'reder_type' => 'template',
207 - 'condition' => array(
209 + 'condition' => array(
208 210 'posts-filter_post_type!' => 'portfolio',
209 211 ),
210 - ]
211 - );
212 + ]
213 + );
212 214 $this->add_control(
213 - 'extra_date',
214 - [
215 - 'label' => __( 'Date', 'uicore-elements' ),
216 - 'type' => Controls_Manager::SWITCHER,
217 - 'return_value' => 'yes',
218 - 'default' => '',
215 + 'extra_date',
216 + [
217 + 'label' => __('Date', 'uicore-elements'),
218 + 'type' => Controls_Manager::SWITCHER,
219 + 'return_value' => 'yes',
220 + 'default' => '',
219 221 'reder_type' => 'template',
220 - 'condition' => array(
222 + 'condition' => array(
221 223 'posts-filter_post_type!' => 'portfolio',
222 224 ),
223 - ]
224 - );
225 + ]
226 + );
225 227 $this->add_control(
226 - 'extra_excerpt',
227 - [
228 - 'label' => __( 'Excerpt', 'uicore-elements' ),
229 - 'type' => Controls_Manager::SWITCHER,
230 - 'return_value' => 'yes',
231 - 'default' => '',
228 + 'extra_excerpt',
229 + [
230 + 'label' => __('Excerpt', 'uicore-elements'),
231 + 'type' => Controls_Manager::SWITCHER,
232 + 'return_value' => 'yes',
233 + 'default' => '',
232 234 'reder_type' => 'template',
233 - 'condition' => array(
235 + 'condition' => array(
234 236 'posts-filter_post_type!' => 'portfolio',
235 237 ),
236 - ]
237 - );
238 + ]
239 + );
238 240 $this->add_control(
239 - 'extra_category',
240 - [
241 - 'label' => __( 'Category', 'uicore-elements' ),
242 - 'type' => Controls_Manager::SWITCHER,
243 - 'return_value' => 'yes',
244 - 'default' => '',
241 + 'extra_category',
242 + [
243 + 'label' => __('Category', 'uicore-elements'),
244 + 'type' => Controls_Manager::SWITCHER,
245 + 'return_value' => 'yes',
246 + 'default' => '',
245 247 'reder_type' => 'template',
246 - 'condition' => array(
248 + 'condition' => array(
247 249 'posts-filter_post_type!' => 'portfolio',
248 250 ),
249 - ]
250 - );
251 + ]
252 + );
251 253
252 254 $this->end_controls_section();
253 255
254 256
255 257 $this->start_controls_section(
256 - 'section_style_typo',
257 - [
258 - 'label' => __( 'Content Style', 'uicore-elements' ),
259 - 'tab' => Controls_Manager::TAB_STYLE,
260 - ]
261 - );
258 + 'section_style_typo',
259 + [
260 + 'label' => __('Content Style', 'uicore-elements'),
261 + 'tab' => Controls_Manager::TAB_STYLE,
262 + ]
263 + );
262 264
263 265 $this->add_control(
264 - 'post_heading_title',
265 - [
266 - 'label' => esc_html__( 'Post Title', 'uicore-elements' ),
267 - 'type' => Controls_Manager::HEADING,
268 - 'separator' => 'before',
269 - ]
270 - );
266 + 'post_heading_title',
267 + [
268 + 'label' => esc_html__('Post Title', 'uicore-elements'),
269 + 'type' => Controls_Manager::HEADING,
270 + 'separator' => 'before',
271 + ]
272 + );
271 273
272 - $this->add_control(
273 - 'post_title_color',
274 - [
275 - 'label' => esc_html__( 'Color', 'uicore-elements' ),
276 - 'type' => Controls_Manager::COLOR,
277 - 'default' => '',
278 - 'selectors' => [
279 - '{{WRAPPER}} .uicore-post-title' => 'color: {{VALUE}};',
280 - ],
281 - ]
282 - );
274 + $this->add_control(
275 + 'post_title_color',
276 + [
277 + 'label' => esc_html__('Color', 'uicore-elements'),
278 + 'type' => Controls_Manager::COLOR,
279 + 'default' => '',
280 + 'selectors' => [
281 + '{{WRAPPER}} .uicore-post-title' => 'color: {{VALUE}};',
282 + ],
283 + ]
284 + );
283 285
284 - $this->add_group_control(
285 - Group_Control_Typography::get_type(),
286 - [
287 - 'name' => 'post_title_typography',
288 - 'selector' => '{{WRAPPER}} .uicore-post-title, {{WRAPPER}} .uicore-post-title',
289 - ]
290 - );
286 + $this->add_group_control(
287 + Group_Control_Typography::get_type(),
288 + [
289 + 'name' => 'post_title_typography',
290 + 'selector' => '{{WRAPPER}} .uicore-post-title, {{WRAPPER}} .uicore-post-title',
291 + ]
292 + );
291 293
292 294
293 - $this->add_control(
294 - 'extra_excerpt_heading',
295 - [
296 - 'label' => esc_html__( 'Excerpt', 'uicore-elements' ),
297 - 'type' => Controls_Manager::HEADING,
298 - 'separator' => 'before',
299 - ]
300 - );
295 + $this->add_control(
296 + 'extra_excerpt_heading',
297 + [
298 + 'label' => esc_html__('Excerpt', 'uicore-elements'),
299 + 'type' => Controls_Manager::HEADING,
300 + 'separator' => 'before',
301 + ]
302 + );
301 303 $this->add_responsive_control(
302 - 'extra_excerpt_bottom_space',
303 - [
304 - 'label' => esc_html__( 'Spacing', 'uicore-elements' ),
305 - 'type' => Controls_Manager::SLIDER,
306 - 'range' => [
307 - 'px' => [
308 - 'min' => 0,
309 - 'max' => 100,
310 - ],
311 - ],
312 - 'selectors' => [
313 - '{{WRAPPER}} .uicore-post-info-wrapper > p' => 'margin-top: {{SIZE}}{{UNIT}};',
314 - ],
315 - ]
316 - );
304 + 'extra_excerpt_bottom_space',
305 + [
306 + 'label' => esc_html__('Spacing', 'uicore-elements'),
307 + 'type' => Controls_Manager::SLIDER,
308 + 'range' => [
309 + 'px' => [
310 + 'min' => 0,
311 + 'max' => 100,
312 + ],
313 + ],
314 + 'selectors' => [
315 + '{{WRAPPER}} .uicore-post-info-wrapper > p' => 'margin-top: {{SIZE}}{{UNIT}};',
316 + ],
317 + ]
318 + );
317 319
318 - $this->add_control(
319 - 'extra_excerpt_color',
320 - [
321 - 'label' => esc_html__( 'Color', 'uicore-elements' ),
322 - 'type' => Controls_Manager::COLOR,
323 - 'default' => '',
324 - 'selectors' => [
325 - '{{WRAPPER}} .uicore-post-info-wrapper > p' => 'color: {{VALUE}};',
326 - ],
327 - ]
328 - );
320 + $this->add_control(
321 + 'extra_excerpt_color',
322 + [
323 + 'label' => esc_html__('Color', 'uicore-elements'),
324 + 'type' => Controls_Manager::COLOR,
325 + 'default' => '',
326 + 'selectors' => [
327 + '{{WRAPPER}} .uicore-post-info-wrapper > p' => 'color: {{VALUE}};',
328 + ],
329 + ]
330 + );
329 331
330 - $this->add_group_control(
331 - Group_Control_Typography::get_type(),
332 - [
333 - 'name' => 'extra_excerpt_typography',
334 - 'selector' => '{{WRAPPER}} .uicore-post-info-wrapper > p',
335 - ]
336 - );
332 + $this->add_group_control(
333 + Group_Control_Typography::get_type(),
334 + [
335 + 'name' => 'extra_excerpt_typography',
336 + 'selector' => '{{WRAPPER}} .uicore-post-info-wrapper > p',
337 + ]
338 + );
337 339
338 340
339 341 $this->add_responsive_control(
340 - 'box_padding',
341 - [
342 - 'label' => esc_html__( 'Content Padding', 'uicore-elements' ),
343 - 'type' => Controls_Manager::DIMENSIONS,
344 - 'size_units' => [ 'px', 'em', '%', 'rem' ],
342 + 'box_padding',
343 + [
344 + 'label' => esc_html__('Content Padding', 'uicore-elements'),
345 + 'type' => Controls_Manager::DIMENSIONS,
346 + 'size_units' => ['px', 'em', '%', 'rem'],
345 347 'separator' => 'before',
346 - 'selectors' => [
347 - '{{WRAPPER}} .uicore-blog-grid .uicore-post .uicore-post-info' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}!important;',
348 - ],
349 - ]
350 - );
348 + 'selectors' => [
349 + '{{WRAPPER}} .uicore-blog-grid .uicore-post .uicore-post-info' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}!important;',
350 + ],
351 + ]
352 + );
351 353
352 354 $this->add_group_control(
353 - Group_Control_Background::get_type(),
354 - [
355 - 'name' => 'box_background',
356 - 'selector' => '{{WRAPPER}} .uicore-blog-grid .uicore-post',
357 - ]
358 - );
355 + Group_Control_Background::get_type(),
356 + [
357 + 'name' => 'box_background',
358 + 'selector' => '{{WRAPPER}} .uicore-blog-grid .uicore-post',
359 + ]
360 + );
359 361
360 362 $this->add_group_control(
361 - Group_Control_Border::get_type(),
362 - [
363 - 'name' => 'box_border',
364 - 'selector' => '{{WRAPPER}} .uicore-blog-grid .uicore-post',
363 + Group_Control_Border::get_type(),
364 + [
365 + 'name' => 'box_border',
366 + 'selector' => '{{WRAPPER}} .uicore-blog-grid .uicore-post',
365 367 'separator' => 'before',
366 - ]
367 - );
368 + ]
369 + );
368 370
369 - $this->add_control(
370 - 'box_border_radius',
371 - [
372 - 'label' => esc_html__( 'Border Radius', 'uicore-elements' ),
373 - 'type' => Controls_Manager::SLIDER,
371 + $this->add_control(
372 + 'box_border_radius',
373 + [
374 + 'label' => esc_html__('Border Radius', 'uicore-elements'),
375 + 'type' => Controls_Manager::SLIDER,
374 376 'range' => [
375 377 'px' => [
376 378 'min' => 0,
377 379 'max' => 100,
@@ -376,21 +378,21 @@
376 378 'min' => 0,
377 379 'max' => 100,
378 380 ],
379 381 ],
380 - 'selectors' => [
381 - '{{WRAPPER}} .uicore-blog-grid .uicore-post' => '--uicore-blog--radius: {{SIZE}}{{UNIT}};',
382 - ],
383 - ]
384 - );
382 + 'selectors' => [
383 + '{{WRAPPER}} .uicore-blog-grid .uicore-post' => '--uicore-blog--radius: {{SIZE}}{{UNIT}};',
384 + ],
385 + ]
386 + );
385 387
386 - $this->add_group_control(
387 - Group_Control_Box_Shadow::get_type(),
388 - [
389 - 'name' => 'box_shadow_style',
390 - 'selector' => '{{WRAPPER}} .uicore-blog-grid .uicore-post',
391 - ]
392 - );
388 + $this->add_group_control(
389 + Group_Control_Box_Shadow::get_type(),
390 + [
391 + 'name' => 'box_shadow_style',
392 + 'selector' => '{{WRAPPER}} .uicore-blog-grid .uicore-post',
393 + ]
394 + );
393 395
394 396
395 397 $this->end_controls_section();
396 398 }
@@ -398,11 +400,11 @@
398 400 public function query_posts($posts_per_page, $type = null)
399 401 {
400 402 $query_args = Query::get_query_args('posts-filter', $this->get_settings());
401 403
402 - if($type === 'portfolio') {
403 - $query_args['orderby'] = 'menu_order date';
404 - }
404 + if ($type === 'portfolio') {
405 + $query_args['orderby'] = 'menu_order date';
406 + }
405 407
406 408 $query_args['posts_per_page'] = $posts_per_page;
407 409
408 410 $this->_query = new \WP_Query($query_args);
@@ -414,9 +416,9 @@
414 416
415 417 $col = $settings['col_number']['size'];
416 418 $type = $settings['posts-filter_post_type'];
417 419
418 - if($type != 'portfolio'){
420 + if ($type != 'portfolio') {
419 421 $type = str_replace(' ', '-', $settings['box_style']);
420 422 }
421 423
422 424 $this->query_posts($settings['item_limit']['size'], $type);
@@ -429,9 +431,9 @@
429 431
430 432
431 433 if ($type === 'portfolio') {
432 434
433 - if(!class_exists('\UiCore\Portfolio\Frontend')){
435 + if (!class_exists('\UiCore\Portfolio\Frontend')) {
434 436 require_once UICORE_INCLUDES . '/portfolio/class-template.php';
435 437 require_once UICORE_INCLUDES . '/portfolio/class-frontend.php';
436 438 }
437 439 Portfolio\Frontend::frontend_css(true);
@@ -436,19 +438,18 @@
436 438 }
437 439 Portfolio\Frontend::frontend_css(true);
438 440 $portfolio = new Portfolio\Template('display');
439 441 $portfolio->portfolio_layout($wp_query, null, $col);
440 -
441 442 } else {
442 443 $layout = $settings['layout'] === 'default' ? null : $settings['layout'];
443 444 $style = $settings['box_style'] === 'default' ? null : $settings['box_style'];
444 445
445 - if(isset($settings['box_ratio'])){
446 + if (isset($settings['box_ratio'])) {
446 447 $ratio = $settings['box_ratio'] === 'default' ? null : $settings['box_ratio'];
447 - }else{//Fallback for older versions
448 + } else { //Fallback for older versions
448 449 $ratio = null;
449 450 }
450 - if(isset($settings['extra_author'])){
451 + if (isset($settings['extra_author'])) {
451 452 $extra = [
452 453 'author' => $this->is_option('extra_author', 'yes'),
453 454 'date' => $this->is_option('extra_date', 'yes'),
454 455 'excerpt' => $this->is_option('extra_excerpt', 'yes'),
@@ -453,9 +454,9 @@
453 454 'date' => $this->is_option('extra_date', 'yes'),
454 455 'excerpt' => $this->is_option('extra_excerpt', 'yes'),
455 456 'category' => $this->is_option('extra_category', 'yes')
456 457 ];
457 - }else{ //Fallback for older versions
458 + } else { //Fallback for older versions
458 459 $extra = [
459 460 'author' => null,
460 461 'date' => null,
461 462 'excerpt' => null,
@@ -463,16 +464,15 @@
463 464 ];
464 465 }
465 466
466 467
467 - if(!class_exists('\UiCore\Blog\Frontend')){
468 + if (!class_exists('\UiCore\Blog\Frontend')) {
468 469 require_once UICORE_INCLUDES . '/blog/class-template.php';
469 470 require_once UICORE_INCLUDES . '/blog/class-frontend.php';
470 471 }
471 472 Blog\Frontend::frontend_css(true);
472 473 $blog = new Blog\Template('display');
473 - $blog->blog_layout($wp_query, $layout, $col,null,$ratio,$extra, $style);
474 + $blog->blog_layout($wp_query, $layout, $col, null, $ratio, $extra, $style);
474 475 }
475 -
476 476 }
477 477 }
478 478 \Elementor\Plugin::instance()->widgets_manager->register(new PostGrid());