PluginProbe
Ultimate Post Kit – Elementor Post Grid, Post Carousel, Post Slider & Blog Layout Widgets / 4.0.9
Ultimate Post Kit – Elementor Post Grid, Post Carousel, Post Slider & Blog Layout Widgets v4.0.9
4.5.6 4.5.5 4.5.4 4.2.1 4.2.2 4.2.3 4.5.0 4.5.2 4.5.3 4.2.0 4.1.18 4.1.17 4.1.16 4.1.15 4.1.14 4.1.13 4.1.12 4.1.11 4.1.10 4.1.9 4.1.8 4.0.9 4.1.0 4.1.1 4.1.2 All 148 releases
ultimate-post-kit / modules / static-social-count / widgets / static-social-count.php

static-social-count.php in Ultimate Post Kit – Elementor Post Grid, Post Carousel, Post Slider & Blog Layout Widgets 4.0.9, at modules/static-social-count/widgets/static-social-count.php

836 lines 22.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace UltimatePostKit\Modules\StaticSocialCount\Widgets;
4
5 use Elementor\Controls_Manager;
6 use Elementor\Group_Control_Typography;
7 use Elementor\Group_Control_Border;
8 use Elementor\Group_Control_Background;
9 use Elementor\Repeater;
10 use Elementor\Icons_Manager;
11 use Elementor\Group_Control_Box_Shadow;
12 use UltimatePostKit\Includes\Controls\GroupQuery\Group_Control_Query;
13
14 if (!defined('ABSPATH')) {
15 exit;
16 }
17
18 class Static_Social_Count extends Group_Control_Query {
19 public function get_name() {
20 return 'upk-static-social-count';
21 }
22
23 public function get_title() {
24 return BDTUPK . esc_html__('Social Count (Static)', 'ultimate-post-kit');
25 }
26
27 public function get_icon() {
28 return 'upk-widget-icon upk-icon-static-social-count';
29 }
30
31 public function get_categories() {
32 return ['ultimate-post-kit'];
33 }
34
35 public function get_style_depends() {
36 if ($this->upk_is_edit_mode()) {
37 return ['upk-all-styles'];
38 } else {
39 return ['upk-font', 'upk-static-social-count'];
40 }
41 }
42 public function get_script_depends() {
43 if ($this->upk_is_edit_mode()) {
44 return ['upk-all-scripts'];
45 } else {
46 return ['upk-static-social-count'];
47 }
48 }
49
50 public function get_keywords() {
51 return ['post', 'grid', 'blog', 'recent', 'news', 'social-count', 'count'];
52 }
53
54 public function get_custom_help_url() {
55 return 'https://youtu.be/MmbdYPee9qw';
56 }
57
58 public function has_widget_inner_wrapper(): bool {
59 return ! \Elementor\Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' );
60 }
61 protected function is_dynamic_content(): bool {
62 return false;
63 }
64
65 protected function register_controls() {
66 $this->start_controls_section(
67 'section_layout',
68 [
69 'label' => esc_html__('Layout', 'ultimate-post-kit'),
70 ]
71 );
72
73 $this->add_control(
74 'select_style',
75 [
76 'label' => esc_html__('Select Style', 'ultimate-post-kit') . BDTUPK_NC,
77 'type' => Controls_Manager::SELECT,
78 'default' => '',
79 'options' => [
80 '' => esc_html__('Style 1', 'ultimate-post-kit'),
81 'upk-style-2' => esc_html__('Style 2', 'ultimate-post-kit'),
82 'upk-style-3' => esc_html__('Style 3', 'ultimate-post-kit'),
83 ],
84 ]
85 );
86
87 $this->add_responsive_control(
88 'grid_columns',
89 [
90 'label' => __('Columns', 'ultimate-post-kit'),
91 'type' => Controls_Manager::SELECT,
92 'default' => '4',
93 'tablet_default' => '4',
94 'mobile_default' => '1',
95 'options' => [
96 '1' => '1',
97 '2' => '2',
98 '3' => '3',
99 '4' => '4',
100 '5' => '5',
101 '6' => '6',
102 ],
103 'selectors' => [
104 '{{WRAPPER}} .upk-static-social-count' => ' grid-template-columns: repeat({{VALUE}}, 1fr);'
105 ],
106 // 'condition' => [
107 // 'select_layout' => 'grid'
108 // ]
109 ]
110 );
111
112 $this->add_responsive_control(
113 'social_icon_space_between',
114 [
115 'label' => esc_html__('Column Gap', 'ultimate-post-kit'),
116 'type' => Controls_Manager::SLIDER,
117 'size_units' => ['px'],
118 'range' => [
119 'px' => [
120 'min' => 0,
121 'max' => 100,
122 'step' => 1,
123 ]
124 ],
125 'selectors' => [
126 '{{WRAPPER}} .upk-static-social-count' => 'grid-gap: {{SIZE}}{{UNIT}};',
127 ],
128 'separator' => 'before'
129 ]
130 );
131 $this->end_controls_section();
132 $this->start_controls_section(
133 'section_social_sites',
134 [
135 'label' => esc_html__('Social Count', 'ultimate-post-kit'),
136 ]
137 );
138 $repeater = new Repeater();
139 $repeater->start_controls_tabs(
140 'social_count_tabs'
141 );
142 $repeater->start_controls_tab(
143 'social_count_tabs_content',
144 [
145 'label' => esc_html__('Content', 'ultimate-post-kit'),
146 ]
147 );
148 $repeater->add_control(
149 'social_site_name',
150 [
151 'label' => esc_html__('Label', 'ultimate-post-kit'),
152 'type' => Controls_Manager::TEXT,
153 'placeholder' => esc_html__('facebook', 'ultimate-post-kit'),
154 'dynamic' => [
155 'active' => true,
156 ],
157 ]
158 );
159 $repeater->add_control(
160 'social_site_link',
161 [
162 'label' => esc_html__('Link', 'ultimate-post-kit'),
163 'type' => Controls_Manager::URL,
164 'placeholder' => esc_html__('https://facebook.com', 'ultimate-post-kit'),
165 'show_external' => true,
166 'default' => [
167 'url' => 'https://bdthemes.com',
168 'is_external' => true,
169 'nofollow' => true,
170 ],
171 ]
172 );
173 $repeater->add_control(
174 'social_site_icon',
175 [
176 'label' => esc_html__('Icon', 'ultimate-post-kit'),
177 'type' => Controls_Manager::ICONS,
178 'default' => [
179 'value' => 'fab fa-wordpress',
180 'library' => 'fa-brands',
181 ],
182 'recommended' => [
183 'fa-brands' => [
184 'android',
185 'apple',
186 'behance',
187 'bitbucket',
188 'codepen',
189 'delicious',
190 'deviantart',
191 'digg',
192 'dribbble',
193 'elementor',
194 'facebook',
195 'flickr',
196 'foursquare',
197 'free-code-camp',
198 'github',
199 'gitlab',
200 'globe',
201 'houzz',
202 'instagram',
203 'jsfiddle',
204 'linkedin',
205 'medium',
206 'meetup',
207 'mix',
208 'mixcloud',
209 'odnoklassniki',
210 'pinterest',
211 'product-hunt',
212 'reddit',
213 'shopping-cart',
214 'skype',
215 'slideshare',
216 'snapchat',
217 'soundcloud',
218 'spotify',
219 'stack-overflow',
220 'steam',
221 'telegram',
222 'thumb-tack',
223 'tripadvisor',
224 'tumblr',
225 'twitch',
226 'twitter',
227 'viber',
228 'vimeo',
229 'vk',
230 'weibo',
231 'weixin',
232 'whatsapp',
233 'wordpress',
234 'xing',
235 'yelp',
236 'youtube',
237 '500px',
238 ],
239 'fa-solid' => [
240 'envelope',
241 'link',
242 'rss',
243 ],
244 ],
245 'skin' => 'inline',
246 'label_block' => false
247 ]
248 );
249 $repeater->add_control(
250 'social_counter',
251 [
252 'label' => esc_html__('Number', 'ultimate-post-kit'),
253 'type' => Controls_Manager::TEXT,
254 'dynamic' => [
255 'active' => true,
256 ],
257 ]
258 );
259 $repeater->add_control(
260 'social_site_meta',
261 [
262 'label' => esc_html__('Meta', 'ultimate-post-kit'),
263 'type' => Controls_Manager::TEXT,
264 'dynamic' => [
265 'active' => true,
266 ],
267 ]
268 );
269 $repeater->end_controls_tab();
270 $repeater->start_controls_tab(
271 'social_count_tabs_style',
272 [
273 'label' => esc_html__('Style', 'ultimate-post-kit'),
274 ]
275 );
276 $repeater->add_group_control(
277 Group_Control_Background::get_type(),
278 [
279 'name' => 'social_single_item_bg',
280 'label' => esc_html__('Background', 'ultimate-post-kit'),
281 'types' => ['classic', 'gradient'],
282 'exclude' => ['image'],
283 'selector' => '{{WRAPPER}} .upk-static-social-count {{CURRENT_ITEM}}.upk-item',
284 ]
285 );
286 $repeater->add_control(
287 'heading_icon_social_single',
288 [
289 'label' => esc_html__('ICON NORMAL', 'ultimate-post-kit'),
290 'type' => Controls_Manager::HEADING,
291 'separator' => 'before',
292 ]
293 );
294 $repeater->add_control(
295 'social_single_color',
296 [
297 'label' => esc_html__('Color', 'ultimate-post-kit'),
298 'type' => Controls_Manager::COLOR,
299 'selectors' => [
300 '{{WRAPPER}} .upk-static-social-count {{CURRENT_ITEM}} .upk-icon span' => 'color: {{VALUE}};',
301 ],
302 ]
303 );
304 $repeater->add_control(
305 'social_single_bg_color',
306 [
307 'label' => esc_html__('Background', 'ultimate-post-kit'),
308 'type' => Controls_Manager::COLOR,
309 'selectors' => [
310 '{{WRAPPER}} .upk-static-social-count {{CURRENT_ITEM}} .upk-icon span' => 'background: {{VALUE}};',
311 ],
312 ]
313 );
314 $repeater->add_control(
315 'social_single_border_color',
316 [
317 'label' => esc_html__('Border', 'ultimate-post-kit'),
318 'type' => Controls_Manager::COLOR,
319 'selectors' => [
320 '{{WRAPPER}} .upk-static-social-count {{CURRENT_ITEM}} .upk-icon span' => 'border-color: {{VALUE}};',
321 ],
322 ]
323 );
324 $repeater->add_control(
325 'heading_icon_h_social_single',
326 [
327 'label' => esc_html__('ICON HOVER', 'ultimate-post-kit'),
328 'type' => Controls_Manager::HEADING,
329 'separator' => 'before',
330 ]
331 );
332 $repeater->add_control(
333 'social_single_h_color',
334 [
335 'label' => esc_html__('Color', 'ultimate-post-kit'),
336 'type' => Controls_Manager::COLOR,
337 'selectors' => [
338 '{{WRAPPER}} .upk-static-social-count {{CURRENT_ITEM}} .upk-icon:hover span' => 'color:{{VALUE}}',
339 ],
340 ]
341 );
342 $repeater->add_control(
343 'social_single_h_bg_color',
344 [
345 'label' => esc_html__('Background', 'ultimate-post-kit'),
346 'type' => Controls_Manager::COLOR,
347 'selectors' => [
348 '{{WRAPPER}} .upk-static-social-count {{CURRENT_ITEM}} .upk-icon:hover span' => 'background: {{VALUE}};',
349 ],
350 ]
351 );
352 $repeater->add_control(
353 'social_single_h_border_color',
354 [
355 'label' => esc_html__('Border', 'ultimate-post-kit'),
356 'type' => Controls_Manager::COLOR,
357 'selectors' => [
358 '{{WRAPPER}} .upk-static-social-count {{CURRENT_ITEM}} .upk-icon:hover span' => 'border-color: {{VALUE}};',
359 ],
360 ]
361 );
362 $repeater->add_control(
363 'heading_number_social_single',
364 [
365 'label' => esc_html__('NUMBER', 'ultimate-post-kit'),
366 'type' => Controls_Manager::HEADING,
367 'separator' => 'before',
368 ]
369 );
370 $repeater->add_control(
371 'social_single_count_color',
372 [
373 'label' => esc_html__('Color', 'ultimate-post-kit'),
374 'type' => Controls_Manager::COLOR,
375 'selectors' => [
376 '{{WRAPPER}} .upk-static-social-count {{CURRENT_ITEM}} .upk-count .counter-value' => 'color: {{VALUE}};',
377 ],
378 ]
379 );
380
381 $repeater->add_control(
382 'heading_meta_social_single',
383 [
384 'label' => esc_html__('META', 'ultimate-post-kit'),
385 'type' => Controls_Manager::HEADING,
386 'separator' => 'before',
387 ]
388 );
389 $repeater->add_control(
390 'social_single_meta_color',
391 [
392 'label' => esc_html__('Color', 'ultimate-post-kit'),
393 'type' => Controls_Manager::COLOR,
394 'selectors' => [
395 '{{WRAPPER}} .upk-static-social-count {{CURRENT_ITEM}} .upk-meta' => 'color: {{VALUE}};',
396 ],
397 ]
398 );
399 $repeater->end_controls_tab();
400 $repeater->end_controls_tabs();
401 $this->add_control(
402 'social_counter_list',
403 [
404 'label' => esc_html__('Social', 'ultimate-post-kit'),
405 'type' => Controls_Manager::REPEATER,
406 'fields' => $repeater->get_controls(),
407 'default' => [
408 [
409 'social_site_name' => esc_html__('Facebook', 'ultimate-post-kit'),
410 'social_site_icon' => [
411 'value' => 'fab fa-facebook',
412 'library' => 'fa-brands',
413 ],
414 'social_counter' => '450',
415 'social_site_meta' => esc_html__('Likes', 'ultimate-post-kit'),
416 'social_site_link' => [
417 'url' => esc_html__('https://facebook.com/bdthemes', 'ultimate-post-kit')
418 ]
419 ],
420 [
421 'social_site_name' => esc_html__('Twitter', 'ultimate-post-kit'),
422 'social_site_icon' => [
423 'value' => 'fab fa-twitter',
424 'library' => 'fa-brands',
425 ],
426 'social_counter' => '3000',
427 'social_site_meta' => esc_html__('Followers', 'ultimate-post-kit'),
428 'social_site_link' => [
429 'url' => esc_html__('https://twitter.com/bdthemescom', 'ultimate-post-kit')
430 ]
431 ],
432 [
433 'social_site_name' => esc_html__('Youtube', 'ultimate-post-kit'),
434 'social_site_icon' => [
435 'value' => 'fab fa-youtube',
436 'library' => 'fa-brands',
437 ],
438 'social_counter' => '2000000',
439 'social_site_meta' => esc_html__('Subscriber', 'ultimate-post-kit'),
440 'social_site_link' => [
441 'url' => esc_html__('https://youtube.com/bdthemes', 'ultimate-post-kit')
442 ]
443 ],
444 [
445 'social_site_name' => esc_html__('Instagram', 'ultimate-post-kit'),
446 'social_site_icon' => [
447 'value' => 'fab fa-instagram',
448 'library' => 'fa-brands',
449 ],
450 'social_counter' => '105000',
451 'social_site_meta' => esc_html__('Followers', 'ultimate-post-kit'),
452 'social_site_link' => [
453 'url' => esc_html__('https://instagram.com/bdthemes', 'ultimate-post-kit')
454 ]
455 ],
456 ],
457 'title_field' => '{{{ social_site_name }}}',
458 ]
459 );
460 $this->end_controls_section();
461 $this->start_controls_section(
462 'static_social_items',
463 [
464 'label' => esc_html__('Items', 'ultimate-post-kit'),
465 'tab' => Controls_Manager::TAB_STYLE,
466 ]
467 );
468 $this->start_controls_tabs(
469 'static_social_item_tabs'
470 );
471 $this->start_controls_tab(
472 'static_social_tab_normal',
473 [
474 'label' => esc_html__('Normal', 'ultimate-post-kit'),
475 ]
476 );
477 $this->add_group_control(
478 Group_Control_Background::get_type(),
479 [
480 'name' => 'social_static_background',
481 'label' => esc_html__('Background', 'ultimate-post-kit'),
482 'types' => ['classic', 'gradient'],
483 'exclude' => ['image'],
484 'selector' => '{{WRAPPER}} .upk-static-social-count .upk-item',
485 ]
486 );
487 $this->add_group_control(
488 Group_Control_Border::get_type(),
489 [
490 'name' => 'social_static_border',
491 'label' => esc_html__('Border', 'ultimate-post-kit'),
492 'selector' => '{{WRAPPER}} .upk-static-social-count .upk-item',
493 ]
494 );
495 $this->add_responsive_control(
496 'social_static_padding',
497 [
498 'label' => esc_html__('Padding', 'ultimate-post-kit'),
499 'type' => Controls_Manager::DIMENSIONS,
500 'size_units' => ['px', '%', 'em'],
501 'selectors' => [
502 '{{WRAPPER}} .upk-static-social-count .upk-item' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
503 ],
504 ]
505 );
506
507 $this->add_responsive_control(
508 'social_static_border_radius',
509 [
510 'label' => esc_html__('Radius', 'ultimate-post-kit'),
511 'type' => Controls_Manager::DIMENSIONS,
512 'size_units' => ['px', '%', 'em'],
513 'selectors' => [
514 '{{WRAPPER}} .upk-static-social-count .upk-item' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
515 ],
516 ]
517 );
518 $this->add_group_control(
519 Group_Control_Box_Shadow::get_type(),
520 [
521 'name' => 'static_social_shadow',
522 'label' => esc_html__('Box Shadow', 'ultimate-post-kit'),
523 'selector' => '{{WRAPPER}} .upk-static-social-count .upk-item',
524 ]
525 );
526 $this->end_controls_tab();
527 $this->start_controls_tab(
528 'static_social_tab_hover',
529 [
530 'label' => esc_html__('Hover', 'ultimate-post-kit'),
531 ]
532 );
533 $this->add_group_control(
534 Group_Control_Background::get_type(),
535 [
536 'name' => 'static_social_hover_bg',
537 'label' => esc_html__('Background', 'ultimate-post-kit'),
538 'types' => ['classic', 'gradient'],
539 'exclude' => ['image'],
540 'selector' => '{{WRAPPER}} .upk-static-social-count .upk-item:hover',
541 ]
542 );
543 $this->end_controls_tab();
544 $this->end_controls_tabs();
545 $this->end_controls_section();
546 $this->start_controls_section(
547 'section_social_count_style',
548 [
549 'label' => esc_html__('Icon', 'ultimate-post-kit'),
550 'tab' => Controls_Manager::TAB_STYLE,
551 ]
552 );
553 $this->start_controls_tabs(
554 'social_icons_tab'
555 );
556 $this->start_controls_tab(
557 'social_icon_tab_normal',
558 [
559 'label' => esc_html__('Normal', 'ultimate-post-kit'),
560 ]
561 );
562 $this->add_control(
563 'icon_color',
564 [
565 'label' => esc_html__('Color', 'ultimate-post-kit'),
566 'type' => Controls_Manager::COLOR,
567 'selectors' => [
568 '{{WRAPPER}} .upk-static-social-count .upk-icon span' => 'color: {{VALUE}}',
569 ],
570 ]
571 );
572 $this->add_group_control(
573 Group_Control_Background::get_type(),
574 [
575 'name' => 'icon_background',
576 'label' => esc_html__('Background', 'ultimate-post-kit'),
577 'types' => ['classic', 'gradient'],
578 'selector' => '{{WRAPPER}} .upk-static-social-count .upk-icon span',
579 ]
580 );
581 $this->add_group_control(
582 Group_Control_Border::get_type(),
583 [
584 'name' => 'social_icons_border',
585 'label' => esc_html__('Border', 'ultimate-post-kit'),
586 'placeholder' => '1px',
587 'default' => '1px',
588 'selector' => '{{WRAPPER}} .upk-static-social-count .upk-icon span',
589 ]
590 );
591 $this->add_responsive_control(
592 'social_icon_padding',
593 [
594 'label' => esc_html__('Padding', 'ultimate-post-kit'),
595 'type' => Controls_Manager::DIMENSIONS,
596 'size_units' => ['px', '%', 'em'],
597 'selectors' => [
598 '{{WRAPPER}} .upk-static-social-count .upk-icon span ' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
599 ],
600 ]
601 );
602 $this->add_responsive_control(
603 'social_icon_radius',
604 [
605 'label' => esc_html__('Radius', 'ultimate-post-kit'),
606 'type' => Controls_Manager::DIMENSIONS,
607 'size_units' => ['px', '%', 'em'],
608 'selectors' => [
609 '{{WRAPPER}} .upk-static-social-count .upk-icon span ' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
610 ],
611 ]
612 );
613 $this->add_responsive_control(
614 'social_icon_size',
615 [
616 'label' => esc_html__('Size', 'ultimate-post-kit'),
617 'type' => Controls_Manager::SLIDER,
618 'size_units' => ['px'],
619 'range' => [
620 'px' => [
621 'min' => 0,
622 'max' => 100,
623 'step' => 1,
624 ]
625 ],
626 'selectors' => [
627 '{{WRAPPER}} .upk-static-social-count .upk-icon span' => 'font-size: {{SIZE}}{{UNIT}};',
628 ]
629 ]
630 );
631 $this->add_responsive_control(
632 'social_icon_spacing',
633 [
634 'label' => esc_html__('Bottom Spacing', 'ultimate-post-kit'),
635 'type' => Controls_Manager::SLIDER,
636 'size_units' => ['px'],
637 'range' => [
638 'px' => [
639 'min' => 0,
640 'max' => 100,
641 'step' => 1,
642 ]
643 ],
644 'selectors' => [
645 '{{WRAPPER}} .upk-static-social-count .upk-icon' => 'margin-bottom: {{SIZE}}{{UNIT}};',
646 ],
647 'condition' => [
648 'select_style' => ''
649 ]
650 ]
651 );
652 $this->add_responsive_control(
653 'social_icon_spacing_left',
654 [
655 'label' => esc_html__('Spacing', 'ultimate-post-kit'),
656 'type' => Controls_Manager::SLIDER,
657 'size_units' => ['px'],
658 'range' => [
659 'px' => [
660 'min' => 0,
661 'max' => 100,
662 'step' => 1,
663 ]
664 ],
665 'selectors' => [
666 '{{WRAPPER}} .upk-static-social-count .upk-icon' => 'margin-right: {{SIZE}}{{UNIT}};',
667 ],
668 'condition' => [
669 'select_style' => 'upk-style-2'
670 ]
671 ]
672 );
673 $this->end_controls_tab();
674 $this->start_controls_tab(
675 'social_icon_tab_hover',
676 [
677 'label' => esc_html__('Hover', 'ultimate-post-kit'),
678 ]
679 );
680 $this->add_control(
681 'icon_h_color',
682 [
683 'label' => esc_html__('Color', 'ultimate-post-kit'),
684 'type' => Controls_Manager::COLOR,
685 'selectors' => [
686 '{{WRAPPER}} .upk-static-social-count .upk-icon span:hover' => 'color: {{VALUE}}',
687 ],
688 ]
689 );
690 $this->add_group_control(
691 Group_Control_Background::get_type(),
692 [
693 'name' => 'icon_h_background',
694 'label' => esc_html__('Background', 'ultimate-post-kit'),
695 'types' => ['classic', 'gradient'],
696 'selector' => '{{WRAPPER}} .upk-static-social-count .upk-icon span:hover',
697 ]
698 );
699 $this->add_control(
700 'icon_h_border_color',
701 [
702 'label' => esc_html__('Border Color', 'ultimate-post-kit'),
703 'type' => Controls_Manager::COLOR,
704 'selectors' => [
705 '{{WRAPPER}} .upk-static-social-count .upk-icon span:hover' => 'border-color: {{VALUE}}',
706 ],
707 'condition' => [
708 'social_icons_border_border!' => ''
709 ]
710 ]
711 );
712 $this->end_controls_tab();
713 $this->end_controls_tabs();
714 $this->end_controls_section();
715 $this->start_controls_section(
716 'social_counter',
717 [
718 'label' => esc_html__('Counter', 'ultimate-post-kit'),
719 'tab' => Controls_Manager::TAB_STYLE,
720 ]
721 );
722 $this->add_control(
723 'counter_color',
724 [
725 'label' => esc_html__('Color', 'ultimate-post-kit'),
726 'type' => Controls_Manager::COLOR,
727 'selectors' => [
728 '{{WRAPPER}} .upk-static-social-count .upk-count .counter-value' => 'color: {{VALUE}}',
729 ],
730 ]
731 );
732 $this->add_group_control(
733 Group_Control_Typography::get_type(),
734 [
735 'name' => 'counter_typography',
736 'label' => esc_html__('Typography', 'ultimate-post-kit'),
737 'selector' => '{{WRAPPER}} .upk-static-social-count .upk-count .counter-value',
738 ]
739 );
740 $this->add_responsive_control(
741 'social_counter_spacing',
742 [
743 'label' => esc_html__('Bottom Spacing', 'ultimate-post-kit'),
744 'type' => Controls_Manager::SLIDER,
745 'size_units' => ['px'],
746 'range' => [
747 'px' => [
748 'min' => 0,
749 'max' => 100,
750 'step' => 1,
751 ]
752 ],
753 'selectors' => [
754 '{{WRAPPER}} .upk-static-social-count .upk-count' => 'margin-bottom: {{SIZE}}{{UNIT}};',
755 ]
756 ]
757 );
758 $this->end_controls_section();
759
760 $this->start_controls_section(
761 'social_meta',
762 [
763 'label' => esc_html__('Meta', 'ultimate-post-kit'),
764 'tab' => Controls_Manager::TAB_STYLE,
765 ]
766 );
767 $this->add_control(
768 'meta_color',
769 [
770 'label' => esc_html__('Color', 'ultimate-post-kit'),
771 'type' => Controls_Manager::COLOR,
772 'selectors' => [
773 '{{WRAPPER}} .upk-static-social-count .upk-meta' => 'color: {{VALUE}}',
774 ],
775 ]
776 );
777 $this->add_group_control(
778 Group_Control_Typography::get_type(),
779 [
780 'name' => 'meta_typography',
781 'label' => esc_html__('Typography', 'ultimate-post-kit'),
782 'selector' => '{{WRAPPER}} .upk-static-social-count .upk-meta',
783 ]
784 );
785 $this->end_controls_section();
786 }
787
788 protected function render() {
789 $settings = $this->get_settings_for_display();
790 $this->add_render_attribute('upk-static-social-count', 'class', ['upk-static-social-count', $settings['select_style']], true);
791 $social_links = $this->get_settings('social_counter_list'); ?>
792 <div <?php $this->print_render_attribute_string('upk-static-social-count'); ?>>
793 <?php foreach ($social_links as $link_key => $social_link) {
794 $this->add_render_attribute($link_key, 'class', [
795 'upk-item',
796 'upk-social-icon',
797 'upk-social-icon-' . strtolower($social_link['social_site_name']),
798 'elementor-repeater-item-' . $social_link['_id'],
799 ]);
800 if ($social_link['social_site_link']['is_external'] !== 'on') {
801 $this->add_render_attribute($link_key, 'href', esc_url($social_link['social_site_link']['url']));
802 } else {
803 $this->add_render_attribute(
804 $link_key,
805 [
806 'href' => [
807 esc_url($social_link['social_site_link']['url'])
808 ],
809 'target' => '_blank'
810 ],
811 null,
812 true
813 );
814 }
815 ?>
816 <a <?php $this->print_render_attribute_string($link_key); ?>>
817 <div class="upk-icon">
818 <span title="<?php echo esc_html($social_link['social_site_name']); ?>">
819 <?php Icons_Manager::render_icon($social_link['social_site_icon'], ['aria-hidden' => 'true']); ?>
820 </span>
821 </div>
822 <div class="upk-content">
823 <div class="upk-count">
824 <?php echo '<span class="counter-value">' . esc_html($social_link['social_counter']) . '</span>'; ?>
825 </div>
826 <div class="upk-meta">
827 <?php printf('<span>%s</span>', esc_html($social_link['social_site_meta'])); ?>
828 </div>
829 </div>
830 </a>
831 <?php
832 }
833 echo '</div>';
834 }
835 }
836