← All changes
|
includes/widgets/Testimonial_Carousel/Testimonial_Carousel.php
+18
-15
51.1.75
→
51.1.87
View file →
| @@ -2102,9 +2102,9 @@ | ||
| 2102 | 2102 | } |
| 2103 | 2103 | |
| 2104 | 2104 | protected function render(): void |
| 2105 | 2105 | { |
| 2106 | - $settings_all = $this->get_settings(); | |
| 2106 | + $settings_all = Core::displaySettings($this); | |
| 2107 | 2107 | $this_ID = $this->get_id(); |
| 2108 | 2108 | |
| 2109 | 2109 | // Define allowed tags and attributes |
| 2110 | 2110 | $allowed_tags = wp_kses_allowed_html('post'); |
| @@ -2299,29 +2299,29 @@ | ||
| 2299 | 2299 | |
| 2300 | 2300 | $js_swiper = "new Swiper('.king-addons-testimonial-carousel-sw-items-" . esc_js($this_ID) . "', {"; |
| 2301 | 2301 | $js_swiper .= "direction: 'horizontal',"; |
| 2302 | 2302 | |
| 2303 | - $js_swiper .= "slidesPerView: " . esc_js($settings_all['king_addons_testimonial_carousel_sw_desktop_cards_per_view']) . ","; | |
| 2304 | - $js_swiper .= "spaceBetween: " . esc_js($settings_all['king_addons_testimonial_carousel_sw_desktop_space_between_cards']) . ","; | |
| 2303 | + $js_swiper .= "slidesPerView: " . Core::jsNumber($settings_all, 'king_addons_testimonial_carousel_sw_desktop_cards_per_view', 3) . ","; | |
| 2304 | + $js_swiper .= "spaceBetween: " . Core::jsNumber($settings_all, 'king_addons_testimonial_carousel_sw_desktop_space_between_cards', 30) . ","; | |
| 2305 | 2305 | |
| 2306 | 2306 | // Responsive breakpoints |
| 2307 | 2307 | $js_swiper .= 'breakpoints: {0: {slidesPerView: ' . |
| 2308 | - esc_js($settings_all['king_addons_testimonial_carousel_sw_mobile_cards_per_view']) . ', spaceBetween: ' . | |
| 2309 | - esc_js($settings_all['king_addons_testimonial_carousel_sw_mobile_space_between_cards']) . '}, '; | |
| 2308 | + Core::jsNumber($settings_all, 'king_addons_testimonial_carousel_sw_mobile_cards_per_view', 1) . ', spaceBetween: ' . | |
| 2309 | + Core::jsNumber($settings_all, 'king_addons_testimonial_carousel_sw_mobile_space_between_cards', 30) . '}, '; | |
| 2310 | 2310 | $js_swiper .= |
| 2311 | - esc_js(($settings_all['king_addons_testimonial_carousel_sw_mobile_breakpoint'] + 1)) . ': {slidesPerView: ' . | |
| 2312 | - esc_js($settings_all['king_addons_testimonial_carousel_sw_tablet_cards_per_view']) . ', spaceBetween: ' . | |
| 2313 | - esc_js($settings_all['king_addons_testimonial_carousel_sw_tablet_space_between_cards']) . '}, '; | |
| 2311 | + (Core::jsNumber($settings_all, 'king_addons_testimonial_carousel_sw_mobile_breakpoint', 767) + 1) . ': {slidesPerView: ' . | |
| 2312 | + Core::jsNumber($settings_all, 'king_addons_testimonial_carousel_sw_tablet_cards_per_view', 2) . ', spaceBetween: ' . | |
| 2313 | + Core::jsNumber($settings_all, 'king_addons_testimonial_carousel_sw_tablet_space_between_cards', 30) . '}, '; | |
| 2314 | 2314 | $js_swiper .= |
| 2315 | - esc_js(($settings_all['king_addons_testimonial_carousel_sw_tablet_breakpoint'] + 1)) . ': {slidesPerView: ' . | |
| 2316 | - esc_js($settings_all['king_addons_testimonial_carousel_sw_desktop_cards_per_view']) . ', spaceBetween: ' . | |
| 2317 | - esc_js($settings_all['king_addons_testimonial_carousel_sw_desktop_space_between_cards']) . '}},'; | |
| 2315 | + (Core::jsNumber($settings_all, 'king_addons_testimonial_carousel_sw_tablet_breakpoint', 1024) + 1) . ': {slidesPerView: ' . | |
| 2316 | + Core::jsNumber($settings_all, 'king_addons_testimonial_carousel_sw_desktop_cards_per_view', 3) . ', spaceBetween: ' . | |
| 2317 | + Core::jsNumber($settings_all, 'king_addons_testimonial_carousel_sw_desktop_space_between_cards', 30) . '}},'; | |
| 2318 | 2318 | |
| 2319 | 2319 | // Scrolling speed |
| 2320 | 2320 | if ('yes' !== $settings_all['king_addons_testimonial_carousel_sw_autoplay_like_ticker_switcher']) { |
| 2321 | - $js_swiper .= "speed: " . esc_js($settings_all['king_addons_testimonial_carousel_sw_scrolling_speed']) . ","; | |
| 2321 | + $js_swiper .= "speed: " . Core::jsNumber($settings_all, 'king_addons_testimonial_carousel_sw_scrolling_speed', 600) . ","; | |
| 2322 | 2322 | } else { |
| 2323 | - $js_swiper .= "speed: " . esc_js($settings_all['king_addons_testimonial_carousel_sw_autoplay_like_ticker_autoplay_speed']) . ","; | |
| 2323 | + $js_swiper .= "speed: " . Core::jsNumber($settings_all, 'king_addons_testimonial_carousel_sw_autoplay_like_ticker_autoplay_speed', 6000) . ","; | |
| 2324 | 2324 | } |
| 2325 | 2325 | |
| 2326 | 2326 | // Pagination |
| 2327 | 2327 | if ('yes' === $settings_all['king_addons_testimonial_carousel_sw_pag_switcher']) { |
| @@ -2329,9 +2329,9 @@ | ||
| 2329 | 2329 | esc_js($this_ID) . "', " . |
| 2330 | 2330 | ('yes' === $settings_all['king_addons_testimonial_carousel_sw_pag_clickable_switcher'] ? 'clickable: true, ' : ''); |
| 2331 | 2331 | if ('yes' === $settings_all['king_addons_testimonial_carousel_sw_pag_dynamic_switcher']) { |
| 2332 | 2332 | $js_swiper .= 'dynamicBullets: true, '; |
| 2333 | - $js_swiper .= 'dynamicMainBullets: ' . esc_js($settings_all['king_addons_testimonial_carousel_sw_pag_dynamic_number'] . ', '); | |
| 2333 | + $js_swiper .= 'dynamicMainBullets: ' . Core::jsNumber($settings_all, 'king_addons_testimonial_carousel_sw_pag_dynamic_number', 1) . ', '; | |
| 2334 | 2334 | } |
| 2335 | 2335 | $js_swiper .= "type: '" . esc_js($settings_all['king_addons_testimonial_carousel_sw_pag_type']) . "'},"; |
| 2336 | 2336 | } |
| 2337 | 2337 | |
| @@ -2355,9 +2355,9 @@ | ||
| 2355 | 2355 | // Autoplay |
| 2356 | 2356 | if ('yes' === $settings_all['king_addons_testimonial_carousel_sw_autoplay_switcher']) { |
| 2357 | 2357 | $js_swiper .= "autoplay: {"; |
| 2358 | 2358 | if ('yes' !== $settings_all['king_addons_testimonial_carousel_sw_autoplay_like_ticker_switcher']) { |
| 2359 | - $js_swiper .= "delay: " . esc_js($settings_all['king_addons_testimonial_carousel_sw_autoplay_delay']) . ","; | |
| 2359 | + $js_swiper .= "delay: " . Core::jsNumber($settings_all, 'king_addons_testimonial_carousel_sw_autoplay_delay', 3000) . ","; | |
| 2360 | 2360 | } else { |
| 2361 | 2361 | $js_swiper .= "delay: 0,"; |
| 2362 | 2362 | } |
| 2363 | 2363 | $js_swiper .= "disableOnInteraction: " . ('yes' === $settings_all['king_addons_testimonial_carousel_sw_autoplay_disableoninteraction_switcher'] ? 'true' : 'false') . ","; |
| @@ -2366,8 +2366,11 @@ | ||
| 2366 | 2366 | $js_swiper .= "},"; |
| 2367 | 2367 | } |
| 2368 | 2368 | |
| 2369 | 2369 | $js_swiper .= "})"; |
| 2370 | + | |
| 2371 | + Core::printFitSlidesHelper(); | |
| 2372 | + $js_swiper = Core::wrapFitSwiper('.king-addons-testimonial-carousel-sw-items-' . $this_ID, $js_swiper, 240); | |
| 2370 | 2373 | |
| 2371 | 2374 | $js_swiper_full = $js_swiper_check_if_DOM_already_loaded . ' ?' . $js_swiper . ' : ' . $js_swiper_check_if_DOM_not_already_loaded . $js_swiper . '; });'; |
| 2372 | 2375 | |
| 2373 | 2376 | wp_print_inline_script_tag($js_swiper_full); |