← All changes
|
includes/widgets/Content_Ticker/Content_Ticker.php
+2186
-0
51.1.2
→
51.1.86
View file →
| @@ -1,0 +1,2186 @@ | ||
| 1 | +<?php | |
| 2 | + | |
| 3 | +namespace King_Addons; | |
| 4 | + | |
| 5 | +use Elementor\Controls_Manager; | |
| 6 | +use Elementor\Group_Control_Typography; | |
| 7 | +use Elementor\Group_Control_Image_Size; | |
| 8 | +use Elementor\Group_Control_Box_Shadow; | |
| 9 | +use Elementor\Widget_Base; | |
| 10 | +use Elementor\Icons_Manager; | |
| 11 | +use WP_Query; | |
| 12 | + | |
| 13 | +if (!defined('ABSPATH')) { | |
| 14 | + exit; | |
| 15 | +} | |
| 16 | + | |
| 17 | +class Content_Ticker extends Widget_Base | |
| 18 | +{ | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + public function get_name() | |
| 23 | + { | |
| 24 | + return 'king-addons-content-ticker'; | |
| 25 | + } | |
| 26 | + | |
| 27 | + public function get_title() | |
| 28 | + { | |
| 29 | + return esc_html__('Content Ticker', 'king-addons'); | |
| 30 | + } | |
| 31 | + | |
| 32 | + public function get_icon() | |
| 33 | + { | |
| 34 | + return 'king-addons-icon king-addons-content-ticker'; | |
| 35 | + } | |
| 36 | + | |
| 37 | + public function get_categories() | |
| 38 | + { | |
| 39 | + return ['king-addons']; | |
| 40 | + } | |
| 41 | + | |
| 42 | + public function get_keywords() | |
| 43 | + { | |
| 44 | + return ['king addons', 'king', 'addons', 'kingaddons', 'king-addons', 'blog', 'content ticker', 'content', 'ticker', | |
| 45 | + 'marquee', 'news', 'post', 'posts', 'news ticker', 'post ticker', 'posts ticker']; | |
| 46 | + } | |
| 47 | + | |
| 48 | + public function get_script_depends() | |
| 49 | + { | |
| 50 | + return [KING_ADDONS_ASSETS_UNIQUE_KEY . '-slick-slick', | |
| 51 | + KING_ADDONS_ASSETS_UNIQUE_KEY . '-marquee-marquee', | |
| 52 | + KING_ADDONS_ASSETS_UNIQUE_KEY . '-content-ticker-script', | |
| 53 | + ]; | |
| 54 | + } | |
| 55 | + | |
| 56 | + public function get_style_depends() | |
| 57 | + { | |
| 58 | + return [ | |
| 59 | + // Required for Slick layout (e.g. .slick-track { display:flex; }) on frontend. | |
| 60 | + KING_ADDONS_ASSETS_UNIQUE_KEY . '-slick-helper', | |
| 61 | + KING_ADDONS_ASSETS_UNIQUE_KEY . '-content-ticker-style', | |
| 62 | + KING_ADDONS_ASSETS_UNIQUE_KEY . '-general-general', | |
| 63 | + ]; | |
| 64 | + } | |
| 65 | + | |
| 66 | + public function get_custom_help_url() | |
| 67 | + { | |
| 68 | + return 'mailto:[email protected]?subject=Bug Report - King Addons&body=Please describe the issue'; | |
| 69 | + } | |
| 70 | + | |
| 71 | + public function add_control_post_type() | |
| 72 | + { | |
| 73 | + $this->add_control( | |
| 74 | + 'post_type', | |
| 75 | + [ | |
| 76 | + 'label' => esc_html__('Select Type', 'king-addons'), | |
| 77 | + 'type' => Controls_Manager::SELECT, | |
| 78 | + 'default' => 'dynamic', | |
| 79 | + 'options' => [ | |
| 80 | + 'dynamic' => esc_html__('Dynamic', 'king-addons'), | |
| 81 | + 'pro-cm' => esc_html__('Custom (Pro)', 'king-addons'), | |
| 82 | + ], | |
| 83 | + ] | |
| 84 | + ); | |
| 85 | + } | |
| 86 | + | |
| 87 | + public function add_control_slider_effect() | |
| 88 | + { | |
| 89 | + $this->add_control( | |
| 90 | + 'slider_effect', | |
| 91 | + [ | |
| 92 | + 'type' => Controls_Manager::SELECT, | |
| 93 | + 'label' => esc_html__('Effect', 'king-addons'), | |
| 94 | + 'default' => 'hr-slide', | |
| 95 | + 'options' => [ | |
| 96 | + 'hr-slide' => esc_html__('Horizontal Slide', 'king-addons'), | |
| 97 | + 'pro-tp' => esc_html__('Typing (Pro)', 'king-addons'), | |
| 98 | + 'pro-fd' => esc_html__('Fade (Pro)', 'king-addons'), | |
| 99 | + 'pro-vs' => esc_html__('Vertical Slide (Pro)', 'king-addons'), | |
| 100 | + ], | |
| 101 | + 'prefix_class' => 'king-addons-ticker-effect-', | |
| 102 | + 'render_type' => 'template', | |
| 103 | + 'separator' => 'before', | |
| 104 | + 'condition' => [ | |
| 105 | + 'type_select' => 'slider', | |
| 106 | + ], | |
| 107 | + ] | |
| 108 | + ); | |
| 109 | + } | |
| 110 | + | |
| 111 | + public function add_control_slider_effect_cursor() | |
| 112 | + { | |
| 113 | + } | |
| 114 | + | |
| 115 | + public function add_control_heading_icon_type() | |
| 116 | + { | |
| 117 | + $this->add_control( | |
| 118 | + 'heading_icon_type', | |
| 119 | + [ | |
| 120 | + 'type' => Controls_Manager::SELECT, | |
| 121 | + 'label' => esc_html__('Select Type', 'king-addons'), | |
| 122 | + 'default' => 'fontawesome', | |
| 123 | + 'options' => [ | |
| 124 | + 'none' => esc_html__('None', 'king-addons'), | |
| 125 | + 'fontawesome' => esc_html__('FontAwesome', 'king-addons'), | |
| 126 | + 'pro-cc' => esc_html__('Circle (Pro)', 'king-addons'), | |
| 127 | + ], | |
| 128 | + ] | |
| 129 | + ); | |
| 130 | + } | |
| 131 | + | |
| 132 | + public function add_control_type_select() | |
| 133 | + { | |
| 134 | + $this->add_control( | |
| 135 | + 'type_select', | |
| 136 | + [ | |
| 137 | + 'type' => Controls_Manager::SELECT, | |
| 138 | + 'label' => esc_html__('Select Type', 'king-addons'), | |
| 139 | + 'default' => 'slider', | |
| 140 | + 'options' => [ | |
| 141 | + 'slider' => esc_html__('Slider', 'king-addons'), | |
| 142 | + 'pro-mq' => esc_html__('Marquee (Pro)', 'king-addons'), | |
| 143 | + ], | |
| 144 | + 'render_type' => 'template', | |
| 145 | + 'separator' => 'before', | |
| 146 | + ] | |
| 147 | + ); | |
| 148 | + } | |
| 149 | + | |
| 150 | + public function add_control_marquee_direction() | |
| 151 | + { | |
| 152 | + } | |
| 153 | + | |
| 154 | + public function add_control_marquee_pause_on_hover() | |
| 155 | + { | |
| 156 | + } | |
| 157 | + | |
| 158 | + public function add_control_marquee_effect_duration() | |
| 159 | + { | |
| 160 | + } | |
| 161 | + | |
| 162 | + public function add_section_ticker_items() | |
| 163 | + { | |
| 164 | + } | |
| 165 | + | |
| 166 | + /** @noinspection PhpMissingFieldTypeInspection */ | |
| 167 | + public $post_types; | |
| 168 | + | |
| 169 | + public function add_control_query_source() | |
| 170 | + { | |
| 171 | + | |
| 172 | + $this->post_types = []; | |
| 173 | + $this->post_types['post'] = esc_html__('Posts', 'king-addons'); | |
| 174 | + $this->post_types['page'] = esc_html__('Pages', 'king-addons'); | |
| 175 | + | |
| 176 | + $custom_post_types = Core::getCustomTypes('post'); | |
| 177 | + foreach ($custom_post_types as $slug => $title) { | |
| 178 | + if ('product' === $slug || 'e-landing-page' === $slug) { | |
| 179 | + continue; | |
| 180 | + } | |
| 181 | + | |
| 182 | + if (!king_addons_freemius()->can_use_premium_code__premium_only()) { | |
| 183 | + $this->post_types['pro-' . substr($slug, 0, 2)] = esc_html($title) . ' (Pro)'; | |
| 184 | + } else { | |
| 185 | + $this->post_types[$slug] = esc_html($title); | |
| 186 | + } | |
| 187 | + } | |
| 188 | + | |
| 189 | + $this->post_types['pro-pd'] = 'Products (Pro)'; | |
| 190 | + $this->post_types['pro-ft'] = 'Featured (Pro)'; | |
| 191 | + $this->post_types['pro-sl'] = 'On Sale (Pro)'; | |
| 192 | + | |
| 193 | + $this->add_control( | |
| 194 | + 'query_source', | |
| 195 | + [ | |
| 196 | + 'label' => esc_html__('Source', 'king-addons'), | |
| 197 | + 'type' => Controls_Manager::SELECT, | |
| 198 | + 'default' => 'post', | |
| 199 | + 'options' => $this->post_types, | |
| 200 | + ] | |
| 201 | + ); | |
| 202 | + } | |
| 203 | + | |
| 204 | + protected function register_controls() | |
| 205 | + { | |
| 206 | + | |
| 207 | + | |
| 208 | + $this->start_controls_section( | |
| 209 | + 'section_general', | |
| 210 | + [ | |
| 211 | + 'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('General', 'king-addons'), | |
| 212 | + 'tab' => Controls_Manager::TAB_CONTENT, | |
| 213 | + ] | |
| 214 | + ); | |
| 215 | + | |
| 216 | + | |
| 217 | + $this->add_control_post_type(); | |
| 218 | + | |
| 219 | + | |
| 220 | + Core::renderUpgradeProNotice($this, Controls_Manager::RAW_HTML, 'content-ticker', 'post_type', ['pro-cm']); | |
| 221 | + | |
| 222 | + $this->add_control( | |
| 223 | + 'link_type', | |
| 224 | + [ | |
| 225 | + 'label' => esc_html__('Link Type', 'king-addons'), | |
| 226 | + 'type' => Controls_Manager::SELECT, | |
| 227 | + 'options' => [ | |
| 228 | + 'none' => esc_html__('None', 'king-addons'), | |
| 229 | + 'title' => esc_html__('Title', 'king-addons'), | |
| 230 | + 'image' => esc_html__('Image', 'king-addons'), | |
| 231 | + 'image-title' => esc_html__('Image & Title', 'king-addons'), | |
| 232 | + 'box' => esc_html__('Box', 'king-addons'), | |
| 233 | + ], | |
| 234 | + 'default' => 'image-title', | |
| 235 | + 'separator' => 'before', | |
| 236 | + ] | |
| 237 | + ); | |
| 238 | + | |
| 239 | + $this->end_controls_section(); | |
| 240 | + | |
| 241 | + | |
| 242 | + $this->start_controls_section( | |
| 243 | + 'section_ticker_query', | |
| 244 | + [ | |
| 245 | + 'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Query', 'king-addons'), | |
| 246 | + 'tab' => Controls_Manager::TAB_CONTENT, | |
| 247 | + 'condition' => [ | |
| 248 | + 'post_type' => 'dynamic', | |
| 249 | + ], | |
| 250 | + ] | |
| 251 | + ); | |
| 252 | + | |
| 253 | + $this->add_control_query_source(); | |
| 254 | + | |
| 255 | + | |
| 256 | + Core::renderUpgradeProNotice($this, Controls_Manager::RAW_HTML, 'content-ticker', 'query_source', ['pro-pd', 'pro-ft', 'pro-sl']); | |
| 257 | + | |
| 258 | + if (!king_addons_freemius()->can_use_premium_code__premium_only()) { | |
| 259 | + $this->add_control( | |
| 260 | + 'query_source_cpt_pro_notice', | |
| 261 | + [ | |
| 262 | + 'raw' => 'This option is available<br> in the <strong><a href="https://kingaddons.com/pricing/?utm_source=kng-module-grid-upgrade-pro&utm_medium=plugin&utm_campaign=kng" target="_blank">Pro version</a></strong>', | |
| 263 | + 'type' => Controls_Manager::RAW_HTML, | |
| 264 | + 'content_classes' => 'king-addons-pro-notice', | |
| 265 | + 'condition' => [ | |
| 266 | + 'query_source!' => ['post', 'page', 'pro-pd', 'pro-ft', 'pro-sl', 'product', 'featured', 'sale'], | |
| 267 | + ] | |
| 268 | + ] | |
| 269 | + ); | |
| 270 | + } | |
| 271 | + | |
| 272 | + | |
| 273 | + $post_taxonomies = Core::getCustomTypes('tax', false); | |
| 274 | + | |
| 275 | + $this->add_control( | |
| 276 | + 'query_selection', | |
| 277 | + [ | |
| 278 | + 'label' => esc_html__('Selection', 'king-addons'), | |
| 279 | + 'type' => Controls_Manager::SELECT, | |
| 280 | + 'default' => 'dynamic', | |
| 281 | + 'options' => [ | |
| 282 | + 'dynamic' => esc_html__('Dynamic', 'king-addons'), | |
| 283 | + 'manual' => esc_html__('Manual', 'king-addons'), | |
| 284 | + ], | |
| 285 | + 'condition' => [ | |
| 286 | + 'query_source!' => ['current', 'related'], | |
| 287 | + ], | |
| 288 | + ] | |
| 289 | + ); | |
| 290 | + | |
| 291 | + $this->add_control( | |
| 292 | + 'query_tax_selection', | |
| 293 | + [ | |
| 294 | + 'label' => esc_html__('Selection Taxonomy', 'king-addons'), | |
| 295 | + 'type' => Controls_Manager::SELECT, | |
| 296 | + 'default' => 'category', | |
| 297 | + 'options' => $post_taxonomies, | |
| 298 | + 'condition' => [ | |
| 299 | + 'query_source' => 'related', | |
| 300 | + ], | |
| 301 | + ] | |
| 302 | + ); | |
| 303 | + | |
| 304 | + $this->add_control( | |
| 305 | + 'query_author', | |
| 306 | + [ | |
| 307 | + 'label' => esc_html__('Authors', 'king-addons'), | |
| 308 | + 'type' => 'king-addons-ajax-select2', | |
| 309 | + 'options' => 'ajaxselect2/getUsers', | |
| 310 | + 'multiple' => true, | |
| 311 | + 'label_block' => true, | |
| 312 | + 'separator' => 'before', | |
| 313 | + 'condition' => [ | |
| 314 | + 'query_source!' => ['current', 'related'], | |
| 315 | + 'query_selection' => 'dynamic', | |
| 316 | + ], | |
| 317 | + ] | |
| 318 | + ); | |
| 319 | + | |
| 320 | + | |
| 321 | + foreach ($post_taxonomies as $slug => $title) { | |
| 322 | + global $wp_taxonomies; | |
| 323 | + $post_type = ''; | |
| 324 | + | |
| 325 | + if (isset($wp_taxonomies[$slug]->object_type[0])) { | |
| 326 | + $post_type = $wp_taxonomies[$slug]->object_type[0]; | |
| 327 | + } | |
| 328 | + | |
| 329 | + $this->add_control( | |
| 330 | + 'query_taxonomy_' . $slug, | |
| 331 | + [ | |
| 332 | + 'label' => $title, | |
| 333 | + 'type' => 'king-addons-ajax-select2', | |
| 334 | + 'options' => 'ajaxselect2/getTaxonomies', | |
| 335 | + 'query_slug' => $slug, | |
| 336 | + 'multiple' => true, | |
| 337 | + 'label_block' => true, | |
| 338 | + 'condition' => [ | |
| 339 | + 'query_source' => $post_type, | |
| 340 | + 'query_selection' => 'dynamic', | |
| 341 | + ], | |
| 342 | + ] | |
| 343 | + ); | |
| 344 | + } | |
| 345 | + | |
| 346 | + | |
| 347 | + foreach ($this->post_types as $slug => $title) { | |
| 348 | + if ('featured' !== $slug && 'sale' !== $slug) { | |
| 349 | + $this->add_control( | |
| 350 | + 'query_exclude_' . $slug, | |
| 351 | + [ | |
| 352 | + 'label' => esc_html__('Exclude ', 'king-addons') . $title, | |
| 353 | + 'type' => 'king-addons-ajax-select2', | |
| 354 | + 'options' => 'ajaxselect2/getPostsByPostType', | |
| 355 | + 'query_slug' => $slug, | |
| 356 | + 'multiple' => true, | |
| 357 | + 'label_block' => true, | |
| 358 | + 'condition' => [ | |
| 359 | + 'query_source' => $slug, | |
| 360 | + 'query_source!' => ['current', 'related'], | |
| 361 | + 'query_selection' => 'dynamic', | |
| 362 | + ], | |
| 363 | + ] | |
| 364 | + ); | |
| 365 | + } | |
| 366 | + } | |
| 367 | + | |
| 368 | + | |
| 369 | + foreach ($this->post_types as $slug => $title) { | |
| 370 | + $this->add_control( | |
| 371 | + 'query_manual_' . $slug, | |
| 372 | + [ | |
| 373 | + 'label' => esc_html__('Select ', 'king-addons') . $title, | |
| 374 | + 'type' => 'king-addons-ajax-select2', | |
| 375 | + 'options' => 'ajaxselect2/getPostsByPostType', | |
| 376 | + 'query_slug' => $slug, | |
| 377 | + 'multiple' => true, | |
| 378 | + 'label_block' => true, | |
| 379 | + 'condition' => [ | |
| 380 | + 'query_source' => $slug, | |
| 381 | + 'query_selection' => 'manual', | |
| 382 | + ], | |
| 383 | + 'separator' => 'before', | |
| 384 | + ] | |
| 385 | + ); | |
| 386 | + } | |
| 387 | + | |
| 388 | + $this->add_control( | |
| 389 | + 'query_posts_per_page', | |
| 390 | + [ | |
| 391 | + 'label' => esc_html__('Items Per Page', 'king-addons'), | |
| 392 | + 'type' => Controls_Manager::NUMBER, | |
| 393 | + 'default' => 10, | |
| 394 | + 'min' => 0, | |
| 395 | + 'condition' => [ | |
| 396 | + 'query_selection' => 'dynamic', | |
| 397 | + ] | |
| 398 | + ] | |
| 399 | + ); | |
| 400 | + | |
| 401 | + $this->add_control( | |
| 402 | + 'query_offset', | |
| 403 | + [ | |
| 404 | + 'label' => esc_html__('Offset', 'king-addons'), | |
| 405 | + 'type' => Controls_Manager::NUMBER, | |
| 406 | + 'default' => 0, | |
| 407 | + 'min' => 0, | |
| 408 | + 'condition' => [ | |
| 409 | + 'query_selection' => 'dynamic', | |
| 410 | + ] | |
| 411 | + ] | |
| 412 | + ); | |
| 413 | + | |
| 414 | + | |
| 415 | + $this->add_control( | |
| 416 | + 'post_order', | |
| 417 | + [ | |
| 418 | + 'label' => esc_html__('Order', 'king-addons'), | |
| 419 | + 'type' => Controls_Manager::SELECT, | |
| 420 | + 'default' => 'DESC', | |
| 421 | + 'options' => [ | |
| 422 | + 'ASC' => esc_html__('Ascending', 'king-addons'), | |
| 423 | + 'DESC' => esc_html__('Descending', 'king-addons'), | |
| 424 | + ], | |
| 425 | + ] | |
| 426 | + ); | |
| 427 | + | |
| 428 | + $this->add_control( | |
| 429 | + 'post_orderby', | |
| 430 | + [ | |
| 431 | + 'label' => esc_html__('Order By', 'king-addons'), | |
| 432 | + 'type' => Controls_Manager::SELECT, | |
| 433 | + 'default' => 'date', | |
| 434 | + 'options' => [ | |
| 435 | + 'date' => esc_html__('Date', 'king-addons'), | |
| 436 | + 'modified' => esc_html__('Last Modified', 'king-addons'), | |
| 437 | + 'rand' => esc_html__('Rand', 'king-addons'), | |
| 438 | + 'title' => esc_html__('Title', 'king-addons'), | |
| 439 | + 'ID' => esc_html__('Post ID', 'king-addons'), | |
| 440 | + 'author' => esc_html__('Post Author', 'king-addons'), | |
| 441 | + 'comment_count' => esc_html__('Comment Count', 'king-addons'), | |
| 442 | + ], | |
| 443 | + ] | |
| 444 | + ); | |
| 445 | + | |
| 446 | + $this->add_control( | |
| 447 | + 'element_select_filter', | |
| 448 | + [ | |
| 449 | + 'type' => Controls_Manager::HIDDEN, | |
| 450 | + 'default' => $this->get_related_taxonomies(), | |
| 451 | + ] | |
| 452 | + ); | |
| 453 | + | |
| 454 | + $this->end_controls_section(); | |
| 455 | + | |
| 456 | + | |
| 457 | + $this->add_section_ticker_items(); | |
| 458 | + | |
| 459 | + | |
| 460 | + $this->start_controls_section( | |
| 461 | + 'section_heading', | |
| 462 | + [ | |
| 463 | + 'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Heading', 'king-addons'), | |
| 464 | + 'tab' => Controls_Manager::TAB_CONTENT, | |
| 465 | + ] | |
| 466 | + ); | |
| 467 | + | |
| 468 | + $this->add_control( | |
| 469 | + 'heading_text', | |
| 470 | + [ | |
| 471 | + 'label' => esc_html__('Text', 'king-addons'), | |
| 472 | + 'type' => Controls_Manager::TEXT, | |
| 473 | + 'dynamic' => [ | |
| 474 | + 'active' => true, | |
| 475 | + ], | |
| 476 | + 'default' => 'Latest News', | |
| 477 | + ] | |
| 478 | + ); | |
| 479 | + | |
| 480 | + $this->add_responsive_control( | |
| 481 | + 'heading_width', | |
| 482 | + [ | |
| 483 | + 'label' => esc_html__('Width', 'king-addons'), | |
| 484 | + 'type' => Controls_Manager::SLIDER, | |
| 485 | + 'range' => [ | |
| 486 | + '%' => [ | |
| 487 | + 'min' => 0, | |
| 488 | + 'max' => 100, | |
| 489 | + ], | |
| 490 | + 'px' => [ | |
| 491 | + 'min' => 0, | |
| 492 | + 'max' => 500, | |
| 493 | + ], | |
| 494 | + ], | |
| 495 | + 'size_units' => ['%', 'px'], | |
| 496 | + 'default' => [ | |
| 497 | + 'unit' => 'px', | |
| 498 | + 'size' => 120, | |
| 499 | + ], | |
| 500 | + 'selectors' => [ | |
| 501 | + '{{WRAPPER}} .king-addons-ticker-heading' => 'min-width: {{SIZE}}{{UNIT}};', | |
| 502 | + ], | |
| 503 | + 'render_type' => 'template', | |
| 504 | + 'separator' => 'before', | |
| 505 | + ] | |
| 506 | + ); | |
| 507 | + | |
| 508 | + $this->add_control( | |
| 509 | + 'heading_position', | |
| 510 | + [ | |
| 511 | + 'label' => esc_html__('Position', 'king-addons'), | |
| 512 | + 'type' => Controls_Manager::CHOOSE, | |
| 513 | + 'default' => 'left', | |
| 514 | + 'label_block' => false, | |
| 515 | + 'options' => [ | |
| 516 | + 'left' => [ | |
| 517 | + 'title' => esc_html__('Left', 'king-addons'), | |
| 518 | + 'icon' => 'eicon-h-align-left', | |
| 519 | + ], | |
| 520 | + 'right' => [ | |
| 521 | + 'title' => esc_html__('Right', 'king-addons'), | |
| 522 | + 'icon' => 'eicon-h-align-right', | |
| 523 | + ], | |
| 524 | + ], | |
| 525 | + 'prefix_class' => 'king-addons-ticker-heading-position-', | |
| 526 | + 'separator' => 'before', | |
| 527 | + ] | |
| 528 | + ); | |
| 529 | + | |
| 530 | + $this->add_control( | |
| 531 | + 'heading_align', | |
| 532 | + [ | |
| 533 | + 'label' => esc_html__('Alignment', 'king-addons'), | |
| 534 | + 'type' => Controls_Manager::CHOOSE, | |
| 535 | + 'default' => 'center', | |
| 536 | + 'label_block' => false, | |
| 537 | + 'options' => [ | |
| 538 | + 'left' => [ | |
| 539 | + 'title' => esc_html__('Left', 'king-addons'), | |
| 540 | + 'icon' => 'eicon-text-align-left', | |
| 541 | + ], | |
| 542 | + 'center' => [ | |
| 543 | + 'title' => esc_html__('Center', 'king-addons'), | |
| 544 | + 'icon' => 'eicon-text-align-center', | |
| 545 | + ], | |
| 546 | + 'right' => [ | |
| 547 | + 'title' => esc_html__('Right', 'king-addons'), | |
| 548 | + 'icon' => 'eicon-text-align-right', | |
| 549 | + ], | |
| 550 | + ], | |
| 551 | + 'selectors_dictionary' => [ | |
| 552 | + 'left' => 'flex-start', | |
| 553 | + 'center' => 'center', | |
| 554 | + 'right' => 'flex-end' | |
| 555 | + ], | |
| 556 | + 'selectors' => [ | |
| 557 | + '{{WRAPPER}} .king-addons-ticker-heading' => '-webkit-justify-content: {{VALUE}};justify-content: {{VALUE}};', | |
| 558 | + ], | |
| 559 | + 'separator' => 'before', | |
| 560 | + ] | |
| 561 | + ); | |
| 562 | + | |
| 563 | + $this->add_control( | |
| 564 | + 'heading_icon_section', | |
| 565 | + [ | |
| 566 | + 'label' => esc_html__('Icon', 'king-addons'), | |
| 567 | + 'type' => Controls_Manager::HEADING, | |
| 568 | + 'separator' => 'before', | |
| 569 | + ] | |
| 570 | + ); | |
| 571 | + | |
| 572 | + $this->add_control_heading_icon_type(); | |
| 573 | + | |
| 574 | + | |
| 575 | + Core::renderUpgradeProNotice($this, Controls_Manager::RAW_HTML, 'content-ticker', 'heading_icon_type', ['pro-cc']); | |
| 576 | + | |
| 577 | + $this->add_control( | |
| 578 | + 'heading_icon', | |
| 579 | + [ | |
| 580 | + 'label' => esc_html__('Select Icon', 'king-addons'), | |
| 581 | + 'type' => Controls_Manager::ICONS, | |
| 582 | + 'skin' => 'inline', | |
| 583 | + 'label_block' => false, | |
| 584 | + 'default' => [ | |
| 585 | + 'value' => 'far fa-star', | |
| 586 | + 'library' => 'fa-regular', | |
| 587 | + ], | |
| 588 | + 'condition' => [ | |
| 589 | + 'heading_icon_type' => 'fontawesome', | |
| 590 | + ], | |
| 591 | + ] | |
| 592 | + ); | |
| 593 | + | |
| 594 | + $this->add_control( | |
| 595 | + 'heading_icon_position', | |
| 596 | + [ | |
| 597 | + 'label' => esc_html__('Position', 'king-addons'), | |
| 598 | + 'type' => Controls_Manager::CHOOSE, | |
| 599 | + 'label_block' => false, | |
| 600 | + 'default' => 'right', | |
| 601 | + 'options' => [ | |
| 602 | + 'left' => [ | |
| 603 | + 'title' => esc_html__('Left', 'king-addons'), | |
| 604 | + 'icon' => 'eicon-h-align-left', | |
| 605 | + ], | |
| 606 | + 'right' => [ | |
| 607 | + 'title' => esc_html__('Right', 'king-addons'), | |
| 608 | + 'icon' => 'eicon-h-align-right', | |
| 609 | + ], | |
| 610 | + ], | |
| 611 | + 'prefix_class' => 'king-addons-ticker-heading-icon-position-', | |
| 612 | + 'condition' => [ | |
| 613 | + 'heading_icon_type!' => 'none', | |
| 614 | + ], | |
| 615 | + ] | |
| 616 | + ); | |
| 617 | + | |
| 618 | + $this->add_responsive_control( | |
| 619 | + 'heading_icon_size', | |
| 620 | + [ | |
| 621 | + 'label' => esc_html__('Size', 'king-addons'), | |
| 622 | + 'type' => Controls_Manager::SLIDER, | |
| 623 | + 'size_units' => ['px'], | |
| 624 | + 'range' => [ | |
| 625 | + 'px' => [ | |
| 626 | + 'min' => 0, | |
| 627 | + 'max' => 100, | |
| 628 | + ], | |
| 629 | + ], | |
| 630 | + 'default' => [ | |
| 631 | + 'unit' => 'px', | |
| 632 | + 'size' => 13, | |
| 633 | + ], | |
| 634 | + 'selectors' => [ | |
| 635 | + '{{WRAPPER}} .king-addons-ticker-heading-icon' => 'font-size: {{SIZE}}{{UNIT}};', | |
| 636 | + '{{WRAPPER}} .king-addons-ticker-heading-icon svg' => 'width: {{SIZE}}{{UNIT}};height: {{SIZE}}{{UNIT}};', | |
| 637 | + '{{WRAPPER}} .king-addons-ticker-icon-circle' => 'height: {{SIZE}}{{UNIT}};width: {{SIZE}}{{UNIT}};', | |
| 638 | + '{{WRAPPER}} .king-addons-ticker-icon-circle:before' => 'height: {{SIZE}}{{UNIT}};width: {{SIZE}}{{UNIT}}; margin-top: calc(-{{SIZE}}{{UNIT}} / 2);margin-left: calc(-{{SIZE}}{{UNIT}} / 2);', | |
| 639 | + '{{WRAPPER}} .king-addons-ticker-icon-circle:after' => 'height: {{SIZE}}{{UNIT}};width: {{SIZE}}{{UNIT}}; margin-top: calc(-{{SIZE}}{{UNIT}} / 2);margin-left: calc(-{{SIZE}}{{UNIT}} / 2);', | |
| 640 | + ], | |
| 641 | + 'condition' => [ | |
| 642 | + 'heading_icon_type!' => 'none', | |
| 643 | + ], | |
| 644 | + ] | |
| 645 | + ); | |
| 646 | + | |
| 647 | + $this->add_responsive_control( | |
| 648 | + 'heading_icon_distance', | |
| 649 | + [ | |
| 650 | + 'label' => esc_html__('Distance', 'king-addons'), | |
| 651 | + 'type' => Controls_Manager::SLIDER, | |
| 652 | + 'size_units' => ['px'], | |
| 653 | + 'range' => [ | |
| 654 | + 'px' => [ | |
| 655 | + 'min' => 0, | |
| 656 | + 'max' => 100, | |
| 657 | + ], | |
| 658 | + ], | |
| 659 | + 'default' => [ | |
| 660 | + 'unit' => 'px', | |
| 661 | + 'size' => 7, | |
| 662 | + ], | |
| 663 | + 'selectors' => [ | |
| 664 | + '{{WRAPPER}}.king-addons-ticker-heading-icon-position-left .king-addons-ticker-heading-icon' => 'margin-right: {{SIZE}}{{UNIT}};', | |
| 665 | + '{{WRAPPER}}.king-addons-ticker-heading-icon-position-right .king-addons-ticker-heading-icon' => 'margin-left: {{SIZE}}{{UNIT}};', | |
| 666 | + ], | |
| 667 | + 'condition' => [ | |
| 668 | + 'heading_icon_type!' => 'none', | |
| 669 | + ], | |
| 670 | + ] | |
| 671 | + ); | |
| 672 | + | |
| 673 | + | |
| 674 | + $this->add_control( | |
| 675 | + 'heading_triangle', | |
| 676 | + [ | |
| 677 | + 'label' => esc_html__('Triangle', 'king-addons'), | |
| 678 | + 'type' => Controls_Manager::SWITCHER, | |
| 679 | + 'default' => 'yes', | |
| 680 | + 'separator' => 'before', | |
| 681 | + ] | |
| 682 | + ); | |
| 683 | + | |
| 684 | + $this->add_control( | |
| 685 | + 'heading_triangle_position', | |
| 686 | + [ | |
| 687 | + 'label' => esc_html__('Vertical Position', 'king-addons'), | |
| 688 | + 'type' => Controls_Manager::CHOOSE, | |
| 689 | + 'label_block' => false, | |
| 690 | + 'default' => 'top', | |
| 691 | + 'options' => [ | |
| 692 | + 'top' => [ | |
| 693 | + 'title' => esc_html__('Top', 'king-addons'), | |
| 694 | + 'icon' => 'eicon-v-align-top', | |
| 695 | + ], | |
| 696 | + 'middle' => [ | |
| 697 | + 'title' => esc_html__('Middle', 'king-addons'), | |
| 698 | + 'icon' => 'eicon-v-align-middle', | |
| 699 | + ], | |
| 700 | + 'bottom' => [ | |
| 701 | + 'title' => esc_html__('Bottom', 'king-addons'), | |
| 702 | + 'icon' => 'eicon-v-align-bottom', | |
| 703 | + ], | |
| 704 | + ], | |
| 705 | + 'prefix_class' => 'king-addons-ticker-heading-triangle-', | |
| 706 | + 'render_type' => 'template', | |
| 707 | + 'condition' => [ | |
| 708 | + 'heading_triangle' => 'yes', | |
| 709 | + ], | |
| 710 | + ] | |
| 711 | + ); | |
| 712 | + | |
| 713 | + $this->add_responsive_control( | |
| 714 | + 'heading_triangle_size', | |
| 715 | + [ | |
| 716 | + 'type' => Controls_Manager::SLIDER, | |
| 717 | + 'label' => esc_html__('Size', 'king-addons'), | |
| 718 | + 'size_units' => ['px'], | |
| 719 | + 'range' => [ | |
| 720 | + 'px' => [ | |
| 721 | + 'min' => 0, | |
| 722 | + 'max' => 50, | |
| 723 | + ] | |
| 724 | + ], | |
| 725 | + 'default' => [ | |
| 726 | + 'unit' => 'px', | |
| 727 | + 'size' => 8, | |
| 728 | + ], | |
| 729 | + 'selectors' => [ | |
| 730 | + '{{WRAPPER}} .king-addons-ticker-heading:before' => 'border-width: {{SIZE}}{{UNIT}};', | |
| 731 | + '{{WRAPPER}}.king-addons-ticker-heading-position-left .king-addons-ticker-heading:before' => 'right: -{{SIZE}}{{UNIT}};', | |
| 732 | + '{{WRAPPER}}.king-addons-ticker-heading-position-right .king-addons-ticker-heading:before' => 'left: -{{SIZE}}{{UNIT}};', | |
| 733 | + ], | |
| 734 | + 'condition' => [ | |
| 735 | + 'heading_triangle' => 'yes', | |
| 736 | + ], | |
| 737 | + ] | |
| 738 | + ); | |
| 739 | + | |
| 740 | + $this->add_control( | |
| 741 | + 'heading_link', | |
| 742 | + [ | |
| 743 | + 'label' => esc_html__('Link', 'king-addons'), | |
| 744 | + 'type' => Controls_Manager::URL, | |
| 745 | + 'dynamic' => [ | |
| 746 | + 'active' => true, | |
| 747 | + ], | |
| 748 | + 'placeholder' => esc_html__('https://example.com', 'king-addons'), | |
| 749 | + 'separator' => 'before', | |
| 750 | + | |
| 751 | + ] | |
| 752 | + ); | |
| 753 | + | |
| 754 | + $this->end_controls_section(); | |
| 755 | + | |
| 756 | + | |
| 757 | + $this->start_controls_section( | |
| 758 | + 'section_settings', | |
| 759 | + [ | |
| 760 | + 'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Settings', 'king-addons'), | |
| 761 | + 'type' => Controls_Manager::SECTION, | |
| 762 | + ] | |
| 763 | + ); | |
| 764 | + | |
| 765 | + $this->add_control( | |
| 766 | + 'image_switcher', | |
| 767 | + [ | |
| 768 | + 'label' => esc_html__('Show Image', 'king-addons'), | |
| 769 | + 'type' => Controls_Manager::SWITCHER, | |
| 770 | + 'default' => 'yes', | |
| 771 | + ] | |
| 772 | + ); | |
| 773 | + | |
| 774 | + $this->add_group_control( | |
| 775 | + Group_Control_Image_Size::get_type(), | |
| 776 | + [ | |
| 777 | + 'name' => 'image_size', | |
| 778 | + 'default' => 'full', | |
| 779 | + 'condition' => [ | |
| 780 | + 'image_switcher' => 'yes', | |
| 781 | + ], | |
| 782 | + ] | |
| 783 | + ); | |
| 784 | + | |
| 785 | + $this->add_responsive_control( | |
| 786 | + 'height', | |
| 787 | + [ | |
| 788 | + 'type' => Controls_Manager::SLIDER, | |
| 789 | + 'label' => esc_html__('Height', 'king-addons'), | |
| 790 | + 'size_units' => ['px'], | |
| 791 | + 'range' => [ | |
| 792 | + 'px' => [ | |
| 793 | + 'min' => 20, | |
| 794 | + 'max' => 300, | |
| 795 | + ], | |
| 796 | + ], | |
| 797 | + 'default' => [ | |
| 798 | + 'unit' => 'px', | |
| 799 | + 'size' => 30, | |
| 800 | + ], | |
| 801 | + 'selectors' => [ | |
| 802 | + '{{WRAPPER}} .king-addons-ticker-slider' => 'height: {{SIZE}}{{UNIT}};', | |
| 803 | + '{{WRAPPER}} .king-addons-ticker-item' => 'height: {{SIZE}}{{UNIT}};', | |
| 804 | + ], | |
| 805 | + 'render_type' => 'template', | |
| 806 | + 'separator' => 'before', | |
| 807 | + ] | |
| 808 | + ); | |
| 809 | + | |
| 810 | + $this->add_control_type_select(); | |
| 811 | + | |
| 812 | + | |
| 813 | + Core::renderUpgradeProNotice($this, Controls_Manager::RAW_HTML, 'content-ticker', 'type_select', ['pro-mq']); | |
| 814 | + | |
| 815 | + $this->add_responsive_control( | |
| 816 | + 'slider_amount', | |
| 817 | + [ | |
| 818 | + 'label' => esc_html__('Number of Slides', 'king-addons'), | |
| 819 | + 'type' => Controls_Manager::NUMBER, | |
| 820 | + 'label_block' => false, | |
| 821 | + 'default' => 4, | |
| 822 | + 'widescreen_default' => 4, | |
| 823 | + 'laptop_default' => 4, | |
| 824 | + 'tablet_extra_default' => 4, | |
| 825 | + 'tablet_default' => 3, | |
| 826 | + 'mobile_extra_default' => 3, | |
| 827 | + 'mobile_default' => 1, | |
| 828 | + 'min' => 1, | |
| 829 | + 'max' => 10, | |
| 830 | + 'prefix_class' => 'king-addons-ticker-slider-columns-%s', | |
| 831 | + 'render_type' => 'template', | |
| 832 | + 'frontend_available' => true, | |
| 833 | + 'separator' => 'before', | |
| 834 | + 'condition' => [ | |
| 835 | + 'slider_effect' => 'hr-slide', | |
| 836 | + 'type_select' => 'slider', | |
| 837 | + ], | |
| 838 | + ] | |
| 839 | + ); | |
| 840 | + | |
| 841 | + $this->add_control( | |
| 842 | + 'slides_to_scroll', | |
| 843 | + [ | |
| 844 | + 'label' => esc_html__('Slides to Scroll', 'king-addons'), | |
| 845 | + 'type' => Controls_Manager::NUMBER, | |
| 846 | + 'min' => 1, | |
| 847 | + 'max' => 10, | |
| 848 | + 'frontend_available' => true, | |
| 849 | + 'default' => 1, | |
| 850 | + 'widescreen_default' => 1, | |
| 851 | + 'laptop_default' => 1, | |
| 852 | + 'tablet_extra_default' => 1, | |
| 853 | + 'tablet_default' => 1, | |
| 854 | + 'mobile_extra_default' => 1, | |
| 855 | + 'mobile_default' => 1, | |
| 856 | + 'prefix_class' => 'king-addons-ticker-slides-to-scroll-', | |
| 857 | + 'render_type' => 'template', | |
| 858 | + 'condition' => [ | |
| 859 | + 'slider_effect' => 'hr-slide', | |
| 860 | + 'type_select' => 'slider', | |
| 861 | + ], | |
| 862 | + ] | |
| 863 | + ); | |
| 864 | + | |
| 865 | + $this->add_responsive_control( | |
| 866 | + 'slider_gutter', | |
| 867 | + [ | |
| 868 | + 'type' => Controls_Manager::SLIDER, | |
| 869 | + 'label' => esc_html__('Gutter', 'king-addons'), | |
| 870 | + 'size_units' => ['px'], | |
| 871 | + 'range' => [ | |
| 872 | + 'px' => [ | |
| 873 | + 'min' => 0, | |
| 874 | + 'max' => 100, | |
| 875 | + ] | |
| 876 | + ], | |
| 877 | + 'default' => [ | |
| 878 | + 'unit' => 'px', | |
| 879 | + 'size' => 30, | |
| 880 | + ], | |
| 881 | + 'selectors' => [ | |
| 882 | + '{{WRAPPER}} .king-addons-ticker-slider .slick-slide' => 'margin-left: {{SIZE}}{{UNIT}};', | |
| 883 | + '{{WRAPPER}} .king-addons-ticker-slider .slick-list' => 'margin-left: -{{SIZE}}{{UNIT}};', | |
| 884 | + '{{WRAPPER}} .king-addons-ticker-marquee .king-addons-ticker-item' => 'margin-right: {{SIZE}}{{UNIT}};', | |
| 885 | + ], | |
| 886 | + 'render_type' => 'template', | |
| 887 | + 'separator' => 'before', | |
| 888 | + 'conditions' => [ | |
| 889 | + 'relation' => 'or', | |
| 890 | + 'terms' => [ | |
| 891 | + [ | |
| 892 | + 'name' => 'type_select', | |
| 893 | + 'operator' => '=', | |
| 894 | + 'value' => 'marquee', | |
| 895 | + ], | |
| 896 | + [ | |
| 897 | + 'relation' => 'and', | |
| 898 | + 'terms' => [ | |
| 899 | + [ | |
| 900 | + 'name' => 'type_select', | |
| 901 | + 'operator' => '=', | |
| 902 | + 'value' => 'slider', | |
| 903 | + ], | |
| 904 | + [ | |
| 905 | + 'name' => 'slider_amount', | |
| 906 | + 'operator' => '!=', | |
| 907 | + 'value' => '1', | |
| 908 | + ], | |
| 909 | + ], | |
| 910 | + ], | |
| 911 | + ], | |
| 912 | + ], | |
| 913 | + ] | |
| 914 | + ); | |
| 915 | + | |
| 916 | + $this->add_control( | |
| 917 | + 'slider_nav', | |
| 918 | + [ | |
| 919 | + 'label' => esc_html__('Navigation', 'king-addons'), | |
| 920 | + 'type' => Controls_Manager::SWITCHER, | |
| 921 | + 'default' => 'yes', | |
| 922 | + 'separator' => 'before', | |
| 923 | + 'condition' => [ | |
| 924 | + 'type_select' => 'slider', | |
| 925 | + ], | |
| 926 | + ] | |
| 927 | + ); | |
| 928 | + | |
| 929 | + $this->add_control( | |
| 930 | + 'slider_nav_icon', | |
| 931 | + [ | |
| 932 | + 'label' => esc_html__('Select Icon', 'king-addons'), | |
| 933 | + 'type' => Controls_Manager::SELECT, | |
| 934 | + 'default' => 'fas fa-angle-left', | |
| 935 | + 'options' => [ | |
| 936 | + 'fas fa-angle-left' => esc_html__('Angle', 'king-addons'), | |
| 937 | + 'fas fa-angle-double-left' => esc_html__('Angle Double', 'king-addons'), | |
| 938 | + 'fas fa-arrow-left' => esc_html__('Arrow', 'king-addons'), | |
| 939 | + 'fas fa-arrow-alt-circle-left' => esc_html__('Arrow Circle', 'king-addons'), | |
| 940 | + 'far fa-arrow-alt-circle-left' => esc_html__('Arrow Circle Alt', 'king-addons'), | |
| 941 | + 'fas fa-long-arrow-alt-left' => esc_html__('Long Arrow', 'king-addons'), | |
| 942 | + 'fas fa-chevron-left' => esc_html__('Chevron', 'king-addons'), | |
| 943 | + ], | |
| 944 | + 'condition' => [ | |
| 945 | + 'type_select' => 'slider', | |
| 946 | + 'slider_nav' => 'yes', | |
| 947 | + ], | |
| 948 | + ] | |
| 949 | + ); | |
| 950 | + | |
| 951 | + $this->add_control( | |
| 952 | + 'slider_nav_style', | |
| 953 | + [ | |
| 954 | + 'label' => esc_html__('Style', 'king-addons'), | |
| 955 | + 'type' => Controls_Manager::SELECT, | |
| 956 | + 'default' => 'horizontal', | |
| 957 | + 'options' => [ | |
| 958 | + 'horizontal' => esc_html__('Horizontal', 'king-addons'), | |
| 959 | + 'vertical' => esc_html__('Vertical', 'king-addons'), | |
| 960 | + ], | |
| 961 | + 'prefix_class' => 'king-addons-ticker-arrow-style-', | |
| 962 | + 'condition' => [ | |
| 963 | + 'type_select' => 'slider', | |
| 964 | + 'slider_nav' => 'yes', | |
| 965 | + ], | |
| 966 | + ] | |
| 967 | + ); | |
| 968 | + | |
| 969 | + $this->add_control( | |
| 970 | + 'slider_nav_position', | |
| 971 | + [ | |
| 972 | + 'label' => esc_html__('Position', 'king-addons'), | |
| 973 | + 'type' => Controls_Manager::CHOOSE, | |
| 974 | + 'label_block' => false, | |
| 975 | + 'default' => 'right', | |
| 976 | + 'options' => [ | |
| 977 | + 'left' => [ | |
| 978 | + 'title' => esc_html__('Left', 'king-addons'), | |
| 979 | + 'icon' => 'eicon-h-align-left', | |
| 980 | + ], | |
| 981 | + 'right' => [ | |
| 982 | + 'title' => esc_html__('Right', 'king-addons'), | |
| 983 | + 'icon' => 'eicon-h-align-right', | |
| 984 | + ], | |
| 985 | + ], | |
| 986 | + 'prefix_class' => 'king-addons-ticker-arrow-position-', | |
| 987 | + 'render_type' => 'template', | |
| 988 | + 'condition' => [ | |
| 989 | + 'type_select' => 'slider', | |
| 990 | + 'slider_nav' => 'yes', | |
| 991 | + ], | |
| 992 | + ] | |
| 993 | + ); | |
| 994 | + | |
| 995 | + $this->add_control( | |
| 996 | + 'slider_autoplay', | |
| 997 | + [ | |
| 998 | + 'label' => esc_html__('Autoplay', 'king-addons'), | |
| 999 | + 'type' => Controls_Manager::SWITCHER, | |
| 1000 | + 'default' => 'yes', | |
| 1001 | + 'frontend_available' => true, | |
| 1002 | + 'separator' => 'before', | |
| 1003 | + 'condition' => [ | |
| 1004 | + 'type_select' => 'slider', | |
| 1005 | + ], | |
| 1006 | + ] | |
| 1007 | + ); | |
| 1008 | + | |
| 1009 | + $this->add_control( | |
| 1010 | + 'slider_autoplay_duration', | |
| 1011 | + [ | |
| 1012 | + 'label' => esc_html__('Autoplay Speed', 'king-addons'), | |
| 1013 | + 'type' => Controls_Manager::NUMBER, | |
| 1014 | + 'default' => 3, | |
| 1015 | + 'min' => 0, | |
| 1016 | + 'max' => 15, | |
| 1017 | + 'step' => 0.5, | |
| 1018 | + 'frontend_available' => true, | |
| 1019 | + 'condition' => [ | |
| 1020 | + 'type_select' => 'slider', | |
| 1021 | + 'slider_autoplay' => 'yes', | |
| 1022 | + ], | |
| 1023 | + ] | |
| 1024 | + ); | |
| 1025 | + | |
| 1026 | + $this->add_control( | |
| 1027 | + 'slider_pause_on_hover', | |
| 1028 | + [ | |
| 1029 | + 'label' => esc_html__('Pause Slide on Hover', 'king-addons'), | |
| 1030 | + 'type' => Controls_Manager::SWITCHER, | |
| 1031 | + 'default' => 'yes', | |
| 1032 | + 'condition' => [ | |
| 1033 | + 'slider_autoplay' => 'yes', | |
| 1034 | + 'type_select' => 'slider', | |
| 1035 | + ], | |
| 1036 | + ] | |
| 1037 | + ); | |
| 1038 | + | |
| 1039 | + $this->add_control( | |
| 1040 | + 'slider_loop', | |
| 1041 | + [ | |
| 1042 | + 'label' => esc_html__('Infinite Loop', 'king-addons'), | |
| 1043 | + 'type' => Controls_Manager::SWITCHER, | |
| 1044 | + 'frontend_available' => true, | |
| 1045 | + 'default' => 'yes', | |
| 1046 | + 'separator' => 'before', | |
| 1047 | + 'condition' => [ | |
| 1048 | + 'type_select' => 'slider', | |
| 1049 | + ], | |
| 1050 | + ] | |
| 1051 | + ); | |
| 1052 | + | |
| 1053 | + $this->add_control_slider_effect(); | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + Core::renderUpgradeProNotice($this, Controls_Manager::RAW_HTML, 'content-ticker', 'slider_effect', ['pro-tp', 'pro-fd', 'pro-vs']); | |
| 1057 | + | |
| 1058 | + $this->add_control_slider_effect_cursor(); | |
| 1059 | + | |
| 1060 | + $this->add_control( | |
| 1061 | + 'slider_effect_duration', | |
| 1062 | + [ | |
| 1063 | + 'label' => esc_html__('Transition Duration (seconds)', 'king-addons'), | |
| 1064 | + 'type' => Controls_Manager::NUMBER, | |
| 1065 | + 'default' => 1, | |
| 1066 | + 'min' => 0, | |
| 1067 | + 'max' => 5, | |
| 1068 | + 'step' => 0.1, | |
| 1069 | + 'condition' => [ | |
| 1070 | + 'type_select' => 'slider', | |
| 1071 | + ], | |
| 1072 | + ] | |
| 1073 | + ); | |
| 1074 | + | |
| 1075 | + $this->add_control_marquee_direction(); | |
| 1076 | + | |
| 1077 | + $this->add_control_marquee_pause_on_hover(); | |
| 1078 | + | |
| 1079 | + $this->add_control_marquee_effect_duration(); | |
| 1080 | + | |
| 1081 | + $this->end_controls_section(); | |
| 1082 | + | |
| 1083 | + Core::renderProFeaturesSection($this, '', Controls_Manager::RAW_HTML, 'content-ticker', [ | |
| 1084 | + 'Add Custom Ticker Items (Instead of Loading Dynamically)', | |
| 1085 | + 'Custom Post Types', | |
| 1086 | + 'Marquee Animation - Smooth Animation with Direction Option', | |
| 1087 | + 'Slider Animation Options - Typing, Fade & Vertical Slide', | |
| 1088 | + 'Heading Icon Type - Animated Circle' | |
| 1089 | + ]); | |
| 1090 | + | |
| 1091 | + $this->start_controls_section( | |
| 1092 | + 'section_style_button', | |
| 1093 | + [ | |
| 1094 | + 'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Heading', 'king-addons'), | |
| 1095 | + 'tab' => Controls_Manager::TAB_STYLE, | |
| 1096 | + ] | |
| 1097 | + ); | |
| 1098 | + | |
| 1099 | + $this->start_controls_tabs('tabs_heading_colors'); | |
| 1100 | + | |
| 1101 | + $this->start_controls_tab( | |
| 1102 | + 'tab_heading_normal_colors', | |
| 1103 | + [ | |
| 1104 | + 'label' => esc_html__('Normal', 'king-addons'), | |
| 1105 | + ] | |
| 1106 | + ); | |
| 1107 | + | |
| 1108 | + $this->add_control( | |
| 1109 | + 'heading_color', | |
| 1110 | + [ | |
| 1111 | + 'label' => esc_html__('Color', 'king-addons'), | |
| 1112 | + 'type' => Controls_Manager::COLOR, | |
| 1113 | + 'default' => '#ffffff', | |
| 1114 | + 'selectors' => [ | |
| 1115 | + '{{WRAPPER}} .king-addons-ticker-heading' => 'color: {{VALUE}}', | |
| 1116 | + ], | |
| 1117 | + ] | |
| 1118 | + ); | |
| 1119 | + | |
| 1120 | + $this->add_control( | |
| 1121 | + 'heading_bg_color', | |
| 1122 | + [ | |
| 1123 | + 'label' => esc_html__('Background Color', 'king-addons'), | |
| 1124 | + 'type' => Controls_Manager::COLOR, | |
| 1125 | + 'default' => '#5B03FF', | |
| 1126 | + 'selectors' => [ | |
| 1127 | + '{{WRAPPER}} .king-addons-ticker-heading' => 'background-color: {{VALUE}}', | |
| 1128 | + '{{WRAPPER}} .king-addons-ticker-heading::before' => 'border-right-color: {{VALUE}};background-color: {{VALUE}};', | |
| 1129 | + ], | |
| 1130 | + ] | |
| 1131 | + ); | |
| 1132 | + | |
| 1133 | + $this->add_control( | |
| 1134 | + 'heading_icon_color', | |
| 1135 | + [ | |
| 1136 | + 'label' => esc_html__('Icon Color', 'king-addons'), | |
| 1137 | + 'type' => Controls_Manager::COLOR, | |
| 1138 | + 'default' => '#ffffff', | |
| 1139 | + 'selectors' => [ | |
| 1140 | + '{{WRAPPER}} .king-addons-ticker-heading-icon' => 'color: {{VALUE}}', | |
| 1141 | + '{{WRAPPER}} .king-addons-ticker-heading-icon svg' => 'fill: {{VALUE}}', | |
| 1142 | + '{{WRAPPER}} .king-addons-ticker-icon-circle' => 'background-color: {{VALUE}}', | |
| 1143 | + '{{WRAPPER}} .king-addons-ticker-icon-circle::before' => 'border-color: {{VALUE}}', | |
| 1144 | + '{{WRAPPER}} .king-addons-ticker-icon-circle::after' => 'border-color: {{VALUE}}', | |
| 1145 | + ], | |
| 1146 | + ] | |
| 1147 | + ); | |
| 1148 | + | |
| 1149 | + $this->add_control( | |
| 1150 | + 'heading_border_color', | |
| 1151 | + [ | |
| 1152 | + 'label' => esc_html__('Border Color', 'king-addons'), | |
| 1153 | + 'type' => Controls_Manager::COLOR, | |
| 1154 | + 'default' => '#ffffff', | |
| 1155 | + 'selectors' => [ | |
| 1156 | + '{{WRAPPER}} .king-addons-ticker-heading' => 'border-color: {{VALUE}}', | |
| 1157 | + ], | |
| 1158 | + ] | |
| 1159 | + ); | |
| 1160 | + | |
| 1161 | + $this->end_controls_tab(); | |
| 1162 | + | |
| 1163 | + $this->start_controls_tab( | |
| 1164 | + 'tab_heading_hover_colors', | |
| 1165 | + [ | |
| 1166 | + 'label' => esc_html__('Hover', 'king-addons'), | |
| 1167 | + ] | |
| 1168 | + ); | |
| 1169 | + | |
| 1170 | + $this->add_control( | |
| 1171 | + 'heading_hover_color', | |
| 1172 | + [ | |
| 1173 | + 'label' => esc_html__('Color', 'king-addons'), | |
| 1174 | + 'type' => Controls_Manager::COLOR, | |
| 1175 | + 'default' => '#ffffff', | |
| 1176 | + 'selectors' => [ | |
| 1177 | + '{{WRAPPER}} .king-addons-ticker-heading:hover' => 'color: {{VALUE}}', | |
| 1178 | + ], | |
| 1179 | + ] | |
| 1180 | + ); | |
| 1181 | + | |
| 1182 | + $this->add_control( | |
| 1183 | + 'heading_hover_bg_color', | |
| 1184 | + [ | |
| 1185 | + 'label' => esc_html__('Background Color', 'king-addons'), | |
| 1186 | + 'type' => Controls_Manager::COLOR, | |
| 1187 | + 'default' => '#5B03FF', | |
| 1188 | + 'selectors' => [ | |
| 1189 | + '{{WRAPPER}} .king-addons-ticker-heading:hover' => 'background-color: {{VALUE}}', | |
| 1190 | + '{{WRAPPER}} .king-addons-ticker-heading:hover:before' => 'border-right-color: {{VALUE}};background-color: {{VALUE}};', | |
| 1191 | + ], | |
| 1192 | + ] | |
| 1193 | + ); | |
| 1194 | + | |
| 1195 | + $this->add_control( | |
| 1196 | + 'heading_hover_icon_color', | |
| 1197 | + [ | |
| 1198 | + 'label' => esc_html__('Icon Color', 'king-addons'), | |
| 1199 | + 'type' => Controls_Manager::COLOR, | |
| 1200 | + 'default' => '#ffffff', | |
| 1201 | + 'selectors' => [ | |
| 1202 | + '{{WRAPPER}} .king-addons-ticker-heading:hover .king-addons-ticker-heading-icon' => 'color: {{VALUE}}', | |
| 1203 | + '{{WRAPPER}} .king-addons-ticker-heading:hover .king-addons-ticker-heading-icon svg' => 'fill: {{VALUE}}', | |
| 1204 | + '{{WRAPPER}} .king-addons-ticker-heading:hover .king-addons-ticker-icon-circle' => 'background-color: {{VALUE}}', | |
| 1205 | + '{{WRAPPER}} .king-addons-ticker-heading:hover .king-addons-ticker-icon-circle::before' => 'border-color: {{VALUE}}', | |
| 1206 | + '{{WRAPPER}} .king-addons-ticker-heading:hover .king-addons-ticker-icon-circle::after' => 'border-color: {{VALUE}}', | |
| 1207 | + ], | |
| 1208 | + ] | |
| 1209 | + ); | |
| 1210 | + | |
| 1211 | + $this->add_control( | |
| 1212 | + 'heading_hover_border_color', | |
| 1213 | + [ | |
| 1214 | + 'label' => esc_html__('Border Color', 'king-addons'), | |
| 1215 | + 'type' => Controls_Manager::COLOR, | |
| 1216 | + 'default' => '#ffffff', | |
| 1217 | + 'selectors' => [ | |
| 1218 | + '{{WRAPPER}} .king-addons-ticker-heading:hover' => 'border-color: {{VALUE}}', | |
| 1219 | + ], | |
| 1220 | + ] | |
| 1221 | + ); | |
| 1222 | + | |
| 1223 | + $this->end_controls_tab(); | |
| 1224 | + | |
| 1225 | + $this->end_controls_tabs(); | |
| 1226 | + | |
| 1227 | + $this->add_control( | |
| 1228 | + 'heading_transition_duration', | |
| 1229 | + [ | |
| 1230 | + 'label' => esc_html__('Transition Duration (seconds)', 'king-addons'), | |
| 1231 | + 'type' => Controls_Manager::NUMBER, | |
| 1232 | + 'default' => 0.1, | |
| 1233 | + 'min' => 0, | |
| 1234 | + 'max' => 5, | |
| 1235 | + 'step' => 0.1, | |
| 1236 | + 'selectors' => [ | |
| 1237 | + '{{WRAPPER}} .king-addons-ticker-heading' => '-webkit-transition-duration: {{VALUE}}s;transition-duration: {{VALUE}}s', | |
| 1238 | + '{{WRAPPER}} .king-addons-ticker-heading svg' => '-webkit-transition-duration: {{VALUE}}s;transition-duration: {{VALUE}}s', | |
| 1239 | + | |
| 1240 | + ], | |
| 1241 | + 'separator' => 'before', | |
| 1242 | + ] | |
| 1243 | + ); | |
| 1244 | + | |
| 1245 | + $this->add_control( | |
| 1246 | + 'heading_typography_divider', | |
| 1247 | + [ | |
| 1248 | + 'type' => Controls_Manager::DIVIDER, | |
| 1249 | + 'style' => 'thick', | |
| 1250 | + ] | |
| 1251 | + ); | |
| 1252 | + | |
| 1253 | + $this->add_group_control( | |
| 1254 | + Group_Control_Typography::get_type(), | |
| 1255 | + [ | |
| 1256 | + 'name' => 'heading_typography', | |
| 1257 | + 'selector' => '{{WRAPPER}} .king-addons-ticker-heading-text', | |
| 1258 | + 'separator' => 'before', | |
| 1259 | + ] | |
| 1260 | + ); | |
| 1261 | + | |
| 1262 | + $this->add_responsive_control( | |
| 1263 | + 'heading_padding', | |
| 1264 | + [ | |
| 1265 | + 'label' => esc_html__('Padding', 'king-addons'), | |
| 1266 | + 'type' => Controls_Manager::DIMENSIONS, | |
| 1267 | + 'size_units' => ['px',], | |
| 1268 | + 'default' => [ | |
| 1269 | + 'top' => 0, | |
| 1270 | + 'right' => 10, | |
| 1271 | + 'bottom' => 0, | |
| 1272 | + 'left' => 10, | |
| 1273 | + ], | |
| 1274 | + 'selectors' => [ | |
| 1275 | + '{{WRAPPER}} .king-addons-ticker-heading' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 1276 | + ], | |
| 1277 | + 'separator' => 'before', | |
| 1278 | + ] | |
| 1279 | + ); | |
| 1280 | + | |
| 1281 | + $this->add_control( | |
| 1282 | + 'heading_border_type', | |
| 1283 | + [ | |
| 1284 | + 'label' => esc_html__('Border Type', 'king-addons'), | |
| 1285 | + 'type' => Controls_Manager::SELECT, | |
| 1286 | + 'options' => [ | |
| 1287 | + 'none' => esc_html__('None', 'king-addons'), | |
| 1288 | + 'solid' => esc_html__('Solid', 'king-addons'), | |
| 1289 | + 'double' => esc_html__('Double', 'king-addons'), | |
| 1290 | + 'dotted' => esc_html__('Dotted', 'king-addons'), | |
| 1291 | + 'dashed' => esc_html__('Dashed', 'king-addons'), | |
| 1292 | + 'groove' => esc_html__('Groove', 'king-addons'), | |
| 1293 | + ], | |
| 1294 | + 'default' => 'none', | |
| 1295 | + 'selectors' => [ | |
| 1296 | + '{{WRAPPER}} .king-addons-ticker-heading' => 'border-style: {{VALUE}};', | |
| 1297 | + ], | |
| 1298 | + 'separator' => 'before', | |
| 1299 | + ] | |
| 1300 | + ); | |
| 1301 | + | |
| 1302 | + $this->add_responsive_control( | |
| 1303 | + 'heading_border_width', | |
| 1304 | + [ | |
| 1305 | + 'label' => esc_html__('Border Width', 'king-addons'), | |
| 1306 | + 'type' => Controls_Manager::DIMENSIONS, | |
| 1307 | + 'size_units' => ['px',], | |
| 1308 | + 'default' => [ | |
| 1309 | + 'top' => 1, | |
| 1310 | + 'right' => 1, | |
| 1311 | + 'bottom' => 1, | |
| 1312 | + 'left' => 1, | |
| 1313 | + ], | |
| 1314 | + 'selectors' => [ | |
| 1315 | + '{{WRAPPER}} .king-addons-ticker-heading' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 1316 | + ], | |
| 1317 | + 'condition' => [ | |
| 1318 | + 'heading_border_type!' => 'none', | |
| 1319 | + ], | |
| 1320 | + ] | |
| 1321 | + ); | |
| 1322 | + | |
| 1323 | + $this->add_responsive_control( | |
| 1324 | + 'heading_border_radius', | |
| 1325 | + [ | |
| 1326 | + 'label' => esc_html__('Border Radius', 'king-addons'), | |
| 1327 | + 'type' => Controls_Manager::DIMENSIONS, | |
| 1328 | + 'size_units' => ['px', '%'], | |
| 1329 | + 'default' => [ | |
| 1330 | + 'top' => 0, | |
| 1331 | + 'right' => 0, | |
| 1332 | + 'bottom' => 0, | |
| 1333 | + 'left' => 0, | |
| 1334 | + ], | |
| 1335 | + 'selectors' => [ | |
| 1336 | + '{{WRAPPER}} .king-addons-ticker-heading' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 1337 | + ], | |
| 1338 | + 'separator' => 'before', | |
| 1339 | + ] | |
| 1340 | + ); | |
| 1341 | + | |
| 1342 | + $this->end_controls_section(); | |
| 1343 | + | |
| 1344 | + | |
| 1345 | + $this->start_controls_section( | |
| 1346 | + 'section_style_input', | |
| 1347 | + [ | |
| 1348 | + 'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Content', 'king-addons'), | |
| 1349 | + 'tab' => Controls_Manager::TAB_STYLE, | |
| 1350 | + ] | |
| 1351 | + ); | |
| 1352 | + | |
| 1353 | + $this->add_control( | |
| 1354 | + 'content_bg_color', | |
| 1355 | + [ | |
| 1356 | + 'label' => esc_html__('Background Color', 'king-addons'), | |
| 1357 | + 'type' => Controls_Manager::COLOR, | |
| 1358 | + 'default' => '#ffffff', | |
| 1359 | + 'selectors' => [ | |
| 1360 | + '{{WRAPPER}} .king-addons-content-ticker-inner' => 'background-color: {{VALUE}};', | |
| 1361 | + '{{WRAPPER}} .king-addons-ticker-gradient:after' => 'background-image: linear-gradient(to right,rgba(255,255,255,0),{{VALUE}});', | |
| 1362 | + '{{WRAPPER}} .king-addons-ticker-gradient:before' => 'background-image: linear-gradient(to left,rgba(255,255,255,0),{{VALUE}});', | |
| 1363 | + ], | |
| 1364 | + ] | |
| 1365 | + ); | |
| 1366 | + | |
| 1367 | + $this->add_group_control( | |
| 1368 | + Group_Control_Box_Shadow::get_type(), | |
| 1369 | + [ | |
| 1370 | + 'name' => 'content_box_shadow', | |
| 1371 | + 'selector' => '{{WRAPPER}} .king-addons-content-ticker', | |
| 1372 | + ] | |
| 1373 | + ); | |
| 1374 | + | |
| 1375 | + $this->add_control( | |
| 1376 | + 'content_gradient_position', | |
| 1377 | + [ | |
| 1378 | + 'label' => esc_html__('Gradient Position', 'king-addons'), | |
| 1379 | + 'type' => Controls_Manager::SELECT, | |
| 1380 | + 'default' => 'right', | |
| 1381 | + 'options' => [ | |
| 1382 | + 'none' => esc_html__('None', 'king-addons'), | |
| 1383 | + 'left' => esc_html__('Left', 'king-addons'), | |
| 1384 | + 'right' => esc_html__('Right', 'king-addons'), | |
| 1385 | + 'both' => esc_html__('Both', 'king-addons'), | |
| 1386 | + ], | |
| 1387 | + 'prefix_class' => 'king-addons-ticker-gradient-type-', | |
| 1388 | + 'render_type' => 'template', | |
| 1389 | + 'separator' => 'before', | |
| 1390 | + ] | |
| 1391 | + ); | |
| 1392 | + | |
| 1393 | + $this->add_responsive_control( | |
| 1394 | + 'content_padding', | |
| 1395 | + [ | |
| 1396 | + 'label' => esc_html__('Padding', 'king-addons'), | |
| 1397 | + 'type' => Controls_Manager::DIMENSIONS, | |
| 1398 | + 'default' => [ | |
| 1399 | + 'top' => 5, | |
| 1400 | + 'right' => 10, | |
| 1401 | + 'bottom' => 5, | |
| 1402 | + 'left' => 30, | |
| 1403 | + ], | |
| 1404 | + 'size_units' => ['px'], | |
| 1405 | + 'selectors' => [ | |
| 1406 | + '{{WRAPPER}} .king-addons-content-ticker-inner' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 1407 | + ], | |
| 1408 | + 'separator' => 'before', | |
| 1409 | + ] | |
| 1410 | + ); | |
| 1411 | + | |
| 1412 | + $this->add_control( | |
| 1413 | + 'content_border_type', | |
| 1414 | + [ | |
| 1415 | + 'label' => esc_html__('Border Type', 'king-addons'), | |
| 1416 | + 'type' => Controls_Manager::SELECT, | |
| 1417 | + 'options' => [ | |
| 1418 | + 'none' => esc_html__('None', 'king-addons'), | |
| 1419 | + 'solid' => esc_html__('Solid', 'king-addons'), | |
| 1420 | + 'double' => esc_html__('Double', 'king-addons'), | |
| 1421 | + 'dotted' => esc_html__('Dotted', 'king-addons'), | |
| 1422 | + 'dashed' => esc_html__('Dashed', 'king-addons'), | |
| 1423 | + 'groove' => esc_html__('Groove', 'king-addons'), | |
| 1424 | + ], | |
| 1425 | + 'default' => 'solid', | |
| 1426 | + 'selectors' => [ | |
| 1427 | + '{{WRAPPER}} .king-addons-content-ticker' => 'border-style: {{VALUE}};', | |
| 1428 | + ], | |
| 1429 | + 'separator' => 'before', | |
| 1430 | + ] | |
| 1431 | + ); | |
| 1432 | + | |
| 1433 | + $this->add_control( | |
| 1434 | + 'content_border_width', | |
| 1435 | + [ | |
| 1436 | + 'label' => esc_html__('Border Width', 'king-addons'), | |
| 1437 | + 'type' => Controls_Manager::DIMENSIONS, | |
| 1438 | + 'default' => [ | |
| 1439 | + 'top' => 1, | |
| 1440 | + 'right' => 1, | |
| 1441 | + 'bottom' => 1, | |
| 1442 | + 'left' => 1, | |
| 1443 | + ], | |
| 1444 | + 'size_units' => ['px'], | |
| 1445 | + 'selectors' => [ | |
| 1446 | + '{{WRAPPER}} .king-addons-content-ticker' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 1447 | + ], | |
| 1448 | + 'condition' => [ | |
| 1449 | + 'content_border_type!' => 'none', | |
| 1450 | + ], | |
| 1451 | + ] | |
| 1452 | + ); | |
| 1453 | + | |
| 1454 | + $this->add_control( | |
| 1455 | + 'content_border_color', | |
| 1456 | + [ | |
| 1457 | + 'label' => esc_html__('Border Color', 'king-addons'), | |
| 1458 | + 'type' => Controls_Manager::COLOR, | |
| 1459 | + 'default' => '#dbdbdb', | |
| 1460 | + 'selectors' => [ | |
| 1461 | + '{{WRAPPER}} .king-addons-content-ticker' => 'border-color: {{VALUE}};', | |
| 1462 | + ], | |
| 1463 | + 'condition' => [ | |
| 1464 | + 'content_border_type!' => 'none', | |
| 1465 | + ], | |
| 1466 | + ] | |
| 1467 | + ); | |
| 1468 | + | |
| 1469 | + $this->add_control( | |
| 1470 | + 'content_border_radius', | |
| 1471 | + [ | |
| 1472 | + 'label' => esc_html__('Border Radius', 'king-addons'), | |
| 1473 | + 'type' => Controls_Manager::DIMENSIONS, | |
| 1474 | + 'default' => [ | |
| 1475 | + 'top' => 0, | |
| 1476 | + 'right' => 0, | |
| 1477 | + 'bottom' => 0, | |
| 1478 | + 'left' => 0, | |
| 1479 | + ], | |
| 1480 | + 'size_units' => ['px', '%'], | |
| 1481 | + 'selectors' => [ | |
| 1482 | + '{{WRAPPER}} .king-addons-content-ticker' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 1483 | + ], | |
| 1484 | + 'separator' => 'before', | |
| 1485 | + ] | |
| 1486 | + ); | |
| 1487 | + | |
| 1488 | + | |
| 1489 | + $this->add_control( | |
| 1490 | + 'content_title_section', | |
| 1491 | + [ | |
| 1492 | + 'label' => esc_html__('Title', 'king-addons'), | |
| 1493 | + 'type' => Controls_Manager::HEADING, | |
| 1494 | + 'separator' => 'before', | |
| 1495 | + ] | |
| 1496 | + ); | |
| 1497 | + | |
| 1498 | + $this->add_group_control( | |
| 1499 | + Group_Control_Typography::get_type(), | |
| 1500 | + [ | |
| 1501 | + 'name' => 'content_title_typography', | |
| 1502 | + 'selector' => '{{WRAPPER}} .king-addons-ticker-title', | |
| 1503 | + ] | |
| 1504 | + ); | |
| 1505 | + | |
| 1506 | + $this->start_controls_tabs('tabs_content_title_colors'); | |
| 1507 | + | |
| 1508 | + $this->start_controls_tab( | |
| 1509 | + 'tab_content_title_normal_colors', | |
| 1510 | + [ | |
| 1511 | + 'label' => esc_html__('Normal', 'king-addons'), | |
| 1512 | + ] | |
| 1513 | + ); | |
| 1514 | + | |
| 1515 | + | |
| 1516 | + $this->add_control( | |
| 1517 | + 'content_title_color', | |
| 1518 | + [ | |
| 1519 | + 'label' => esc_html__('Title Color', 'king-addons'), | |
| 1520 | + 'type' => Controls_Manager::COLOR, | |
| 1521 | + 'default' => '#555555', | |
| 1522 | + 'selectors' => [ | |
| 1523 | + '{{WRAPPER}} .king-addons-ticker-title a' => 'color: {{VALUE}};', | |
| 1524 | + '{{WRAPPER}} .king-addons-ticker-title:after' => 'color: {{VALUE}};', | |
| 1525 | + ], | |
| 1526 | + ] | |
| 1527 | + ); | |
| 1528 | + | |
| 1529 | + $this->end_controls_tab(); | |
| 1530 | + | |
| 1531 | + $this->start_controls_tab( | |
| 1532 | + 'tab_content_title_hover_colors', | |
| 1533 | + [ | |
| 1534 | + 'label' => esc_html__('Hover', 'king-addons'), | |
| 1535 | + ] | |
| 1536 | + ); | |
| 1537 | + | |
| 1538 | + $this->add_control( | |
| 1539 | + 'content_hover_title_color', | |
| 1540 | + [ | |
| 1541 | + 'label' => esc_html__('Title Color', 'king-addons'), | |
| 1542 | + 'type' => Controls_Manager::COLOR, | |
| 1543 | + 'selectors' => [ | |
| 1544 | + '{{WRAPPER}} .king-addons-ticker-title:hover a' => 'color: {{VALUE}};', | |
| 1545 | + '{{WRAPPER}} .king-addons-ticker-title:after' => 'color: {{VALUE}};', | |
| 1546 | + ], | |
| 1547 | + ] | |
| 1548 | + ); | |
| 1549 | + | |
| 1550 | + $this->end_controls_tab(); | |
| 1551 | + | |
| 1552 | + $this->end_controls_tabs(); | |
| 1553 | + | |
| 1554 | + | |
| 1555 | + $this->add_control( | |
| 1556 | + 'content_image_section', | |
| 1557 | + [ | |
| 1558 | + 'label' => esc_html__('Image', 'king-addons'), | |
| 1559 | + 'type' => Controls_Manager::HEADING, | |
| 1560 | + 'separator' => 'before', | |
| 1561 | + ] | |
| 1562 | + ); | |
| 1563 | + | |
| 1564 | + $this->add_responsive_control( | |
| 1565 | + 'content_image_width', | |
| 1566 | + [ | |
| 1567 | + 'label' => esc_html__('Width', 'king-addons'), | |
| 1568 | + 'type' => Controls_Manager::SLIDER, | |
| 1569 | + 'range' => [ | |
| 1570 | + 'px' => [ | |
| 1571 | + 'min' => 0, | |
| 1572 | + 'max' => 200, | |
| 1573 | + ], | |
| 1574 | + ], | |
| 1575 | + 'size_units' => ['px'], | |
| 1576 | + 'default' => [ | |
| 1577 | + 'unit' => 'px', | |
| 1578 | + 'size' => 50, | |
| 1579 | + ], | |
| 1580 | + 'selectors' => [ | |
| 1581 | + '{{WRAPPER}} .king-addons-ticker-image' => 'max-width: {{SIZE}}{{UNIT}};', | |
| 1582 | + ], | |
| 1583 | + ] | |
| 1584 | + ); | |
| 1585 | + | |
| 1586 | + $this->end_controls_section(); | |
| 1587 | + | |
| 1588 | + | |
| 1589 | + $this->start_controls_section( | |
| 1590 | + 'section_style_nav', | |
| 1591 | + [ | |
| 1592 | + 'label' => KING_ADDONS_ELEMENTOR_ICON . esc_html__('Navigation', 'king-addons'), | |
| 1593 | + 'tab' => Controls_Manager::TAB_STYLE, | |
| 1594 | + 'condition' => [ | |
| 1595 | + 'type_select' => 'slider', | |
| 1596 | + 'slider_nav' => 'yes', | |
| 1597 | + ], | |
| 1598 | + ] | |
| 1599 | + ); | |
| 1600 | + | |
| 1601 | + $this->start_controls_tabs('tabs_nav_style'); | |
| 1602 | + | |
| 1603 | + $this->start_controls_tab( | |
| 1604 | + 'tab_nav_normal', | |
| 1605 | + [ | |
| 1606 | + 'label' => esc_html__('Normal', 'king-addons'), | |
| 1607 | + ] | |
| 1608 | + ); | |
| 1609 | + | |
| 1610 | + $this->add_control( | |
| 1611 | + 'nav_color', | |
| 1612 | + [ | |
| 1613 | + 'label' => esc_html__('Color', 'king-addons'), | |
| 1614 | + 'type' => Controls_Manager::COLOR, | |
| 1615 | + 'default' => '#ffffff', | |
| 1616 | + 'selectors' => [ | |
| 1617 | + '{{WRAPPER}} .king-addons-ticker-arrow' => 'color: {{VALUE}};', | |
| 1618 | + ], | |
| 1619 | + ] | |
| 1620 | + ); | |
| 1621 | + | |
| 1622 | + $this->add_control( | |
| 1623 | + 'nav_bg_color', | |
| 1624 | + [ | |
| 1625 | + 'label' => esc_html__('Background Color', 'king-addons'), | |
| 1626 | + 'type' => Controls_Manager::COLOR, | |
| 1627 | + 'default' => '#5B03FF', | |
| 1628 | + 'selectors' => [ | |
| 1629 | + '{{WRAPPER}} .king-addons-ticker-arrow' => 'background-color: {{VALUE}};', | |
| 1630 | + ], | |
| 1631 | + ] | |
| 1632 | + ); | |
| 1633 | + | |
| 1634 | + $this->add_control( | |
| 1635 | + 'nav_border_color', | |
| 1636 | + [ | |
| 1637 | + 'label' => esc_html__('Border Color', 'king-addons'), | |
| 1638 | + 'type' => Controls_Manager::COLOR, | |
| 1639 | + 'selectors' => [ | |
| 1640 | + '{{WRAPPER}} .king-addons-ticker-arrow' => 'border-color: {{VALUE}};', | |
| 1641 | + ], | |
| 1642 | + ] | |
| 1643 | + ); | |
| 1644 | + $this->end_controls_tab(); | |
| 1645 | + | |
| 1646 | + $this->start_controls_tab( | |
| 1647 | + 'tab_nav_hover', | |
| 1648 | + [ | |
| 1649 | + 'label' => esc_html__('Hover', 'king-addons'), | |
| 1650 | + ] | |
| 1651 | + ); | |
| 1652 | + | |
| 1653 | + $this->add_control( | |
| 1654 | + 'nav_hover_color', | |
| 1655 | + [ | |
| 1656 | + 'label' => esc_html__('Color', 'king-addons'), | |
| 1657 | + 'type' => Controls_Manager::COLOR, | |
| 1658 | + 'default' => '#ffffff', | |
| 1659 | + 'selectors' => [ | |
| 1660 | + '{{WRAPPER}} .king-addons-ticker-arrow:hover' => 'color: {{VALUE}};', | |
| 1661 | + ], | |
| 1662 | + ] | |
| 1663 | + ); | |
| 1664 | + | |
| 1665 | + $this->add_control( | |
| 1666 | + 'nav_hover_bg_color', | |
| 1667 | + [ | |
| 1668 | + 'label' => esc_html__('Background Color', 'king-addons'), | |
| 1669 | + 'type' => Controls_Manager::COLOR, | |
| 1670 | + 'default' => '#4D02D8', | |
| 1671 | + 'selectors' => [ | |
| 1672 | + '{{WRAPPER}} .king-addons-ticker-arrow:hover' => 'background-color: {{VALUE}};', | |
| 1673 | + ], | |
| 1674 | + ] | |
| 1675 | + ); | |
| 1676 | + | |
| 1677 | + $this->add_control( | |
| 1678 | + 'nav_hover_border_color', | |
| 1679 | + [ | |
| 1680 | + 'label' => esc_html__('Border Color', 'king-addons'), | |
| 1681 | + 'type' => Controls_Manager::COLOR, | |
| 1682 | + 'selectors' => [ | |
| 1683 | + '{{WRAPPER}} .king-addons-ticker-arrow:hover' => 'border-color: {{VALUE}};', | |
| 1684 | + ], | |
| 1685 | + ] | |
| 1686 | + ); | |
| 1687 | + | |
| 1688 | + $this->end_controls_tab(); | |
| 1689 | + | |
| 1690 | + $this->end_controls_tabs(); | |
| 1691 | + | |
| 1692 | + $this->add_control( | |
| 1693 | + 'nav_transition_duration', | |
| 1694 | + [ | |
| 1695 | + 'label' => esc_html__('Transition Duration (seconds)', 'king-addons'), | |
| 1696 | + 'type' => Controls_Manager::NUMBER, | |
| 1697 | + 'default' => 0.1, | |
| 1698 | + 'min' => 0, | |
| 1699 | + 'max' => 5, | |
| 1700 | + 'step' => 0.1, | |
| 1701 | + 'selectors' => [ | |
| 1702 | + '{{WRAPPER}} .king-addons-ticker-arrow' => '-webkit-transition-duration: {{VALUE}}s;transition-duration: {{VALUE}}s', | |
| 1703 | + ], | |
| 1704 | + 'separator' => 'before', | |
| 1705 | + ] | |
| 1706 | + ); | |
| 1707 | + | |
| 1708 | + $this->add_responsive_control( | |
| 1709 | + 'nav_font_size', | |
| 1710 | + [ | |
| 1711 | + 'label' => esc_html__('Font Size', 'king-addons'), | |
| 1712 | + 'type' => Controls_Manager::SLIDER, | |
| 1713 | + 'size_units' => ['px'], | |
| 1714 | + 'range' => [ | |
| 1715 | + 'px' => [ | |
| 1716 | + 'min' => 10, | |
| 1717 | + 'max' => 100, | |
| 1718 | + ], | |
| 1719 | + ], | |
| 1720 | + 'default' => [ | |
| 1721 | + 'unit' => 'px', | |
| 1722 | + 'size' => 14, | |
| 1723 | + ], | |
| 1724 | + 'selectors' => [ | |
| 1725 | + '{{WRAPPER}} .king-addons-ticker-arrow' => 'font-size: {{SIZE}}{{UNIT}};', | |
| 1726 | + ], | |
| 1727 | + 'separator' => 'before', | |
| 1728 | + ] | |
| 1729 | + ); | |
| 1730 | + | |
| 1731 | + $this->add_responsive_control( | |
| 1732 | + 'nav_size', | |
| 1733 | + [ | |
| 1734 | + 'label' => esc_html__('Box Size', 'king-addons'), | |
| 1735 | + 'type' => Controls_Manager::SLIDER, | |
| 1736 | + 'size_units' => ['px'], | |
| 1737 | + 'range' => [ | |
| 1738 | + 'px' => [ | |
| 1739 | + 'min' => 10, | |
| 1740 | + 'max' => 100, | |
| 1741 | + ], | |
| 1742 | + ], | |
| 1743 | + 'default' => [ | |
| 1744 | + 'unit' => 'px', | |
| 1745 | + 'size' => 20, | |
| 1746 | + ], | |
| 1747 | + 'selectors' => [ | |
| 1748 | + '{{WRAPPER}} .king-addons-ticker-arrow' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}}; line-height: {{SIZE}}{{UNIT}};', | |
| 1749 | + ], | |
| 1750 | + ] | |
| 1751 | + ); | |
| 1752 | + | |
| 1753 | + $this->add_responsive_control( | |
| 1754 | + 'nav_gutter', | |
| 1755 | + [ | |
| 1756 | + 'type' => Controls_Manager::SLIDER, | |
| 1757 | + 'label' => esc_html__('Gutter', 'king-addons'), | |
| 1758 | + 'size_units' => ['px'], | |
| 1759 | + 'range' => [ | |
| 1760 | + 'px' => [ | |
| 1761 | + 'min' => 0, | |
| 1762 | + 'max' => 100, | |
| 1763 | + ] | |
| 1764 | + ], | |
| 1765 | + 'default' => [ | |
| 1766 | + 'unit' => 'px', | |
| 1767 | + 'size' => 2, | |
| 1768 | + ], | |
| 1769 | + 'selectors' => [ | |
| 1770 | + '{{WRAPPER}}.king-addons-ticker-arrow-style-vertical .king-addons-ticker-prev-arrow' => 'margin-bottom: {{SIZE}}{{UNIT}};', | |
| 1771 | + '{{WRAPPER}}.king-addons-ticker-arrow-style-horizontal .king-addons-ticker-prev-arrow' => 'margin-right: {{SIZE}}{{UNIT}};', | |
| 1772 | + ], | |
| 1773 | + ] | |
| 1774 | + ); | |
| 1775 | + | |
| 1776 | + $this->add_control( | |
| 1777 | + 'nav_border_type', | |
| 1778 | + [ | |
| 1779 | + 'label' => esc_html__('Border Type', 'king-addons'), | |
| 1780 | + 'type' => Controls_Manager::SELECT, | |
| 1781 | + 'options' => [ | |
| 1782 | + 'none' => esc_html__('None', 'king-addons'), | |
| 1783 | + 'solid' => esc_html__('Solid', 'king-addons'), | |
| 1784 | + 'double' => esc_html__('Double', 'king-addons'), | |
| 1785 | + 'dotted' => esc_html__('Dotted', 'king-addons'), | |
| 1786 | + 'dashed' => esc_html__('Dashed', 'king-addons'), | |
| 1787 | + 'groove' => esc_html__('Groove', 'king-addons'), | |
| 1788 | + ], | |
| 1789 | + 'default' => 'none', | |
| 1790 | + 'selectors' => [ | |
| 1791 | + '{{WRAPPER}} .king-addons-ticker-arrow' => 'border-style: {{VALUE}};', | |
| 1792 | + ], | |
| 1793 | + 'separator' => 'before', | |
| 1794 | + ] | |
| 1795 | + ); | |
| 1796 | + | |
| 1797 | + $this->add_responsive_control( | |
| 1798 | + 'nav_border_width', | |
| 1799 | + [ | |
| 1800 | + 'label' => esc_html__('Border Width', 'king-addons'), | |
| 1801 | + 'type' => Controls_Manager::DIMENSIONS, | |
| 1802 | + 'size_units' => ['px',], | |
| 1803 | + 'default' => [ | |
| 1804 | + 'top' => 1, | |
| 1805 | + 'right' => 1, | |
| 1806 | + 'bottom' => 1, | |
| 1807 | + 'left' => 1, | |
| 1808 | + ], | |
| 1809 | + 'selectors' => [ | |
| 1810 | + '{{WRAPPER}} .king-addons-ticker-arrow' => 'border-width: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 1811 | + ], | |
| 1812 | + 'condition' => [ | |
| 1813 | + 'nav_border_type!' => 'none', | |
| 1814 | + ], | |
| 1815 | + ] | |
| 1816 | + ); | |
| 1817 | + | |
| 1818 | + $this->add_control( | |
| 1819 | + 'nav_border_radius', | |
| 1820 | + [ | |
| 1821 | + 'label' => esc_html__('Border Radius', 'king-addons'), | |
| 1822 | + 'type' => Controls_Manager::DIMENSIONS, | |
| 1823 | + 'size_units' => ['px', '%'], | |
| 1824 | + 'default' => [ | |
| 1825 | + 'top' => 1, | |
| 1826 | + 'right' => 1, | |
| 1827 | + 'bottom' => 1, | |
| 1828 | + 'left' => 1, | |
| 1829 | + ], | |
| 1830 | + 'selectors' => [ | |
| 1831 | + '{{WRAPPER}} .king-addons-ticker-arrow' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', | |
| 1832 | + ], | |
| 1833 | + 'separator' => 'before', | |
| 1834 | + ] | |
| 1835 | + ); | |
| 1836 | + | |
| 1837 | + | |
| 1838 | + | |
| 1839 | + | |
| 1840 | +$this->end_controls_section(); | |
| 1841 | + | |
| 1842 | + | |
| 1843 | + } | |
| 1844 | + | |
| 1845 | + | |
| 1846 | + public function get_related_taxonomies() | |
| 1847 | + { | |
| 1848 | + // Grab all custom post types once | |
| 1849 | + $this->post_types = Core::getCustomTypes('post', false); | |
| 1850 | + | |
| 1851 | + // Build relations array where each slug maps directly to its taxonomies | |
| 1852 | + $relations = []; | |
| 1853 | + foreach ($this->post_types as $slug => $title) { | |
| 1854 | + $relations[$slug] = get_object_taxonomies($slug); | |
| 1855 | + } | |
| 1856 | + | |
| 1857 | + return json_encode($relations); | |
| 1858 | + } | |
| 1859 | + | |
| 1860 | + public function get_main_query_args() | |
| 1861 | + { | |
| 1862 | + $settings = Core::displaySettings($this); | |
| 1863 | + $author = !empty($settings['query_author']) | |
| 1864 | + ? implode(',', (array)$settings['query_author']) | |
| 1865 | + : ''; | |
| 1866 | + | |
| 1867 | + // If query_source is one of the pro-* values, default it to 'post' | |
| 1868 | + if (in_array($settings['query_source'], ['pro-pd', 'pro-ft', 'pro-sl'], true)) { | |
| 1869 | + $settings['query_source'] = 'post'; | |
| 1870 | + } | |
| 1871 | + | |
| 1872 | + // Default query args | |
| 1873 | + $args = [ | |
| 1874 | + 'post_type' => $settings['query_source'], | |
| 1875 | + 'tax_query' => $this->get_tax_query_args(), | |
| 1876 | + 'post__not_in' => $settings['query_exclude_' . $settings['query_source']] ?? '', | |
| 1877 | + 'posts_per_page' => $settings['query_posts_per_page'], | |
| 1878 | + 'orderby' => $settings['post_orderby'], | |
| 1879 | + 'order' => $settings['post_order'], | |
| 1880 | + 'author' => $author, | |
| 1881 | + 'offset' => $settings['query_offset'], | |
| 1882 | + ]; | |
| 1883 | + | |
| 1884 | + // Manual selection override | |
| 1885 | + if ($settings['query_selection'] === 'manual') { | |
| 1886 | + $post_ids = $settings['query_manual_' . $settings['query_source']] ?? ['']; | |
| 1887 | + $args = [ | |
| 1888 | + 'post_type' => $settings['query_source'], | |
| 1889 | + 'post__in' => $post_ids, | |
| 1890 | + 'orderby' => $settings['post_orderby'], | |
| 1891 | + 'order' => $settings['post_order'], | |
| 1892 | + ]; | |
| 1893 | + } | |
| 1894 | + | |
| 1895 | + // Current post query override | |
| 1896 | + if ($settings['query_source'] === 'current') { | |
| 1897 | + global $wp_query; | |
| 1898 | + $args = $wp_query->query_vars; | |
| 1899 | + $args['posts_per_page'] = $settings['query_posts_per_page']; | |
| 1900 | + $args['orderby'] = $settings['post_orderby']; | |
| 1901 | + } | |
| 1902 | + | |
| 1903 | + // Related posts query override | |
| 1904 | + if ($settings['query_source'] === 'related') { | |
| 1905 | + $args = [ | |
| 1906 | + 'post_type' => get_post_type(get_the_ID()), | |
| 1907 | + 'tax_query' => $this->get_tax_query_args(), | |
| 1908 | + 'post__not_in' => [get_the_ID()], | |
| 1909 | + 'ignore_sticky_posts' => 1, | |
| 1910 | + 'posts_per_page' => $settings['query_posts_per_page'], | |
| 1911 | + 'orderby' => $settings['post_orderby'], | |
| 1912 | + 'order' => $settings['post_order'], | |
| 1913 | + 'offset' => $settings['query_offset'], | |
| 1914 | + ]; | |
| 1915 | + } | |
| 1916 | + | |
| 1917 | + // Featured products override | |
| 1918 | + if ($settings['query_source'] === 'featured') { | |
| 1919 | + $args['post_type'] = 'product'; | |
| 1920 | + $args['tax_query'] = [[ | |
| 1921 | + 'taxonomy' => 'product_visibility', | |
| 1922 | + 'field' => 'name', | |
| 1923 | + 'terms' => 'featured', | |
| 1924 | + 'operator' => 'IN', | |
| 1925 | + ]]; | |
| 1926 | + } | |
| 1927 | + | |
| 1928 | + // Sale products override | |
| 1929 | + if ($settings['query_source'] === 'sale') { | |
| 1930 | + $args['post_type'] = 'product'; | |
| 1931 | + $args['meta_query'] = [[ | |
| 1932 | + 'relation' => 'OR', | |
| 1933 | + [ | |
| 1934 | + 'key' => '_sale_price', | |
| 1935 | + 'value' => 0, | |
| 1936 | + 'compare' => '>', | |
| 1937 | + 'type' => 'numeric', | |
| 1938 | + ], | |
| 1939 | + [ | |
| 1940 | + 'key' => '_min_variation_sale_price', | |
| 1941 | + 'value' => 0, | |
| 1942 | + 'compare' => '>', | |
| 1943 | + 'type' => 'numeric', | |
| 1944 | + ], | |
| 1945 | + ]]; | |
| 1946 | + } | |
| 1947 | + | |
| 1948 | + return $args; | |
| 1949 | + } | |
| 1950 | + | |
| 1951 | + public function get_tax_query_args() | |
| 1952 | + { | |
| 1953 | + $settings = Core::displaySettings($this); | |
| 1954 | + $tax_query = []; | |
| 1955 | + | |
| 1956 | + // Related query uses a special approach | |
| 1957 | + if ($settings['query_source'] === 'related') { | |
| 1958 | + return [[ | |
| 1959 | + 'taxonomy' => $settings['query_tax_selection'], | |
| 1960 | + 'field' => 'term_id', | |
| 1961 | + 'terms' => wp_get_object_terms( | |
| 1962 | + get_the_ID(), | |
| 1963 | + $settings['query_tax_selection'], | |
| 1964 | + ['fields' => 'ids'] | |
| 1965 | + ), | |
| 1966 | + ]]; | |
| 1967 | + } | |
| 1968 | + | |
| 1969 | + // Otherwise build from normal taxonomies | |
| 1970 | + foreach (get_object_taxonomies($settings['query_source']) as $tax) { | |
| 1971 | + $field_name = 'query_taxonomy_' . $tax; | |
| 1972 | + if (!empty($settings[$field_name])) { | |
| 1973 | + $tax_query[] = [ | |
| 1974 | + 'taxonomy' => $tax, | |
| 1975 | + 'field' => 'id', | |
| 1976 | + 'terms' => $settings[$field_name], | |
| 1977 | + ]; | |
| 1978 | + } | |
| 1979 | + } | |
| 1980 | + | |
| 1981 | + return $tax_query; | |
| 1982 | + } | |
| 1983 | + | |
| 1984 | + public function king_addons_content_ticker_dynamic() | |
| 1985 | + { | |
| 1986 | + $settings = Core::displaySettings($this); | |
| 1987 | + $posts = new WP_Query($this->get_main_query_args()); | |
| 1988 | + | |
| 1989 | + if ($posts->have_posts()) : | |
| 1990 | + while ($posts->have_posts()) : | |
| 1991 | + $posts->the_post(); | |
| 1992 | + | |
| 1993 | + $image_id = get_post_thumbnail_id(); | |
| 1994 | + $image_src = Group_Control_Image_Size::get_attachment_image_src($image_id, 'image_size', $settings); | |
| 1995 | + $image_alt = wp_get_attachment_caption($image_id) ?: get_the_title(); | |
| 1996 | + ?> | |
| 1997 | + <div class="king-addons-ticker-item"> | |
| 1998 | + <?php if ($settings['link_type'] === 'box') : ?> | |
| 1999 | + <a class="king-addons-ticker-link" href="<?php echo esc_url(get_the_permalink()); ?>"></a> | |
| 2000 | + <?php endif; ?> | |
| 2001 | + | |
| 2002 | + <?php if (has_post_thumbnail()) : ?> | |
| 2003 | + <div class="king-addons-ticker-image"> | |
| 2004 | + <?php | |
| 2005 | + if (in_array($settings['link_type'], ['image', 'image-title'], true)) { | |
| 2006 | + echo '<a href="' . esc_url(get_the_permalink()) . '">'; | |
| 2007 | + } | |
| 2008 | + | |
| 2009 | + if ($settings['image_switcher'] === 'yes' && $image_src) { | |
| 2010 | + echo '<img src="' . esc_url($image_src) . '" alt="' . esc_attr($image_alt) . '">'; | |
| 2011 | + } | |
| 2012 | + | |
| 2013 | + if (in_array($settings['link_type'], ['image', 'image-title'], true)) { | |
| 2014 | + echo '</a>'; | |
| 2015 | + } | |
| 2016 | + ?> | |
| 2017 | + </div> | |
| 2018 | + <?php endif; ?> | |
| 2019 | + | |
| 2020 | + <h3 class="king-addons-ticker-title"> | |
| 2021 | + <div class="king-addons-ticker-title-inner"> | |
| 2022 | + <?php | |
| 2023 | + if (in_array($settings['link_type'], ['title', 'image-title'], true)) { | |
| 2024 | + echo '<a href="' . esc_url(get_the_permalink()) . '">'; | |
| 2025 | + } | |
| 2026 | + | |
| 2027 | + the_title(); | |
| 2028 | + | |
| 2029 | + if (in_array($settings['link_type'], ['title', 'image-title'], true)) { | |
| 2030 | + echo '</a>'; | |
| 2031 | + } | |
| 2032 | + ?> | |
| 2033 | + </div> | |
| 2034 | + </h3> | |
| 2035 | + </div> | |
| 2036 | + <?php | |
| 2037 | + endwhile; | |
| 2038 | + wp_reset_postdata(); | |
| 2039 | + endif; | |
| 2040 | + } | |
| 2041 | + | |
| 2042 | + public function king_addons_content_ticker_custom() | |
| 2043 | + { | |
| 2044 | + } | |
| 2045 | + | |
| 2046 | + public function king_addons_content_ticker_heading() | |
| 2047 | + { | |
| 2048 | + $settings = Core::displaySettings($this); | |
| 2049 | + $heading_element = 'div'; | |
| 2050 | + $heading_link = $settings['heading_link']['url'] ?? ''; | |
| 2051 | + $this->add_render_attribute('heading_attribute', 'class', 'king-addons-ticker-heading'); | |
| 2052 | + | |
| 2053 | + // Turn heading into a link if the URL is set | |
| 2054 | + if ($heading_link !== '') { | |
| 2055 | + $heading_element = 'a'; | |
| 2056 | + $this->add_render_attribute('heading_attribute', 'href', esc_url($heading_link)); | |
| 2057 | + | |
| 2058 | + if (!empty($settings['heading_link']['is_external'])) { | |
| 2059 | + $this->add_render_attribute('heading_attribute', 'target', '_blank'); | |
| 2060 | + } | |
| 2061 | + if (!empty($settings['heading_link']['nofollow'])) { | |
| 2062 | + $this->add_render_attribute('heading_attribute', 'rel', 'nofollow'); | |
| 2063 | + } | |
| 2064 | + } | |
| 2065 | + | |
| 2066 | + // Fallback if the user cannot use certain premium features | |
| 2067 | + if (!king_addons_freemius()->can_use_premium_code__premium_only()) { | |
| 2068 | + $settings['heading_icon_type'] = ($settings['heading_icon_type'] === 'pro-cc') ? 'none' : $settings['heading_icon_type']; | |
| 2069 | + } | |
| 2070 | + ?> | |
| 2071 | + <<?php echo esc_html($heading_element) . ' ' . $this->get_render_attribute_string('heading_attribute'); ?>> | |
| 2072 | + <span class="king-addons-ticker-heading-text"> | |
| 2073 | + <?php echo esc_html($settings['heading_text']); ?> | |
| 2074 | + </span> | |
| 2075 | + <span class="king-addons-ticker-heading-icon"> | |
| 2076 | + <?php if ($settings['heading_icon_type'] === 'fontawesome') : ?> | |
| 2077 | + <?php Icons_Manager::render_icon($settings['heading_icon']); ?> | |
| 2078 | + <?php elseif ($settings['heading_icon_type'] === 'circle') : ?> | |
| 2079 | + <span class="king-addons-ticker-icon-circle"></span> | |
| 2080 | + <?php endif; ?> | |
| 2081 | + </span> | |
| 2082 | + </<?php echo esc_html($heading_element); ?>> | |
| 2083 | + <?php | |
| 2084 | + } | |
| 2085 | + | |
| 2086 | + public function king_addons_content_ticker_slider() | |
| 2087 | + { | |
| 2088 | + $settings = Core::displaySettings($this); | |
| 2089 | + $slider_is_rtl = is_rtl(); | |
| 2090 | + $slider_direction = $slider_is_rtl ? 'rtl' : 'ltr'; | |
| 2091 | + | |
| 2092 | + // Fallback for premium code | |
| 2093 | + if (!king_addons_freemius()->can_use_premium_code__premium_only()) { | |
| 2094 | + $settings['slider_effect'] = 'hr-slide'; | |
| 2095 | + } | |
| 2096 | + | |
| 2097 | + // Slider options | |
| 2098 | + $slider_options = [ | |
| 2099 | + 'arrows' => false, | |
| 2100 | + 'autoplay' => ($settings['slider_autoplay'] === 'yes'), | |
| 2101 | + 'autoplaySpeed' => absint(Core::jsNumber($settings, 'slider_autoplay_duration', 3) * 1000), | |
| 2102 | + 'infinite' => ($settings['slider_loop'] === 'yes'), | |
| 2103 | + 'pauseOnHover' => ($settings['slider_pause_on_hover'] === 'yes'), | |
| 2104 | + // Prevent Slick from pausing when slide links get focus. | |
| 2105 | + 'pauseOnFocus' => false, | |
| 2106 | + 'pauseOnDotsHover' => false, | |
| 2107 | + 'rtl' => $slider_is_rtl, | |
| 2108 | + 'speed' => absint(Core::jsNumber($settings, 'slider_effect_duration', 1) * 1000), | |
| 2109 | + ]; | |
| 2110 | + | |
| 2111 | + if ($settings['slider_effect'] === 'vr-slide') { | |
| 2112 | + $slider_options['vertical'] = true; | |
| 2113 | + } | |
| 2114 | + | |
| 2115 | + if ($settings['slider_nav'] === 'yes') { | |
| 2116 | + $slider_options['arrows'] = true; | |
| 2117 | + $icon = esc_attr($settings['slider_nav_icon']); | |
| 2118 | + $slider_options['prevArrow'] = "<div class=\"king-addons-ticker-prev-arrow king-addons-ticker-arrow\"><i class=\"$icon\"></i></div>"; | |
| 2119 | + $slider_options['nextArrow'] = "<div class=\"king-addons-ticker-next-arrow king-addons-ticker-arrow\"><i class=\"$icon\"></i></div>"; | |
| 2120 | + } | |
| 2121 | + | |
| 2122 | + $this->add_render_attribute('ticker-slider-attribute', [ | |
| 2123 | + 'class' => 'king-addons-ticker-slider', | |
| 2124 | + 'dir' => $slider_direction, | |
| 2125 | + 'data-slick-options' => wp_json_encode($slider_options), | |
| 2126 | + ]); | |
| 2127 | + | |
| 2128 | + if ($settings['content_gradient_position'] !== 'none') { | |
| 2129 | + $this->add_render_attribute('ticker-slider-attribute', 'class', 'king-addons-ticker-gradient'); | |
| 2130 | + } | |
| 2131 | + | |
| 2132 | + // Fallback for premium code | |
| 2133 | + if (!king_addons_freemius()->can_use_premium_code__premium_only()) { | |
| 2134 | + $settings['post_type'] = 'dynamic'; | |
| 2135 | + } | |
| 2136 | + ?> | |
| 2137 | + <div <?php echo $this->get_render_attribute_string('ticker-slider-attribute'); ?> | |
| 2138 | + data-slide-effect="<?php echo esc_attr($settings['slider_effect']); ?>"> | |
| 2139 | + <?php | |
| 2140 | + // Render either dynamic or custom content | |
| 2141 | + if ($settings['post_type'] === 'dynamic') { | |
| 2142 | + $this->king_addons_content_ticker_dynamic(); | |
| 2143 | + } else { | |
| 2144 | + $this->king_addons_content_ticker_custom(); | |
| 2145 | + } | |
| 2146 | + ?> | |
| 2147 | + </div> | |
| 2148 | + | |
| 2149 | + <div class="king-addons-ticker-slider-controls"></div> | |
| 2150 | + <?php | |
| 2151 | + } | |
| 2152 | + | |
| 2153 | + public function king_addons_content_ticker_marquee() | |
| 2154 | + { | |
| 2155 | + } | |
| 2156 | + | |
| 2157 | + protected function render() | |
| 2158 | + { | |
| 2159 | + $settings = Core::displaySettings($this); | |
| 2160 | + ?> | |
| 2161 | + <div class="king-addons-content-ticker"> | |
| 2162 | + <?php | |
| 2163 | + // Heading section (icon/text) if needed | |
| 2164 | + if ($settings['heading_text'] !== '' || $settings['heading_icon_type'] !== 'none') { | |
| 2165 | + $this->king_addons_content_ticker_heading(); | |
| 2166 | + } | |
| 2167 | + ?> | |
| 2168 | + <div class="king-addons-content-ticker-inner"> | |
| 2169 | + <?php | |
| 2170 | + // Fallback for premium code | |
| 2171 | + if (!king_addons_freemius()->can_use_premium_code__premium_only()) { | |
| 2172 | + $settings['type_select'] = 'slider'; | |
| 2173 | + } | |
| 2174 | + | |
| 2175 | + // Choose between slider or marquee | |
| 2176 | + if ($settings['type_select'] === 'slider') { | |
| 2177 | + $this->king_addons_content_ticker_slider(); | |
| 2178 | + } else { | |
| 2179 | + $this->king_addons_content_ticker_marquee(); | |
| 2180 | + } | |
| 2181 | + ?> | |
| 2182 | + </div> | |
| 2183 | + </div> | |
| 2184 | + <?php | |
| 2185 | + } | |
| 2186 | +} | |