PluginProbe
UiCore Elements – Free widgets and templates for Elementor / 1.3.18
UiCore Elements – Free widgets and templates for Elementor v1.3.18
1.3.18 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 All 42 releases
← All changes | includes/widgets/advanced-post-carousel.php +64 -45 1.0.4 → 1.3.18 View file →
@@ -19,10 +19,9 @@
19 19 Grid_Trait,
20 20 Post_Filters_Trait,
21 21 Post_Trait;
22 22
23 - private $_query,
24 - $is_slider;
23 + private $_query;
25 24
26 25 public function get_name()
27 26 {
28 27 return 'uicore-advanced-post-carousel';
@@ -46,12 +45,19 @@
46 45 public function get_styles()
47 46 {
48 47 $styles = [
49 48 'advanced-post-carousel',
49 + 'carousel',
50 + 'post-meta',
51 + 'filters' => [
52 + 'condition' => [
53 + 'post_filtering' => 'yes',
54 + ]
55 + ],
50 56 'animation', // hover animations
51 57 'entrance', // entrance basic style
52 58 ];
53 - if(!class_exists('\UiCore\Core') && !class_exists('\UiCoreAnimate\Base')){
59 + if (!class_exists('\UiCore\Core') && !class_exists('\UiCoreAnimate\Base')) {
54 60 $styles['e-animations'] = [ // entrance animations
55 61 'external' => true,
56 62 ];
57 63 }
@@ -58,17 +64,15 @@
58 64 return $styles;
59 65 }
60 66 public function get_scripts()
61 67 {
62 - return [
63 - 'carousel',
64 - 'entrance' => [
65 - 'condition' => [
66 - 'animate_items' => 'ui-e-grid-animate'
67 - ],
68 - ],
69 - ];
68 + return $this->TRAIT_get_carousel_scripts();
70 69 }
70 + public function has_widget_inner_wrapper(): bool
71 + {
72 + // TODO: remove after Optmized Markup experiment is merged to the core
73 + return ! \Elementor\Plugin::$instance->experiments->is_feature_active('e_optimized_markup');
74 + }
71 75
72 76 private function filter_missing_taxonomies($settings)
73 77 {
74 78 $taxonomy_filter_args = [
@@ -81,10 +85,10 @@
81 85 $taxonomies = get_taxonomies($taxonomy_filter_args, 'objects');
82 86
83 87 foreach ($taxonomies as $taxonomy => $object) {
84 88 $controll_id = 'posts-filter_' . $taxonomy . '_ids';
85 - \error_log($controll_id);
86 - \error_log(print_r($settings[$controll_id], true));
89 + //error_log($controll_id);
90 + //error_log(print_r($settings[$controll_id], true));
87 91
88 92 if (!isset($settings[$controll_id]) || empty($settings[$controll_id])) {
89 93 continue;
90 94 }
@@ -120,18 +124,18 @@
120 124 [
121 125 'label' => esc_html__('Carousel', 'uicore-elements'),
122 126 ]
123 127 );
124 - $this->TRAIT_register_carousel_additional_controls(); // Grid Layouts with old masonry control
128 + $this->TRAIT_register_carousel_additional_controls(); // Grid Layouts with old masonry control
125 129 $this->end_controls_section();
126 130
127 131 $this->start_controls_section(
128 - 'section_carousel_settings',
129 - [
130 - 'label' => __('Carousel Settings', 'uicore-elements'),
131 - ]
132 - );
133 - $this->TRAIT_register_carousel_settings_controls(); // Carousel settings
132 + 'section_carousel_settings',
133 + [
134 + 'label' => __('Carousel Settings', 'uicore-elements'),
135 + ]
136 + );
137 + $this->TRAIT_register_carousel_settings_controls(); // Carousel settings
134 138 $this->end_controls_section();
135 139
136 140 $this->TRAIT_register_navigation_controls();
137 141 $this->TRAIT_register_post_item_controls();
@@ -154,19 +158,19 @@
154 158 'label' => __('Animations', 'uicore-elements'),
155 159 'tab' => Controls_Manager::TAB_STYLE,
156 160 ]
157 161 );
158 - $this->TRAIT_register_entrance_animations_controls();
159 - $this->TRAIT_register_hover_animation_control(
160 - 'Item Hover Animation',
161 - [],
162 - ['underline'],
163 - );
164 - $this->TRAIT_register_post_animation_controls();
162 + $this->TRAIT_register_entrance_animations_controls();
163 + $this->TRAIT_register_hover_animation_control(
164 + 'Item Hover Animation',
165 + [],
166 + ['underline'],
167 + );
168 + $this->TRAIT_register_post_animation_controls();
165 169 $this->end_controls_section();
166 170
167 171 // Update post component controls
168 - $this->update_control('image_size', [
172 + $this->update_responsive_control('image_size', [
169 173 'condition' => [],
170 174 ]);
171 175 $this->update_control('content_padding', [
172 176 'default' => [
@@ -178,55 +182,70 @@
178 182 ],
179 183 ]);
180 184 $this->update_control('item_limit', [
181 185 'default' => [
182 - 'size' => 5,
186 + 'size' => 4,
183 187 ],
184 188 ]);
189 +
190 + // TODO: create new method to return animations list and use it throughout the plugin
191 + // Update carousel animations
192 + $this->update_control('animation_style', [
193 + 'options' => [
194 + 'circular' => esc_html__('Circular', 'uicore-elements'),
195 + 'fade_blur' => esc_html__('Fade Blur', 'uicore-elements'),
196 + 'default' => esc_html__('Default', 'uicore-elements'),
197 + ],
198 + ]);
185 199 }
186 200
187 - function content_template()
188 - {
189 - }
201 + function content_template() {}
190 202
191 203 protected function render()
192 204 {
193 -
194 - // Get query args and widget settings
205 + // Get query args, settings and post type slug
195 206 global $wp_query;
196 207 $default_query = $wp_query;
197 208 $settings = $this->get_settings();
198 - $this->TRAIT_query_posts($settings['item_limit']['size'], $settings['posts-filter_post_type']);
199 - $wp_query = $this->get_query();
200 209
201 210 // Get the quantity of items and creates a loop control
202 211 $items = $settings['item_limit']['size'];
203 212 $loops = 0;
204 213
205 - $this->TRAIT_render_filters();
214 + $this->TRAIT_render_center_loop_warning($items);
206 215
216 + // Build query
217 + $this->TRAIT_query_posts($settings, $wp_query->query);
218 + $wp_query = $this->get_query();
219 +
220 + $this->TRAIT_render_filters($settings);
221 +
207 222 // No posts found
208 223 if (!$wp_query->have_posts()) {
209 - echo '<p style="text-align:center">' . __('No posts found.', 'uicore-elements') . '</p>';
224 + echo '<p style="text-align:center">' . esc_html__('No posts found.', 'uicore-elements') . '</p>';
210 225 } else {
211 226
212 - ?>
227 +?>
213 228 <div class="ui-e-carousel swiper">
214 229 <div class='swiper-wrapper'>
215 230 <?php
216 231 while ($wp_query->have_posts()) {
217 - if ($settings['sticky'] && $items == $loops) {
218 - break; // sticky posts disregards posts per page, so ending the loop if $items == $loop forces the query respects the users item limit
219 - }
232 +
233 + // sticky posts disregards posts per page, so ending the loop if $items == $loop forces the query respects the users item limit
234 + // if ($settings['sticky'] && $items == $loops) {
235 + // break;
236 + // }
237 +
220 238 $wp_query->the_post();
221 - $this->TRAIT_render_item(true);
239 + $this->TRAIT_render_item($loops, true);
240 +
222 241 $loops++;
223 242 }
224 243 ?>
225 244 </div>
226 - <?php $this->TRAIT_render_carousel_navigations(); ?>
227 245 </div>
228 - <?php
246 + <?php $this->TRAIT_render_carousel_navigations($items); ?>
247 +<?php
229 248 }
230 249
231 250 //reset query
232 251 wp_reset_query();