post-list.php
1463 lines
| 1 | <?php |
| 2 | namespace Elementor; |
| 3 | |
| 4 | use \Elementor\ElementsKit_Widget_Post_List_Handler as Handler; |
| 5 | use \ElementsKit_Lite\Modules\Controls\Controls_Manager as ElementsKit_Controls_Manager; |
| 6 | |
| 7 | if (! defined( 'ABSPATH' ) ) exit; |
| 8 | |
| 9 | class ElementsKit_Widget_Post_List extends Widget_Base { |
| 10 | use \ElementsKit_Lite\Widgets\Widget_Notice; |
| 11 | |
| 12 | public $base; |
| 13 | |
| 14 | public function get_name() { |
| 15 | return Handler::get_name(); |
| 16 | } |
| 17 | |
| 18 | public function get_title() { |
| 19 | return Handler::get_title(); |
| 20 | } |
| 21 | |
| 22 | public function get_icon() { |
| 23 | return Handler::get_icon(); |
| 24 | } |
| 25 | |
| 26 | public function get_keywords() { |
| 27 | return Handler::get_keywords(); |
| 28 | } |
| 29 | |
| 30 | public function get_categories() { |
| 31 | return Handler::get_categories(); |
| 32 | } |
| 33 | |
| 34 | public function get_style_depends() { |
| 35 | return ['widget-icon-list']; |
| 36 | } |
| 37 | |
| 38 | public function get_help_url() { |
| 39 | return 'https://wpmet.com/doc/post-list/'; |
| 40 | } |
| 41 | protected function is_dynamic_content(): bool { |
| 42 | return false; |
| 43 | } |
| 44 | |
| 45 | protected function register_controls() { |
| 46 | |
| 47 | $this->start_controls_section( |
| 48 | 'section_icon', |
| 49 | [ |
| 50 | 'label' => esc_html__( 'List', 'elementskit-lite' ), |
| 51 | ] |
| 52 | ); |
| 53 | |
| 54 | $this->add_control( |
| 55 | 'section_layout_options', |
| 56 | [ |
| 57 | 'label' => esc_html__( 'Show post by:', 'elementskit-lite' ), |
| 58 | 'type' => Controls_Manager::SELECT, |
| 59 | 'default' => 'selected', |
| 60 | 'options' => [ |
| 61 | 'recent' => esc_html__( 'Recent Post', 'elementskit-lite' ), |
| 62 | 'popular' => esc_html__( 'Popular Post', 'elementskit-lite' ), |
| 63 | 'selected' => esc_html__( 'Selected Post', 'elementskit-lite' ), |
| 64 | 'category' => esc_html__( 'Category Post', 'elementskit-lite' ), |
| 65 | ], |
| 66 | |
| 67 | ] |
| 68 | ); |
| 69 | |
| 70 | $this->add_control( |
| 71 | 'section_recent_post_limit', |
| 72 | [ |
| 73 | 'label' => esc_html__( 'Post Limit', 'elementskit-lite' ), |
| 74 | 'type' => Controls_Manager::NUMBER, |
| 75 | 'default' => 5, |
| 76 | 'condition' => [ |
| 77 | 'section_layout_options' => ['recent', 'popular', 'category'] |
| 78 | ] |
| 79 | ] |
| 80 | ); |
| 81 | |
| 82 | $this->add_control( |
| 83 | 'ekit_blog_posts_category', |
| 84 | [ |
| 85 | 'label' => esc_html__('Select Categories', 'elementskit-lite'), |
| 86 | 'type' => ElementsKit_Controls_Manager::AJAXSELECT2, |
| 87 | 'options' =>'ajaxselect2/category', |
| 88 | 'label_block' => true, |
| 89 | 'multiple' => true, |
| 90 | 'condition' => [ |
| 91 | 'section_layout_options' => 'category' |
| 92 | ] |
| 93 | ] |
| 94 | ); |
| 95 | |
| 96 | |
| 97 | $repeater = new Repeater(); |
| 98 | |
| 99 | $repeater->add_control( |
| 100 | 'text', |
| 101 | [ |
| 102 | 'label' => esc_html__( 'Text', 'elementskit-lite' ), |
| 103 | 'type' => Controls_Manager::TEXT, |
| 104 | 'dynamic' => [ |
| 105 | 'active' => true, |
| 106 | ], |
| 107 | 'label_block' => true, |
| 108 | 'placeholder' => esc_html__( 'List Title', 'elementskit-lite' ), |
| 109 | ] |
| 110 | ); |
| 111 | |
| 112 | $repeater->add_control( |
| 113 | 'link', |
| 114 | [ |
| 115 | 'label' =>esc_html__('Select Post', 'elementskit-lite'), |
| 116 | 'type' => ElementsKit_Controls_Manager::AJAXSELECT2, |
| 117 | 'options' =>'ajaxselect2/post_list', |
| 118 | 'label_block' => true, |
| 119 | 'multiple' => false, |
| 120 | ] |
| 121 | ); |
| 122 | |
| 123 | $this->add_control( |
| 124 | 'icon_list', |
| 125 | [ |
| 126 | 'label' => '', |
| 127 | 'type' => Controls_Manager::REPEATER, |
| 128 | 'fields' => $repeater->get_controls(), |
| 129 | 'title_field' => '{{ text }}', |
| 130 | 'condition' => [ |
| 131 | 'section_layout_options' => 'selected' |
| 132 | ] |
| 133 | ] |
| 134 | ); |
| 135 | |
| 136 | $this->end_controls_section(); |
| 137 | |
| 138 | $this->start_controls_section( |
| 139 | 'ekit_post_list_settings_tab', |
| 140 | [ |
| 141 | 'label' => esc_html__( 'Settings', 'elementskit-lite' ), |
| 142 | 'tab' => Controls_Manager::TAB_CONTENT, |
| 143 | ] |
| 144 | ); |
| 145 | |
| 146 | $this->add_control( |
| 147 | 'view', |
| 148 | [ |
| 149 | 'label' => esc_html__( 'Layout', 'elementskit-lite' ), |
| 150 | 'type' => Controls_Manager::CHOOSE, |
| 151 | 'default' => 'traditional', |
| 152 | 'options' => [ |
| 153 | 'traditional' => [ |
| 154 | 'title' => esc_html__( 'Vertical', 'elementskit-lite' ), |
| 155 | 'icon' => 'eicon-editor-list-ul', |
| 156 | ], |
| 157 | 'inline' => [ |
| 158 | 'title' => esc_html__( 'Horizontal', 'elementskit-lite' ), |
| 159 | 'icon' => 'eicon-ellipsis-h', |
| 160 | ], |
| 161 | ], |
| 162 | 'render_type' => 'template', |
| 163 | 'classes' => 'elementor-control-start-end', |
| 164 | 'label_block' => false, |
| 165 | 'style_transfer' => true, |
| 166 | ] |
| 167 | ); |
| 168 | |
| 169 | $this->add_responsive_control( |
| 170 | 'post_grid', |
| 171 | [ |
| 172 | 'label' => esc_html__( 'Columns Grid', 'elementskit-lite' ), |
| 173 | 'type' => Controls_Manager::SELECT, |
| 174 | 'options' => [ |
| 175 | '12' => esc_html__( '1 Columns', 'elementskit-lite' ), |
| 176 | '6' => esc_html__( '2 Columns', 'elementskit-lite' ), |
| 177 | '4' => esc_html__( '3 Columns', 'elementskit-lite' ), |
| 178 | '3' => esc_html__( '4 Columns', 'elementskit-lite' ), |
| 179 | '2' => esc_html__( '6 Columns', 'elementskit-lite' ), |
| 180 | ], |
| 181 | 'condition' => ['view' => 'inline'], |
| 182 | ] |
| 183 | ); |
| 184 | |
| 185 | $this->add_responsive_control( |
| 186 | 'grid_gap', |
| 187 | [ |
| 188 | 'label' => esc_html__( 'Grid Gap', 'elementskit-lite' ), |
| 189 | 'type' => Controls_Manager::DIMENSIONS, |
| 190 | 'size_units' => [ 'px', '%', 'em' ], |
| 191 | 'selectors' => [ |
| 192 | '{{WRAPPER}} .elementor-icon-list-item' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 193 | ], |
| 194 | 'condition' => ['view' => 'inline', 'post_grid!' => ''], |
| 195 | ] |
| 196 | ); |
| 197 | |
| 198 | $this->add_control( |
| 199 | 'show_feature_image', |
| 200 | [ |
| 201 | 'label' => esc_html__( 'Show Featured Image', 'elementskit-lite' ), |
| 202 | 'type' => Controls_Manager::SWITCHER, |
| 203 | 'label_on' => esc_html__( 'Show', 'elementskit-lite' ), |
| 204 | 'label_off' => esc_html__( 'Hide', 'elementskit-lite' ), |
| 205 | 'return_value' => 'yes', |
| 206 | 'default' => 'no', |
| 207 | ] |
| 208 | ); |
| 209 | |
| 210 | $this->add_control( |
| 211 | 'show_bg_feature_image', |
| 212 | [ |
| 213 | 'label' => esc_html__( 'Background Featured Image', 'elementskit-lite' ), |
| 214 | 'type' => Controls_Manager::SWITCHER, |
| 215 | 'label_on' => esc_html__( 'Show', 'elementskit-lite' ), |
| 216 | 'label_off' => esc_html__( 'Hide', 'elementskit-lite' ), |
| 217 | 'return_value' => 'yes', |
| 218 | 'default' => 'no', |
| 219 | ] |
| 220 | ); |
| 221 | |
| 222 | |
| 223 | /** |
| 224 | * Control: Featured Image Size |
| 225 | */ |
| 226 | $this->add_group_control( |
| 227 | Group_Control_Image_Size::get_type(), |
| 228 | [ |
| 229 | 'name' => 'show_feature_img_size', |
| 230 | 'fields_options' => [ |
| 231 | 'size' => [ |
| 232 | 'label' => esc_html__( 'Featured Image Size', 'elementskit-lite' ), |
| 233 | ], |
| 234 | ], |
| 235 | 'default' => 'large', |
| 236 | 'conditions' => [ |
| 237 | 'relation' => 'or', |
| 238 | 'terms' => [ |
| 239 | [ |
| 240 | 'name' => 'show_feature_image', |
| 241 | 'operator' => '==', |
| 242 | 'value' => 'yes', |
| 243 | ], |
| 244 | [ |
| 245 | 'name' => 'show_bg_feature_image', |
| 246 | 'operator' => '==', |
| 247 | 'value' => 'yes', |
| 248 | ], |
| 249 | ], |
| 250 | ], |
| 251 | ] |
| 252 | ); |
| 253 | |
| 254 | |
| 255 | /** |
| 256 | * Control: Divider After Featured Image Size |
| 257 | */ |
| 258 | $this->add_control( |
| 259 | 'ekit_post_list_divider_after_featured', |
| 260 | [ |
| 261 | 'type' => Controls_Manager::DIVIDER, |
| 262 | ] |
| 263 | ); |
| 264 | |
| 265 | |
| 266 | $this->add_control( |
| 267 | 'show_post_icon', |
| 268 | [ |
| 269 | 'label' => esc_html__( 'Show Icon', 'elementskit-lite' ), |
| 270 | 'type' => Controls_Manager::SWITCHER, |
| 271 | 'label_on' => esc_html__( 'Show', 'elementskit-lite' ), |
| 272 | 'label_off' => esc_html__( 'Hide', 'elementskit-lite' ), |
| 273 | 'return_value' => 'yes', |
| 274 | 'default' => 'yes', |
| 275 | 'condition' => [ |
| 276 | 'show_feature_image!' => 'yes' |
| 277 | ] |
| 278 | ] |
| 279 | ); |
| 280 | |
| 281 | $this->add_control( |
| 282 | 'icons', |
| 283 | [ |
| 284 | 'label' => esc_html__( 'Icon', 'elementskit-lite' ), |
| 285 | 'type' => Controls_Manager::ICONS, |
| 286 | 'label_block' => true, |
| 287 | 'fa4compatibility' => 'icon', |
| 288 | 'default' => [ |
| 289 | 'value' => 'fas fa-circle', |
| 290 | 'library' => 'regular' |
| 291 | ], |
| 292 | 'condition' => [ |
| 293 | 'show_post_icon' => 'yes', |
| 294 | 'show_feature_image!' => 'yes' |
| 295 | ] |
| 296 | ] |
| 297 | ); |
| 298 | |
| 299 | $this->add_control( |
| 300 | 'show_post_meta', |
| 301 | [ |
| 302 | 'label' => esc_html__( 'Show Meta', 'elementskit-lite' ), |
| 303 | 'type' => Controls_Manager::SWITCHER, |
| 304 | 'label_on' => esc_html__( 'Show', 'elementskit-lite' ), |
| 305 | 'label_off' => esc_html__( 'Hide', 'elementskit-lite' ), |
| 306 | 'return_value' => 'yes', |
| 307 | 'default' => 'no', |
| 308 | ] |
| 309 | ); |
| 310 | |
| 311 | $this->add_control( |
| 312 | 'show_date_meta', |
| 313 | [ |
| 314 | 'label' => esc_html__( 'Show Date Meta', 'elementskit-lite' ), |
| 315 | 'type' => Controls_Manager::SWITCHER, |
| 316 | 'label_on' => esc_html__( 'Show', 'elementskit-lite' ), |
| 317 | 'label_off' => esc_html__( 'Hide', 'elementskit-lite' ), |
| 318 | 'return_value' => 'yes', |
| 319 | 'default' => 'no', |
| 320 | 'condition' => [ |
| 321 | 'show_post_meta' => 'yes', |
| 322 | ] |
| 323 | ] |
| 324 | ); |
| 325 | |
| 326 | $this->add_control( |
| 327 | 'date_meta__icons', |
| 328 | [ |
| 329 | 'label' => __( 'Date Meta Icon', 'elementskit-lite' ), |
| 330 | 'type' => Controls_Manager::ICONS, |
| 331 | 'fa4compatibility' => 'date_meta__icon', |
| 332 | 'default' => [ |
| 333 | 'value' => 'icon icon-calendar-page-empty', |
| 334 | 'library' => 'ekiticons', |
| 335 | ], |
| 336 | 'condition' => [ |
| 337 | 'show_post_meta' => 'yes', |
| 338 | 'show_date_meta' => 'yes', |
| 339 | ] |
| 340 | ] |
| 341 | ); |
| 342 | |
| 343 | $this->add_control( |
| 344 | 'show_category_meta', |
| 345 | [ |
| 346 | 'label' => esc_html__( 'Show Category Meta', 'elementskit-lite' ), |
| 347 | 'type' => Controls_Manager::SWITCHER, |
| 348 | 'label_on' => esc_html__( 'Show', 'elementskit-lite' ), |
| 349 | 'label_off' => esc_html__( 'Hide', 'elementskit-lite' ), |
| 350 | 'return_value' => 'yes', |
| 351 | 'default' => 'no', |
| 352 | 'condition' => [ |
| 353 | 'show_post_meta' => 'yes', |
| 354 | ] |
| 355 | ] |
| 356 | ); |
| 357 | |
| 358 | $this->add_control( |
| 359 | 'category_meta__icons', |
| 360 | [ |
| 361 | 'label' => __( 'Category Meta Icon', 'elementskit-lite' ), |
| 362 | 'type' => Controls_Manager::ICONS, |
| 363 | 'fa4compatibility' => 'category_meta__icon', |
| 364 | 'default' => [ |
| 365 | 'value' => 'icon icon-folder', |
| 366 | 'library' => 'ekiticons', |
| 367 | ], |
| 368 | 'condition' => [ |
| 369 | 'show_post_meta' => 'yes', |
| 370 | 'show_category_meta' => 'yes', |
| 371 | ] |
| 372 | ] |
| 373 | ); |
| 374 | |
| 375 | $this->add_control( |
| 376 | 'post_meta_position', |
| 377 | [ |
| 378 | 'label' => esc_html__( 'Meta Position', 'elementskit-lite' ), |
| 379 | 'type' => Controls_Manager::SELECT, |
| 380 | 'default' => 'top_position', |
| 381 | 'options' => [ |
| 382 | 'top_position' => esc_html__( 'Top', 'elementskit-lite' ), |
| 383 | 'bottom_position' => esc_html__( 'Bottom', 'elementskit-lite' ), |
| 384 | ], |
| 385 | 'condition' => [ |
| 386 | 'show_post_meta' => 'yes', |
| 387 | ] |
| 388 | ] |
| 389 | ); |
| 390 | |
| 391 | |
| 392 | |
| 393 | $this->end_controls_section(); |
| 394 | |
| 395 | $this->start_controls_section( |
| 396 | 'section_icon_list', |
| 397 | [ |
| 398 | 'label' => esc_html__( 'List', 'elementskit-lite' ), |
| 399 | 'tab' => Controls_Manager::TAB_STYLE, |
| 400 | ] |
| 401 | ); |
| 402 | |
| 403 | $this->add_responsive_control( |
| 404 | 'space_between', |
| 405 | [ |
| 406 | 'label' => esc_html__( 'Space Between', 'elementskit-lite' ), |
| 407 | 'type' => Controls_Manager::SLIDER, |
| 408 | 'range' => [ |
| 409 | 'px' => [ |
| 410 | 'max' => 50, |
| 411 | ], |
| 412 | ], |
| 413 | 'default' => [ |
| 414 | 'unit' => 'px', |
| 415 | 'size' => 8, |
| 416 | ], |
| 417 | 'selectors' => [ |
| 418 | '{{WRAPPER}} .elementor-icon-list-items:not(.elementor-inline-items) .elementor-icon-list-item:not(:last-child)' => 'padding-bottom: calc({{SIZE}}{{UNIT}}/2)', |
| 419 | '{{WRAPPER}} .elementor-icon-list-items:not(.elementor-inline-items) .elementor-icon-list-item:not(:first-child)' => 'margin-top: calc({{SIZE}}{{UNIT}}/2)', |
| 420 | '{{WRAPPER}} .elementor-icon-list-items.elementor-inline-items .elementor-icon-list-item' => 'margin-right: calc({{SIZE}}{{UNIT}}/2); margin-left: calc({{SIZE}}{{UNIT}}/2)', |
| 421 | '{{WRAPPER}} .elementor-icon-list-items.elementor-inline-items' => 'margin-right: calc(-{{SIZE}}{{UNIT}}/2); margin-left: calc(-{{SIZE}}{{UNIT}}/2)', |
| 422 | 'body.rtl {{WRAPPER}} .elementor-icon-list-items.elementor-inline-items .elementor-icon-list-item:after' => 'left: calc(-{{SIZE}}{{UNIT}}/2)', |
| 423 | 'body:not(.rtl) {{WRAPPER}} .elementor-icon-list-items.elementor-inline-items .elementor-icon-list-item:after' => 'right: calc(-{{SIZE}}{{UNIT}}/2)', |
| 424 | ], |
| 425 | 'condition' => [ |
| 426 | 'post_grid' => '' |
| 427 | ] |
| 428 | ] |
| 429 | ); |
| 430 | |
| 431 | $this->add_responsive_control( |
| 432 | 'list_padding', |
| 433 | [ |
| 434 | 'label' => esc_html__( 'Padding', 'elementskit-lite' ), |
| 435 | 'type' => Controls_Manager::DIMENSIONS, |
| 436 | 'size_units' => [ 'px', '%', 'em' ], |
| 437 | 'selectors' => [ |
| 438 | '{{WRAPPER}} .elementor-icon-list-item a' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 439 | ], |
| 440 | ] |
| 441 | ); |
| 442 | |
| 443 | $this->start_controls_tabs( 'tabs_list_style' ); |
| 444 | |
| 445 | $this->start_controls_tab( |
| 446 | 'list_tab_normal', |
| 447 | [ |
| 448 | 'label' => esc_html__( 'Normal', 'elementskit-lite' ), |
| 449 | ] |
| 450 | ); |
| 451 | |
| 452 | $this->add_group_control( |
| 453 | Group_Control_Background::get_type(), |
| 454 | [ |
| 455 | 'name' => 'list_bg', |
| 456 | 'label' => esc_html__( 'Background', 'elementskit-lite' ), |
| 457 | 'types' => [ 'classic', 'gradient' ], |
| 458 | 'selector' => '{{WRAPPER}} .elementor-icon-list-item a', |
| 459 | ] |
| 460 | ); |
| 461 | |
| 462 | $this->add_group_control( |
| 463 | Group_Control_Border::get_type(), |
| 464 | [ |
| 465 | 'name' => 'list_border', |
| 466 | 'label' => esc_html__( 'Border', 'elementskit-lite' ), |
| 467 | 'selector' => '{{WRAPPER}} .elementor-icon-list-item a', |
| 468 | ] |
| 469 | ); |
| 470 | $this->add_responsive_control( |
| 471 | 'list_border_radius', |
| 472 | [ |
| 473 | 'label' =>esc_html__( 'Border Radius', 'elementskit-lite' ), |
| 474 | 'type' => Controls_Manager::DIMENSIONS, |
| 475 | 'size_units' => [ 'px'], |
| 476 | 'default' => [ |
| 477 | 'top' => '', |
| 478 | 'right' => '', |
| 479 | 'bottom' => '' , |
| 480 | 'left' => '', |
| 481 | ], |
| 482 | 'selectors' => [ |
| 483 | '{{WRAPPER}} .elementor-icon-list-item a' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 484 | ], |
| 485 | ] |
| 486 | ); |
| 487 | $this->add_group_control( |
| 488 | Group_Control_Box_Shadow::get_type(), |
| 489 | [ |
| 490 | 'name' => 'list_box_shadow', |
| 491 | 'selector' => '{{WRAPPER}} .elementor-icon-list-item a', |
| 492 | ] |
| 493 | ); |
| 494 | |
| 495 | $this->end_controls_tab(); |
| 496 | |
| 497 | $this->start_controls_tab( |
| 498 | 'list_tab_hover', |
| 499 | [ |
| 500 | 'label' => esc_html__( 'Hover', 'elementskit-lite' ), |
| 501 | ] |
| 502 | ); |
| 503 | |
| 504 | $this->add_group_control( |
| 505 | Group_Control_Background::get_type(), |
| 506 | [ |
| 507 | 'name' => 'list_bg_hover', |
| 508 | 'label' => esc_html__( 'Background', 'elementskit-lite' ), |
| 509 | 'types' => [ 'classic', 'gradient' ], |
| 510 | 'selector' => '{{WRAPPER}} .elementor-icon-list-item a:hover', |
| 511 | ] |
| 512 | ); |
| 513 | |
| 514 | $this->add_group_control( |
| 515 | Group_Control_Border::get_type(), |
| 516 | [ |
| 517 | 'name' => 'list_border_hover', |
| 518 | 'label' => esc_html__( 'Border', 'elementskit-lite' ), |
| 519 | 'selector' => '{{WRAPPER}} .elementor-icon-list-item a:hover', |
| 520 | ] |
| 521 | ); |
| 522 | $this->add_responsive_control( |
| 523 | 'list_border_radius_hover', |
| 524 | [ |
| 525 | 'label' =>esc_html__( 'Border Radius', 'elementskit-lite' ), |
| 526 | 'type' => Controls_Manager::DIMENSIONS, |
| 527 | 'size_units' => [ 'px'], |
| 528 | 'default' => [ |
| 529 | 'top' => '', |
| 530 | 'right' => '', |
| 531 | 'bottom' => '' , |
| 532 | 'left' => '', |
| 533 | ], |
| 534 | 'selectors' => [ |
| 535 | '{{WRAPPER}} .elementor-icon-list-item a:hover' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 536 | ], |
| 537 | ] |
| 538 | ); |
| 539 | $this->add_group_control( |
| 540 | Group_Control_Box_Shadow::get_type(), |
| 541 | [ |
| 542 | 'name' => 'list_box_shadow_hover', |
| 543 | 'selector' => '{{WRAPPER}} .elementor-icon-list-item a:hover', |
| 544 | ] |
| 545 | ); |
| 546 | |
| 547 | $this->end_controls_tab(); |
| 548 | |
| 549 | $this->end_controls_tabs(); |
| 550 | |
| 551 | $this->add_responsive_control( |
| 552 | 'icon_align', |
| 553 | [ |
| 554 | 'label' => esc_html__( 'Alignment', 'elementskit-lite' ), |
| 555 | 'type' => Controls_Manager::CHOOSE, |
| 556 | 'options' => [ |
| 557 | 'left' => [ |
| 558 | 'title' => esc_html__( 'Left', 'elementskit-lite' ), |
| 559 | 'icon' => 'eicon-text-align-left', |
| 560 | ], |
| 561 | 'center' => [ |
| 562 | 'title' => esc_html__( 'Center', 'elementskit-lite' ), |
| 563 | 'icon' => 'eicon-text-align-center', |
| 564 | ], |
| 565 | 'right' => [ |
| 566 | 'title' => esc_html__( 'Right', 'elementskit-lite' ), |
| 567 | 'icon' => 'eicon-text-align-right', |
| 568 | ], |
| 569 | ], |
| 570 | 'prefix_class' => 'elementor%s-align-', |
| 571 | ] |
| 572 | ); |
| 573 | |
| 574 | $this->add_control( |
| 575 | 'overlay_heading', |
| 576 | [ |
| 577 | 'label' => __( 'Image Overlay:', 'elementskit-lite' ), |
| 578 | 'type' => \Elementor\Controls_Manager::HEADING, |
| 579 | 'separator' => 'before', |
| 580 | 'condition' => [ |
| 581 | 'show_bg_feature_image' => 'yes' |
| 582 | ] |
| 583 | ] |
| 584 | ); |
| 585 | $this->start_controls_tabs( 'tabs_overlay' ); |
| 586 | |
| 587 | $this->start_controls_tab( |
| 588 | 'overlay_tab_normal', |
| 589 | [ |
| 590 | 'label' => esc_html__( 'Normal', 'elementskit-lite' ), |
| 591 | 'condition' => [ |
| 592 | 'show_bg_feature_image' => 'yes' |
| 593 | ] |
| 594 | ] |
| 595 | ); |
| 596 | $this->add_control( |
| 597 | 'list_overlay_color', |
| 598 | [ |
| 599 | 'label' => esc_html__( 'Color', 'elementskit-lite' ), |
| 600 | 'type' => Controls_Manager::COLOR, |
| 601 | 'selectors' => [ |
| 602 | '{{WRAPPER}} .ekit-enabled-bg-img .elementor-icon-list-item a:after' => 'background-color: {{VALUE}};', |
| 603 | ], |
| 604 | 'condition' => [ |
| 605 | 'show_bg_feature_image' => 'yes' |
| 606 | ] |
| 607 | ] |
| 608 | ); |
| 609 | $this->end_controls_tab(); |
| 610 | $this->start_controls_tab( |
| 611 | 'overlay_tab_hover', |
| 612 | [ |
| 613 | 'label' => esc_html__( 'Hover', 'elementskit-lite' ), |
| 614 | 'condition' => [ |
| 615 | 'show_bg_feature_image' => 'yes' |
| 616 | ] |
| 617 | ] |
| 618 | ); |
| 619 | $this->add_control( |
| 620 | 'list_overlay_hover_color', |
| 621 | [ |
| 622 | 'label' => esc_html__( 'Color', 'elementskit-lite' ), |
| 623 | 'type' => Controls_Manager::COLOR, |
| 624 | 'selectors' => [ |
| 625 | '{{WRAPPER}} .ekit-enabled-bg-img .elementor-icon-list-item a:hover:after' => 'background-color: {{VALUE}};', |
| 626 | ], |
| 627 | 'condition' => [ |
| 628 | 'show_bg_feature_image' => 'yes' |
| 629 | ] |
| 630 | ] |
| 631 | ); |
| 632 | $this->end_controls_tab(); |
| 633 | $this->end_controls_tabs(); |
| 634 | |
| 635 | |
| 636 | |
| 637 | $this->add_control( |
| 638 | 'divider', |
| 639 | [ |
| 640 | 'label' => esc_html__( 'Divider', 'elementskit-lite' ), |
| 641 | 'type' => Controls_Manager::SWITCHER, |
| 642 | 'label_off' => esc_html__( 'Off', 'elementskit-lite' ), |
| 643 | 'label_on' => esc_html__( 'On', 'elementskit-lite' ), |
| 644 | 'selectors' => [ |
| 645 | '{{WRAPPER}} .elementor-icon-list-item:not(:last-child):after' => 'content: "";', |
| 646 | ], |
| 647 | 'separator' => 'before' |
| 648 | ] |
| 649 | ); |
| 650 | |
| 651 | $this->add_control( |
| 652 | 'divider_style', |
| 653 | [ |
| 654 | 'label' => esc_html__( 'Style', 'elementskit-lite' ), |
| 655 | 'type' => Controls_Manager::SELECT, |
| 656 | 'options' => [ |
| 657 | 'solid' => esc_html__( 'Solid', 'elementskit-lite' ), |
| 658 | 'dotted' => esc_html__( 'Dotted', 'elementskit-lite' ), |
| 659 | 'dashed' => esc_html__( 'Dashed', 'elementskit-lite' ), |
| 660 | ], |
| 661 | 'default' => 'solid', |
| 662 | 'condition' => [ |
| 663 | 'divider' => 'yes', |
| 664 | ], |
| 665 | 'selectors' => [ |
| 666 | '{{WRAPPER}} .elementor-icon-list-items:not(.elementor-inline-items) .elementor-icon-list-item:not(:last-child):after' => 'border-top-style: {{VALUE}}', |
| 667 | '{{WRAPPER}} .elementor-icon-list-items.elementor-inline-items .elementor-icon-list-item:not(:last-child):after' => 'border-left-style: {{VALUE}}', |
| 668 | ], |
| 669 | ] |
| 670 | ); |
| 671 | |
| 672 | $this->add_control( |
| 673 | 'divider_weight', |
| 674 | [ |
| 675 | 'label' => esc_html__( 'Weight', 'elementskit-lite' ), |
| 676 | 'type' => Controls_Manager::SLIDER, |
| 677 | 'default' => [ |
| 678 | 'size' => 1, |
| 679 | ], |
| 680 | 'range' => [ |
| 681 | 'px' => [ |
| 682 | 'min' => 1, |
| 683 | 'max' => 20, |
| 684 | ], |
| 685 | ], |
| 686 | 'condition' => [ |
| 687 | 'divider' => 'yes', |
| 688 | ], |
| 689 | 'selectors' => [ |
| 690 | '{{WRAPPER}} .elementor-icon-list-items:not(.elementor-inline-items) .elementor-icon-list-item:not(:last-child):after' => 'border-top-width: {{SIZE}}{{UNIT}}', |
| 691 | '{{WRAPPER}} .elementor-inline-items .elementor-icon-list-item:not(:last-child):after' => 'border-left-width: {{SIZE}}{{UNIT}}', |
| 692 | ], |
| 693 | ] |
| 694 | ); |
| 695 | |
| 696 | $this->add_control( |
| 697 | 'divider_width', |
| 698 | [ |
| 699 | 'label' => esc_html__( 'Width', 'elementskit-lite' ), |
| 700 | 'type' => Controls_Manager::SLIDER, |
| 701 | 'default' => [ |
| 702 | 'unit' => '%', |
| 703 | ], |
| 704 | 'condition' => [ |
| 705 | 'divider' => 'yes', |
| 706 | 'view!' => 'inline', |
| 707 | ], |
| 708 | 'selectors' => [ |
| 709 | '{{WRAPPER}} .elementor-icon-list-item:not(:last-child):after' => 'width: {{SIZE}}{{UNIT}}', |
| 710 | ], |
| 711 | ] |
| 712 | ); |
| 713 | |
| 714 | $this->add_control( |
| 715 | 'divider_height', |
| 716 | [ |
| 717 | 'label' => esc_html__( 'Height', 'elementskit-lite' ), |
| 718 | 'type' => Controls_Manager::SLIDER, |
| 719 | 'size_units' => [ '%', 'px' ], |
| 720 | 'default' => [ |
| 721 | 'unit' => '%', |
| 722 | ], |
| 723 | 'range' => [ |
| 724 | 'px' => [ |
| 725 | 'min' => 1, |
| 726 | 'max' => 100, |
| 727 | ], |
| 728 | '%' => [ |
| 729 | 'min' => 1, |
| 730 | 'max' => 100, |
| 731 | ], |
| 732 | ], |
| 733 | 'condition' => [ |
| 734 | 'divider' => 'yes', |
| 735 | 'view' => 'inline', |
| 736 | ], |
| 737 | 'selectors' => [ |
| 738 | '{{WRAPPER}} .elementor-icon-list-item:not(:last-child):after' => 'height: {{SIZE}}{{UNIT}}', |
| 739 | ], |
| 740 | ] |
| 741 | ); |
| 742 | |
| 743 | $this->add_control( |
| 744 | 'divider_color', |
| 745 | [ |
| 746 | 'label' => esc_html__( 'Color', 'elementskit-lite' ), |
| 747 | 'type' => Controls_Manager::COLOR, |
| 748 | 'default' => '#ddd', |
| 749 | 'condition' => [ |
| 750 | 'divider' => 'yes', |
| 751 | ], |
| 752 | 'selectors' => [ |
| 753 | '{{WRAPPER}} .elementor-icon-list-item:not(:last-child):after' => 'border-color: {{VALUE}}', |
| 754 | ], |
| 755 | ] |
| 756 | ); |
| 757 | |
| 758 | $this->end_controls_section(); |
| 759 | |
| 760 | $this->start_controls_section( |
| 761 | 'section_icon_style', |
| 762 | [ |
| 763 | 'label' => esc_html__( 'Icon', 'elementskit-lite' ), |
| 764 | 'tab' => Controls_Manager::TAB_STYLE, |
| 765 | 'condition' => [ |
| 766 | 'show_feature_image!' => 'yes', |
| 767 | ] |
| 768 | ] |
| 769 | ); |
| 770 | |
| 771 | $this->add_responsive_control( |
| 772 | 'icon_vertical_alignment', |
| 773 | [ |
| 774 | 'label' =>esc_html__( 'Vertical Alignment', 'elementskit-lite' ), |
| 775 | 'type' => Controls_Manager::CHOOSE, |
| 776 | 'options' => [ |
| 777 | 'flex-start' => [ |
| 778 | 'title' =>esc_html__( 'Top', 'elementskit-lite' ), |
| 779 | 'icon' => 'fa fa-caret-up', |
| 780 | ], |
| 781 | 'center' => [ |
| 782 | 'title' =>esc_html__( 'Center', 'elementskit-lite' ), |
| 783 | 'icon' => 'fa fa-align-center', |
| 784 | ], |
| 785 | 'flex-end' => [ |
| 786 | 'title' =>esc_html__( 'Bottom', 'elementskit-lite' ), |
| 787 | 'icon' => 'fa fa-caret-down', |
| 788 | ], |
| 789 | ], |
| 790 | 'selectors' => [ |
| 791 | '{{WRAPPER}} .ekit-wid-con .elementor-icon-list-icon' => 'align-self: {{VALUE}};' |
| 792 | ] |
| 793 | ] |
| 794 | ); |
| 795 | |
| 796 | $this->add_group_control( |
| 797 | Group_Control_Background::get_type(), |
| 798 | [ |
| 799 | 'name' => 'icon_bg', |
| 800 | 'label' => esc_html__( 'Background', 'elementskit-lite' ), |
| 801 | 'types' => [ 'classic', 'gradient' ], |
| 802 | 'selector' => '{{WRAPPER}} .ekit-wid-con .elementor-icon-list-icon', |
| 803 | ] |
| 804 | ); |
| 805 | |
| 806 | $this->add_responsive_control( |
| 807 | 'icon_height', |
| 808 | [ |
| 809 | 'label' => esc_html__( 'Height', 'elementskit-lite' ), |
| 810 | 'type' => Controls_Manager::SLIDER, |
| 811 | 'range' => [ |
| 812 | 'px' => [ |
| 813 | 'min' => 10, |
| 814 | 'max' => 200, |
| 815 | ], |
| 816 | ], |
| 817 | 'selectors' => [ |
| 818 | '{{WRAPPER}} .ekit-wid-con .elementor-icon-list-icon' => 'height: {{SIZE}}{{UNIT}};', |
| 819 | ], |
| 820 | |
| 821 | ] |
| 822 | ); |
| 823 | |
| 824 | $this->add_responsive_control( |
| 825 | 'icon_width', |
| 826 | [ |
| 827 | 'label' => esc_html__( 'Width', 'elementskit-lite' ), |
| 828 | 'type' => Controls_Manager::SLIDER, |
| 829 | 'range' => [ |
| 830 | 'px' => [ |
| 831 | 'min' => 10, |
| 832 | 'max' => 200, |
| 833 | ], |
| 834 | ], |
| 835 | 'selectors' => [ |
| 836 | '{{WRAPPER}} .ekit-wid-con .elementor-icon-list-icon' => 'width: {{SIZE}}{{UNIT}};', |
| 837 | ], |
| 838 | |
| 839 | |
| 840 | ] |
| 841 | ); |
| 842 | |
| 843 | $this->add_responsive_control( |
| 844 | 'icon_line_height', |
| 845 | [ |
| 846 | 'label' => esc_html__( 'Line Height', 'elementskit-lite' ), |
| 847 | 'type' => Controls_Manager::SLIDER, |
| 848 | 'range' => [ |
| 849 | 'px' => [ |
| 850 | 'min' => 10, |
| 851 | 'max' => 200, |
| 852 | ], |
| 853 | ], |
| 854 | 'selectors' => [ |
| 855 | '{{WRAPPER}} .ekit-wid-con .elementor-icon-list-icon' => 'line-height: {{SIZE}}{{UNIT}};', |
| 856 | ], |
| 857 | |
| 858 | ] |
| 859 | ); |
| 860 | |
| 861 | $this->add_responsive_control( |
| 862 | 'icon_border_radius', |
| 863 | [ |
| 864 | 'label' =>esc_html__( 'Border Radius', 'elementskit-lite' ), |
| 865 | 'type' => Controls_Manager::DIMENSIONS, |
| 866 | 'size_units' => [ 'px'], |
| 867 | 'default' => [ |
| 868 | 'top' => '', |
| 869 | 'right' => '', |
| 870 | 'bottom' => '' , |
| 871 | 'left' => '', |
| 872 | ], |
| 873 | 'selectors' => [ |
| 874 | '{{WRAPPER}} .ekit-wid-con .elementor-icon-list-icon' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 875 | ], |
| 876 | ] |
| 877 | ); |
| 878 | |
| 879 | $this->add_control( |
| 880 | 'icon_color', |
| 881 | [ |
| 882 | 'label' => esc_html__( 'Color', 'elementskit-lite' ), |
| 883 | 'type' => Controls_Manager::COLOR, |
| 884 | 'default' => '', |
| 885 | 'selectors' => [ |
| 886 | '{{WRAPPER}} .elementor-icon-list-icon i' => 'color: {{VALUE}};', |
| 887 | '{{WRAPPER}} .elementor-icon-list-icon svg' => 'fill: {{VALUE}};', |
| 888 | ], |
| 889 | ] |
| 890 | ); |
| 891 | |
| 892 | $this->add_control( |
| 893 | 'icon_color_hover', |
| 894 | [ |
| 895 | 'label' => esc_html__( 'Hover', 'elementskit-lite' ), |
| 896 | 'type' => Controls_Manager::COLOR, |
| 897 | 'default' => '', |
| 898 | 'selectors' => [ |
| 899 | '{{WRAPPER}} .elementor-icon-list-item:hover .elementor-icon-list-icon i' => 'color: {{VALUE}};', |
| 900 | '{{WRAPPER}} .elementor-icon-list-item:hover .elementor-icon-list-icon svg' => 'fill: {{VALUE}};', |
| 901 | ], |
| 902 | ] |
| 903 | ); |
| 904 | |
| 905 | $this->add_responsive_control( |
| 906 | 'icon_size', |
| 907 | [ |
| 908 | 'label' => esc_html__( 'Size', 'elementskit-lite' ), |
| 909 | 'type' => Controls_Manager::SLIDER, |
| 910 | 'default' => [ |
| 911 | 'size' => 14, |
| 912 | ], |
| 913 | 'range' => [ |
| 914 | 'px' => [ |
| 915 | 'min' => 6, |
| 916 | ], |
| 917 | ], |
| 918 | 'selectors' => [ |
| 919 | '{{WRAPPER}} .elementor-icon-list-icon' => 'width: {{SIZE}}{{UNIT}};', |
| 920 | '{{WRAPPER}} .elementor-icon-list-icon i' => 'font-size: {{SIZE}}{{UNIT}};', |
| 921 | '{{WRAPPER}} .elementor-icon-list-icon svg' => 'max-width: {{SIZE}}{{UNIT}};', |
| 922 | ], |
| 923 | ] |
| 924 | ); |
| 925 | |
| 926 | $this->end_controls_section(); |
| 927 | |
| 928 | $this->start_controls_section( |
| 929 | 'section_text_style', |
| 930 | [ |
| 931 | 'label' => esc_html__( 'Text', 'elementskit-lite' ), |
| 932 | 'tab' => Controls_Manager::TAB_STYLE, |
| 933 | ] |
| 934 | ); |
| 935 | |
| 936 | $this->add_control( |
| 937 | 'text_color', |
| 938 | [ |
| 939 | 'label' => esc_html__( 'Text Color', 'elementskit-lite' ), |
| 940 | 'type' => Controls_Manager::COLOR, |
| 941 | 'default' => '', |
| 942 | 'selectors' => [ |
| 943 | '{{WRAPPER}} .elementor-icon-list-text' => 'color: {{VALUE}};', |
| 944 | ], |
| 945 | ] |
| 946 | ); |
| 947 | |
| 948 | $this->add_control( |
| 949 | 'text_color_hover', |
| 950 | [ |
| 951 | 'label' => esc_html__( 'Hover', 'elementskit-lite' ), |
| 952 | 'type' => Controls_Manager::COLOR, |
| 953 | 'default' => '', |
| 954 | 'selectors' => [ |
| 955 | '{{WRAPPER}} .elementor-icon-list-item:hover .elementor-icon-list-text' => 'color: {{VALUE}};', |
| 956 | ], |
| 957 | ] |
| 958 | ); |
| 959 | |
| 960 | $this->add_control( |
| 961 | 'text_indent', |
| 962 | [ |
| 963 | 'label' => esc_html__( 'Padding Left', 'elementskit-lite' ), |
| 964 | 'type' => Controls_Manager::SLIDER, |
| 965 | 'range' => [ |
| 966 | 'px' => [ |
| 967 | 'max' => 50, |
| 968 | ], |
| 969 | ], |
| 970 | 'default' => [ |
| 971 | 'size' => 10 |
| 972 | ], |
| 973 | 'selectors' => [ |
| 974 | '{{WRAPPER}} .elementor-icon-list-text' => is_rtl() ? 'padding-right: {{SIZE}}{{UNIT}};' : 'padding-left: {{SIZE}}{{UNIT}};', |
| 975 | ], |
| 976 | ] |
| 977 | ); |
| 978 | |
| 979 | $this->add_group_control( |
| 980 | Group_Control_Typography::get_type(), |
| 981 | [ |
| 982 | 'name' => 'icon_typography', |
| 983 | 'selector' => '{{WRAPPER}} .elementor-icon-list-item', |
| 984 | ] |
| 985 | ); |
| 986 | |
| 987 | $this->end_controls_section(); |
| 988 | |
| 989 | $this->start_controls_section( |
| 990 | 'feature_image_style', |
| 991 | [ |
| 992 | 'label' => esc_html__( 'Feature Image', 'elementskit-lite' ), |
| 993 | 'tab' => Controls_Manager::TAB_STYLE, |
| 994 | 'condition' => [ |
| 995 | 'show_feature_image' => 'yes' |
| 996 | ] |
| 997 | ] |
| 998 | ); |
| 999 | |
| 1000 | $this->add_responsive_control( |
| 1001 | 'feature_image_width', |
| 1002 | [ |
| 1003 | 'label' => esc_html__( 'Width', 'elementskit-lite' ), |
| 1004 | 'type' => Controls_Manager::SLIDER, |
| 1005 | 'range' => [ |
| 1006 | 'px' => [ |
| 1007 | 'min' => 10, |
| 1008 | 'max' => 200, |
| 1009 | ], |
| 1010 | ], |
| 1011 | 'selectors' => [ |
| 1012 | '{{WRAPPER}} .elementor-icon-list-item a > img' => 'width: {{SIZE}}{{UNIT}};', |
| 1013 | ], |
| 1014 | |
| 1015 | |
| 1016 | ] |
| 1017 | ); |
| 1018 | |
| 1019 | $this->add_responsive_control( |
| 1020 | 'feature_image_border_radius', |
| 1021 | [ |
| 1022 | 'label' =>esc_html__( 'Border Radius', 'elementskit-lite' ), |
| 1023 | 'type' => Controls_Manager::DIMENSIONS, |
| 1024 | 'size_units' => [ 'px'], |
| 1025 | 'default' => [ |
| 1026 | 'top' => '', |
| 1027 | 'right' => '', |
| 1028 | 'bottom' => '' , |
| 1029 | 'left' => '', |
| 1030 | ], |
| 1031 | 'selectors' => [ |
| 1032 | '{{WRAPPER}} .elementor-icon-list-item a > img' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1033 | ], |
| 1034 | ] |
| 1035 | ); |
| 1036 | |
| 1037 | $this->end_controls_section(); |
| 1038 | |
| 1039 | $this->start_controls_section( |
| 1040 | 'ekit_post_list_meta_style_tab', |
| 1041 | [ |
| 1042 | 'label' => esc_html__( 'Meta', 'elementskit-lite' ), |
| 1043 | 'tab' => Controls_Manager::TAB_STYLE, |
| 1044 | 'condition' => [ |
| 1045 | 'show_post_meta' => 'yes' |
| 1046 | ] |
| 1047 | ] |
| 1048 | ); |
| 1049 | |
| 1050 | $this->add_group_control( |
| 1051 | Group_Control_Typography::get_type(), |
| 1052 | [ |
| 1053 | 'name' => 'ekit_post_list_meta_content_typography', |
| 1054 | 'label' => esc_html__( 'Typography', 'elementskit-lite' ), |
| 1055 | 'selector' => '{{WRAPPER}} .elementor-icon-list-item .meta-lists > span', |
| 1056 | ] |
| 1057 | ); |
| 1058 | |
| 1059 | $this->add_responsive_control( |
| 1060 | 'ekit_post_list_meta_content_icon_size', |
| 1061 | [ |
| 1062 | 'label' => esc_html__( 'Icon Size', 'elementskit-lite' ), |
| 1063 | 'type' => Controls_Manager::SLIDER, |
| 1064 | 'size_units' => [ 'px', '%' ], |
| 1065 | 'range' => [ |
| 1066 | 'px' => [ |
| 1067 | 'min' => 1, |
| 1068 | 'max' => 100, |
| 1069 | 'step' => 5, |
| 1070 | ], |
| 1071 | '%' => [ |
| 1072 | 'min' => 1, |
| 1073 | 'max' => 100, |
| 1074 | ], |
| 1075 | ], |
| 1076 | 'selectors' => [ |
| 1077 | '{{WRAPPER}} .elementor-icon-list-item .meta-lists > span i' => 'font-size: {{SIZE}}{{UNIT}};', |
| 1078 | '{{WRAPPER}} .elementor-icon-list-item .meta-lists > span svg' => 'max-width: {{SIZE}}{{UNIT}};', |
| 1079 | ], |
| 1080 | ] |
| 1081 | ); |
| 1082 | |
| 1083 | $this->add_responsive_control( |
| 1084 | 'meta_icon_spacing', |
| 1085 | [ |
| 1086 | 'label' => esc_html__( 'Icon Spacing', 'elementskit-lite' ), |
| 1087 | 'type' => Controls_Manager::SLIDER, |
| 1088 | 'size_units' => [ 'px' ], |
| 1089 | 'range' => [ |
| 1090 | 'px' => [ |
| 1091 | 'min' => 0, |
| 1092 | 'max' => 100, |
| 1093 | 'step' => 1, |
| 1094 | ], |
| 1095 | ], |
| 1096 | 'default' => [ |
| 1097 | 'unit' => 'px', |
| 1098 | 'size' => 5, |
| 1099 | ], |
| 1100 | 'selectors' => [ |
| 1101 | '{{WRAPPER}} .elementor-icon-list-item .meta-lists > span i, {{WRAPPER}} .elementor-icon-list-item .meta-lists > span svg' => 'margin-right: {{SIZE}}{{UNIT}};', |
| 1102 | ], |
| 1103 | ] |
| 1104 | ); |
| 1105 | |
| 1106 | $this->add_responsive_control( |
| 1107 | 'ekit_post_list_meta_content_padding', |
| 1108 | [ |
| 1109 | 'label' => esc_html__( 'Padding', 'elementskit-lite' ), |
| 1110 | 'type' => Controls_Manager::DIMENSIONS, |
| 1111 | 'size_units' => [ 'px', '%', 'em' ], |
| 1112 | 'selectors' => [ |
| 1113 | '{{WRAPPER}} .elementor-icon-list-item .meta-lists > span' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1114 | ], |
| 1115 | ] |
| 1116 | ); |
| 1117 | |
| 1118 | $this->add_responsive_control( |
| 1119 | 'ekit_post_list_meta_content_margin', |
| 1120 | [ |
| 1121 | 'label' => esc_html__( 'Margin', 'elementskit-lite' ), |
| 1122 | 'type' => Controls_Manager::DIMENSIONS, |
| 1123 | 'size_units' => [ 'px', '%', 'em' ], |
| 1124 | 'default' => [ |
| 1125 | 'top' => '', |
| 1126 | 'right' => '', |
| 1127 | 'bottom' => '', |
| 1128 | 'left' => '10', |
| 1129 | 'unit' => 'px', |
| 1130 | ], |
| 1131 | 'selectors' => [ |
| 1132 | '{{WRAPPER}} .elementor-icon-list-item .meta-lists > span' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1133 | ], |
| 1134 | ] |
| 1135 | ); |
| 1136 | |
| 1137 | |
| 1138 | $this->start_controls_tabs( 'ekit_post_list_normal_and_hover_tabs' ); |
| 1139 | |
| 1140 | $this->start_controls_tab( |
| 1141 | 'ekit_post_list_normal_tab', |
| 1142 | [ |
| 1143 | 'label' =>esc_html__( 'Normal', 'elementskit-lite' ), |
| 1144 | ] |
| 1145 | ); |
| 1146 | |
| 1147 | $this->add_responsive_control( |
| 1148 | 'ekit_post_list_meta_content_color', |
| 1149 | [ |
| 1150 | 'label' => esc_html__( 'Color', 'elementskit-lite' ), |
| 1151 | 'type' => Controls_Manager::COLOR, |
| 1152 | 'default' => '#7f8595', |
| 1153 | 'selectors' => [ |
| 1154 | '{{WRAPPER}} .elementor-icon-list-item .meta-lists > span' => 'color: {{VALUE}};', |
| 1155 | '{{WRAPPER}} .elementor-icon-list-item .meta-lists svg ' => 'fill: {{VALUE}};' |
| 1156 | ], |
| 1157 | ] |
| 1158 | ); |
| 1159 | |
| 1160 | $this->add_responsive_control( |
| 1161 | 'ekit_post_list_meta_content_bg_color', |
| 1162 | [ |
| 1163 | 'label' => esc_html__( 'Background Color', 'elementskit-lite' ), |
| 1164 | 'type' => Controls_Manager::COLOR, |
| 1165 | 'selectors' => [ |
| 1166 | '{{WRAPPER}} .elementor-icon-list-item .meta-lists > span' => 'background-color: {{VALUE}}', |
| 1167 | ], |
| 1168 | ] |
| 1169 | ); |
| 1170 | |
| 1171 | $this->add_responsive_control( |
| 1172 | 'ekit_post_list_meta_content_border_radius', |
| 1173 | [ |
| 1174 | 'label' => esc_html__( 'Border Radius', 'elementskit-lite' ), |
| 1175 | 'type' => Controls_Manager::DIMENSIONS, |
| 1176 | 'size_units' => [ 'px', '%', 'em' ], |
| 1177 | 'selectors' => [ |
| 1178 | '{{WRAPPER}} .elementor-icon-list-item .meta-lists > span' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1179 | ], |
| 1180 | ] |
| 1181 | ); |
| 1182 | |
| 1183 | $this->end_controls_tab(); |
| 1184 | |
| 1185 | $this->start_controls_tab( |
| 1186 | 'ekit_post_list_hover_tab', |
| 1187 | [ |
| 1188 | 'label' =>esc_html__( 'Hover', 'elementskit-lite' ), |
| 1189 | ] |
| 1190 | ); |
| 1191 | |
| 1192 | $this->add_responsive_control( |
| 1193 | 'ekit_post_list_meta_content_color_hover', |
| 1194 | [ |
| 1195 | 'label' => esc_html__( 'Color', 'elementskit-lite' ), |
| 1196 | 'type' => Controls_Manager::COLOR, |
| 1197 | 'selectors' => [ |
| 1198 | '{{WRAPPER}} .elementor-icon-list-item .meta-lists > span:hover' => 'color: {{VALUE}}', |
| 1199 | '{{WRAPPER}} .elementor-icon-list-item .meta-lists > span:hover svg' => 'fill: {{VALUE}};' |
| 1200 | ], |
| 1201 | ] |
| 1202 | ); |
| 1203 | |
| 1204 | $this->add_responsive_control( |
| 1205 | 'ekit_post_list_meta_content_bg_color_hover', |
| 1206 | [ |
| 1207 | 'label' => esc_html__( 'Background Color', 'elementskit-lite' ), |
| 1208 | 'type' => Controls_Manager::COLOR, |
| 1209 | 'selectors' => [ |
| 1210 | '{{WRAPPER}} .elementor-icon-list-item .meta-lists > span:hover' => 'background-color: {{VALUE}}', |
| 1211 | ], |
| 1212 | ] |
| 1213 | ); |
| 1214 | |
| 1215 | $this->add_responsive_control( |
| 1216 | 'ekit_post_list_meta_content_border_radius_hover', |
| 1217 | [ |
| 1218 | 'label' => esc_html__( 'Border Radius', 'elementskit-lite' ), |
| 1219 | 'type' => Controls_Manager::DIMENSIONS, |
| 1220 | 'size_units' => [ 'px', '%', 'em' ], |
| 1221 | 'selectors' => [ |
| 1222 | '{{WRAPPER}} .elementor-icon-list-item .meta-lists > span:hover' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1223 | ], |
| 1224 | ] |
| 1225 | ); |
| 1226 | |
| 1227 | $this->end_controls_tab(); |
| 1228 | $this->end_controls_tabs(); |
| 1229 | |
| 1230 | $this->end_controls_section(); |
| 1231 | |
| 1232 | $this->insert_pro_message(); |
| 1233 | } |
| 1234 | |
| 1235 | protected function render( ) { |
| 1236 | echo '<div class="ekit-wid-con" >'; |
| 1237 | $this->render_raw(); |
| 1238 | echo '</div>'; |
| 1239 | } |
| 1240 | |
| 1241 | private function post_list($post, $item = null) { |
| 1242 | $settings = $this->get_settings_for_display(); |
| 1243 | $categories = get_the_category($post->ID); |
| 1244 | $text = empty($item['text']) ? $post->post_title : $item['text']; |
| 1245 | |
| 1246 | $grid_d = empty($settings['post_grid']) ? '' : 'ekit-col-'.$settings['post_grid']; |
| 1247 | $grid_t = empty($settings['post_grid_tablet']) ? '' : 'ekit-col-tablet-'.$settings['post_grid_tablet']; |
| 1248 | $grid_m = empty($settings['post_grid_mobile']) ? '' : 'ekit-col-mobile-'.$settings['post_grid_mobile']; |
| 1249 | |
| 1250 | ob_start(); |
| 1251 | $feature_bg_url = get_the_post_thumbnail_url($post, $settings['show_feature_img_size_size']); |
| 1252 | ?> |
| 1253 | <li class="elementor-icon-list-item <?php echo esc_attr($grid_d); ?> <?php echo esc_attr($grid_t); ?> <?php echo esc_attr($grid_m); ?>"> |
| 1254 | <a href="<?php echo esc_url(get_the_permalink($post->ID)); ?>" <?php if(isset($settings['show_bg_feature_image']) && $settings['show_bg_feature_image'] == 'yes' && !empty($feature_bg_url)) : ?>style="background-image: url('<?php echo esc_attr( $feature_bg_url ); ?>')" <?php endif; ?>> |
| 1255 | <?php |
| 1256 | if ($settings['show_feature_image'] == 'yes') { |
| 1257 | echo get_the_post_thumbnail($post->ID, $settings['show_feature_img_size_size']); |
| 1258 | } else { |
| 1259 | if ( $settings['show_post_icon'] === 'yes' ) { ?> |
| 1260 | <span class="elementor-icon-list-icon"> |
| 1261 | <?php |
| 1262 | // new icon |
| 1263 | $migrated = isset( $settings['__fa4_migrated']['icons'] ); |
| 1264 | // Check if its a new widget without previously selected icon using the old Icon control |
| 1265 | $is_new = empty( $settings['icon'] ); |
| 1266 | if ( $is_new || $migrated ) { |
| 1267 | // new icon |
| 1268 | Icons_Manager::render_icon( $settings['icons'], [ 'aria-hidden' => 'true' ] ); |
| 1269 | } else { |
| 1270 | ?> |
| 1271 | <i class="<?php echo esc_attr($settings['icon']); ?>" aria-hidden="true"></i> |
| 1272 | <?php |
| 1273 | } |
| 1274 | ?> |
| 1275 | </span> |
| 1276 | <?php } |
| 1277 | } |
| 1278 | ?> |
| 1279 | <div class="ekit_post_list_content_wraper"> |
| 1280 | <?php if ($settings['show_post_meta'] == 'yes') { |
| 1281 | if ($settings['post_meta_position'] == 'top_position') { |
| 1282 | ?> |
| 1283 | <?php if ($settings['show_date_meta'] == 'yes' || $settings['show_category_meta'] == 'yes') { ?> |
| 1284 | <div class="meta-lists"> |
| 1285 | <?php if ($settings['show_date_meta'] == 'yes') { ?> |
| 1286 | <span class="meta-date"> |
| 1287 | |
| 1288 | <?php |
| 1289 | // new icon |
| 1290 | $migrated = isset( $settings['__fa4_migrated']['date_meta__icons'] ); |
| 1291 | // Check if its a new widget without previously selected icon using the old Icon control |
| 1292 | $is_new = empty( $settings['date_meta__icon'] ); |
| 1293 | if ( $is_new || $migrated ) { |
| 1294 | // new icon |
| 1295 | Icons_Manager::render_icon( $settings['date_meta__icons'], [ 'aria-hidden' => 'true' ] ); |
| 1296 | } else { |
| 1297 | ?> |
| 1298 | <i class="<?php echo esc_attr($settings['date_meta__icon']); ?>" aria-hidden="true"></i> |
| 1299 | <?php |
| 1300 | } |
| 1301 | ?> |
| 1302 | |
| 1303 | <?php echo get_the_date("d M Y", $post->ID); ?> |
| 1304 | </span> |
| 1305 | <?php }; ?> |
| 1306 | |
| 1307 | <?php |
| 1308 | if ($settings['show_category_meta'] == 'yes') { |
| 1309 | $counter = 0; |
| 1310 | ?> |
| 1311 | <span class="meta-category"> |
| 1312 | <?php if (!empty($settings['category_meta__icons'])) { ?> |
| 1313 | |
| 1314 | <?php |
| 1315 | // new icon |
| 1316 | $migrated = isset( $settings['__fa4_migrated']['category_meta__icons'] ); |
| 1317 | // Check if its a new widget without previously selected icon using the old Icon control |
| 1318 | $is_new = empty( $settings['category_meta__icon'] ); |
| 1319 | if ( $is_new || $migrated ) { |
| 1320 | // new icon |
| 1321 | Icons_Manager::render_icon( $settings['category_meta__icons'], [ 'aria-hidden' => 'true' ] ); |
| 1322 | } else { |
| 1323 | ?> |
| 1324 | <i class="<?php echo esc_attr($settings['category_meta__icon']); ?>" aria-hidden="true"></i> |
| 1325 | <?php |
| 1326 | } |
| 1327 | ?> |
| 1328 | |
| 1329 | <?php } |
| 1330 | echo (isset($categories[0])) ? esc_html( $categories[0]->name ) : 0; |
| 1331 | ?> |
| 1332 | </span> |
| 1333 | <?php |
| 1334 | } |
| 1335 | ?> |
| 1336 | </div> |
| 1337 | <?php |
| 1338 | }; |
| 1339 | }; |
| 1340 | }; |
| 1341 | ?> |
| 1342 | |
| 1343 | <span class="elementor-icon-list-text"><?php echo esc_html($text); ?></span> |
| 1344 | |
| 1345 | <?php if ($settings['show_post_meta'] == 'yes') { |
| 1346 | if ($settings['post_meta_position'] == 'bottom_position') { |
| 1347 | ?> |
| 1348 | <?php if ($settings['show_date_meta'] == 'yes' || $settings['show_category_meta'] == 'yes') { ?> |
| 1349 | <div class="meta-lists"> |
| 1350 | <?php if ($settings['show_date_meta'] == 'yes') { ?> |
| 1351 | <span class="meta-date"> |
| 1352 | <?php |
| 1353 | // new icon |
| 1354 | $migrated = isset( $settings['__fa4_migrated']['date_meta__icons'] ); |
| 1355 | // Check if its a new widget without previously selected icon using the old Icon control |
| 1356 | $is_new = empty( $settings['date_meta__icon'] ); |
| 1357 | if ( $is_new || $migrated ) { |
| 1358 | // new icon |
| 1359 | Icons_Manager::render_icon( $settings['date_meta__icons'], [ 'aria-hidden' => 'true' ] ); |
| 1360 | } else { |
| 1361 | ?> |
| 1362 | <i class="<?php echo esc_attr($settings['date_meta__icon']); ?>" aria-hidden="true"></i> |
| 1363 | <?php |
| 1364 | } |
| 1365 | ?> |
| 1366 | |
| 1367 | <?php echo get_the_date("d M Y", $post->ID); ?> |
| 1368 | </span> |
| 1369 | <?php }; ?> |
| 1370 | |
| 1371 | <?php |
| 1372 | if ($settings['show_category_meta'] == 'yes') { |
| 1373 | $counter = 0; |
| 1374 | ?> |
| 1375 | <span class="meta-category"> |
| 1376 | <?php if (!empty($settings['category_meta__icons'])) { ?> |
| 1377 | <?php |
| 1378 | // new icon |
| 1379 | $migrated = isset( $settings['__fa4_migrated']['category_meta__icons'] ); |
| 1380 | // Check if its a new widget without previously selected icon using the old Icon control |
| 1381 | $is_new = empty( $settings['category_meta__icon'] ); |
| 1382 | if ( $is_new || $migrated ) { |
| 1383 | // new icon |
| 1384 | Icons_Manager::render_icon( $settings['category_meta__icons'], [ 'aria-hidden' => 'true' ] ); |
| 1385 | } else { |
| 1386 | ?> |
| 1387 | <i class="<?php echo esc_attr($settings['category_meta__icon']); ?>" aria-hidden="true"></i> |
| 1388 | <?php |
| 1389 | } |
| 1390 | ?> |
| 1391 | <?php } |
| 1392 | echo esc_html( $categories[0]->name ); ?> |
| 1393 | </span> |
| 1394 | <?php |
| 1395 | } |
| 1396 | ?> |
| 1397 | </div> |
| 1398 | <?php |
| 1399 | }; |
| 1400 | }; |
| 1401 | }; |
| 1402 | ?> |
| 1403 | </div> |
| 1404 | </a> |
| 1405 | </li> |
| 1406 | <?php |
| 1407 | return ob_get_clean(); |
| 1408 | } |
| 1409 | |
| 1410 | protected function render_raw( ) { |
| 1411 | $settings = $this->get_settings_for_display(); |
| 1412 | |
| 1413 | $this->add_render_attribute( 'icon_list', 'class', 'elementor-icon-list-items ekit-post-list-wrapper' ); |
| 1414 | $this->add_render_attribute( 'icon_list', 'class', (isset($settings['show_bg_feature_image']) && $settings['show_bg_feature_image'] == 'yes' ? 'ekit-enabled-bg-img': '') ); |
| 1415 | |
| 1416 | $this->add_render_attribute( 'list_item', 'class', 'elementor-icon-list-item' ); |
| 1417 | |
| 1418 | if ( 'inline' === $settings['view'] ) { |
| 1419 | $this->add_render_attribute( 'icon_list', 'class', 'elementor-inline-items' ); |
| 1420 | $this->add_render_attribute( 'list_item', 'class', 'elementor-inline-item' ); |
| 1421 | } |
| 1422 | |
| 1423 | |
| 1424 | ?> |
| 1425 | <ul <?php echo $this->get_render_attribute_string( 'icon_list' ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Already escaped by elementor ?>> |
| 1426 | <?php |
| 1427 | $post_args = array( |
| 1428 | 'post_type' => 'post', |
| 1429 | 'posts_per_page' => esc_html($settings['section_recent_post_limit']) |
| 1430 | ); |
| 1431 | |
| 1432 | if($settings['section_layout_options'] === 'popular'){ |
| 1433 | $post_args['meta_key'] = 'ekit_post_views_count'; // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_key |
| 1434 | $post_args['orderby'] = 'meta_value_num'; |
| 1435 | $post_args['order'] = 'DESC'; |
| 1436 | } |
| 1437 | |
| 1438 | if($settings['section_layout_options'] === 'category') { |
| 1439 | $post_args['category'] = $settings['ekit_blog_posts_category']; |
| 1440 | } |
| 1441 | |
| 1442 | $posts = get_posts($post_args); |
| 1443 | |
| 1444 | if(in_array($settings['section_layout_options'], ['recent', 'popular', 'category'])) { |
| 1445 | if( is_countable($posts) && count($posts) > 0){ |
| 1446 | foreach($posts as $post){ |
| 1447 | echo $this->post_list($post); // phpcs:ignore WordPress.Security.EscapeOutput -- Buffering output line number 1383 |
| 1448 | } |
| 1449 | }else { |
| 1450 | esc_html_e('Opps, No posts were found.', 'elementskit-lite'); |
| 1451 | } |
| 1452 | } else { |
| 1453 | foreach ( $settings['icon_list'] as $index => $item ) { |
| 1454 | $post = !empty( $item['link'] ) ? get_post($item['link']) : 0; |
| 1455 | if($post != null){ echo $this->post_list($post, $item); }; // phpcs:ignore WordPress.Security.EscapeOutput -- Buffering output line number 1383 |
| 1456 | }; |
| 1457 | } |
| 1458 | ?> |
| 1459 | </ul> |
| 1460 | <?php |
| 1461 | } |
| 1462 | } |
| 1463 |