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 +53 -48 1.2.0 → 1.3.18 View file →
@@ -55,9 +55,9 @@
55 55 ],
56 56 'animation', // hover animations
57 57 'entrance', // entrance basic style
58 58 ];
59 - if(!class_exists('\UiCore\Core') && !class_exists('\UiCoreAnimate\Base')){
59 + if (!class_exists('\UiCore\Core') && !class_exists('\UiCoreAnimate\Base')) {
60 60 $styles['e-animations'] = [ // entrance animations
61 61 'external' => true,
62 62 ];
63 63 }
@@ -66,8 +66,13 @@
66 66 public function get_scripts()
67 67 {
68 68 return $this->TRAIT_get_carousel_scripts();
69 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 + }
70 75
71 76 private function filter_missing_taxonomies($settings)
72 77 {
73 78 $taxonomy_filter_args = [
@@ -119,18 +124,18 @@
119 124 [
120 125 'label' => esc_html__('Carousel', 'uicore-elements'),
121 126 ]
122 127 );
123 - $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
124 129 $this->end_controls_section();
125 130
126 131 $this->start_controls_section(
127 - 'section_carousel_settings',
128 - [
129 - 'label' => __('Carousel Settings', 'uicore-elements'),
130 - ]
131 - );
132 - $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
133 138 $this->end_controls_section();
134 139
135 140 $this->TRAIT_register_navigation_controls();
136 141 $this->TRAIT_register_post_item_controls();
@@ -153,19 +158,19 @@
153 158 'label' => __('Animations', 'uicore-elements'),
154 159 'tab' => Controls_Manager::TAB_STYLE,
155 160 ]
156 161 );
157 - $this->TRAIT_register_entrance_animations_controls();
158 - $this->TRAIT_register_hover_animation_control(
159 - 'Item Hover Animation',
160 - [],
161 - ['underline'],
162 - );
163 - $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();
164 169 $this->end_controls_section();
165 170
166 171 // Update post component controls
167 - $this->update_control('image_size', [
172 + $this->update_responsive_control('image_size', [
168 173 'condition' => [],
169 174 ]);
170 175 $this->update_control('content_padding', [
171 176 'default' => [
@@ -177,20 +182,27 @@
177 182 ],
178 183 ]);
179 184 $this->update_control('item_limit', [
180 185 'default' => [
181 - 'size' => 5,
186 + 'size' => 4,
182 187 ],
183 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 + ]);
184 199 }
185 200
186 - function content_template()
187 - {
188 - }
201 + function content_template() {}
189 202
190 203 protected function render()
191 204 {
192 -
193 205 // Get query args, settings and post type slug
194 206 global $wp_query;
195 207 $default_query = $wp_query;
196 208 $settings = $this->get_settings();
@@ -198,21 +210,14 @@
198 210 // Get the quantity of items and creates a loop control
199 211 $items = $settings['item_limit']['size'];
200 212 $loops = 0;
201 213
202 - // Check if should duplicate slides and update settings
203 - if ( $this->TRAIT_should_duplicate_slides($items) ) {
204 - $diff = abs($this->TRAIT_get_duplication_diff($items) + 1); // +1 to fix zero based index
205 - $settings['item_limit']['size'] = $items + $diff;
206 - }
214 + $this->TRAIT_render_center_loop_warning($items);
207 215
208 216 // Build query
209 - $this->TRAIT_query_posts( $settings, $wp_query->query );
217 + $this->TRAIT_query_posts($settings, $wp_query->query);
210 218 $wp_query = $this->get_query();
211 219
212 - // SVG icon experiment font-size adjustment
213 - $this->TRAIT_set_meta_font_size_to_svg($settings);
214 -
215 220 $this->TRAIT_render_filters($settings);
216 221
217 222 // No posts found
218 223 if (!$wp_query->have_posts()) {
@@ -218,33 +223,33 @@
218 223 if (!$wp_query->have_posts()) {
219 224 echo '<p style="text-align:center">' . esc_html__('No posts found.', 'uicore-elements') . '</p>';
220 225 } else {
221 226
222 - ?>
223 - <div class="ui-e-carousel swiper">
224 - <div class='swiper-wrapper'>
225 - <?php
226 - while ($wp_query->have_posts()) {
227 +?>
228 + <div class="ui-e-carousel swiper">
229 + <div class='swiper-wrapper'>
230 + <?php
231 + while ($wp_query->have_posts()) {
227 232
228 - // sticky posts disregards posts per page, so ending the loop if $items == $loop forces the query respects the users item limit
229 - // if ($settings['sticky'] && $items == $loops) {
230 - // break;
231 - // }
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 + // }
232 237
233 - $wp_query->the_post();
234 - $this->TRAIT_render_item(true);
238 + $wp_query->the_post();
239 + $this->TRAIT_render_item($loops, true);
235 240
236 - $loops++;
237 - }
238 - ?>
239 - </div>
241 + $loops++;
242 + }
243 + ?>
240 244 </div>
241 - <?php $this->TRAIT_render_carousel_navigations(); ?>
242 - <?php
245 + </div>
246 + <?php $this->TRAIT_render_carousel_navigations($items); ?>
247 +<?php
243 248 }
244 249
245 250 //reset query
246 - wp_reset_postdata();
251 + wp_reset_query();
247 252 $wp_query = $default_query;
248 253 }
249 254 }
250 255 \Elementor\Plugin::instance()->widgets_manager->register(new AdvancedPostCarousel());