post-tab.php
585 lines
| 1 | <?php |
| 2 | namespace Elementor; |
| 3 | |
| 4 | use \Elementor\ElementsKit_Widget_Post_Tab_Handler as Handler; |
| 5 | use \ElementsKit_Lite\Modules\Controls\Controls_Manager as ElementsKit_Controls_Manager; |
| 6 | |
| 7 | if (! defined( 'ABSPATH' ) ) exit; |
| 8 | |
| 9 | |
| 10 | class ElementsKit_Widget_Post_Tab extends Widget_Base { |
| 11 | use \ElementsKit_Lite\Widgets\Widget_Notice; |
| 12 | |
| 13 | public $base; |
| 14 | |
| 15 | public function get_script_depends() { |
| 16 | return ['ekit-post-tab']; |
| 17 | } |
| 18 | |
| 19 | public function get_style_depends() { |
| 20 | return ['ekit-post-tab']; |
| 21 | } |
| 22 | |
| 23 | public function get_name() { |
| 24 | return Handler::get_name(); |
| 25 | } |
| 26 | |
| 27 | public function get_title() { |
| 28 | return Handler::get_title(); |
| 29 | } |
| 30 | |
| 31 | public function get_icon() { |
| 32 | return Handler::get_icon(); |
| 33 | } |
| 34 | |
| 35 | public function get_keywords() { |
| 36 | return Handler::get_keywords(); |
| 37 | } |
| 38 | |
| 39 | public function get_categories() { |
| 40 | return Handler::get_categories(); |
| 41 | } |
| 42 | |
| 43 | public function get_help_url() { |
| 44 | return 'https://wpmet.com/doc/how-to-add-post-tab-in-elementor/'; |
| 45 | } |
| 46 | protected function is_dynamic_content(): bool { |
| 47 | return false; |
| 48 | } |
| 49 | |
| 50 | protected function register_controls() { |
| 51 | |
| 52 | $this->start_controls_section( |
| 53 | 'content_tab', |
| 54 | [ |
| 55 | 'label' => esc_html__('Widget settings', 'elementskit-lite'), |
| 56 | 'tab' => Controls_Manager::TAB_CONTENT, |
| 57 | ] |
| 58 | ); |
| 59 | |
| 60 | $this->add_control( |
| 61 | 'post_cat', |
| 62 | [ |
| 63 | 'label' =>esc_html__('Select Categories', 'elementskit-lite'), |
| 64 | 'type' => ElementsKit_Controls_Manager::AJAXSELECT2, |
| 65 | 'description' => esc_html__('To avail this option you need to set/add a featured image to posts..', 'elementskit-lite'), |
| 66 | 'options' =>'ajaxselect2/category', |
| 67 | 'label_block' => true, |
| 68 | 'multiple' => true, |
| 69 | ] |
| 70 | ); |
| 71 | $this->add_control( |
| 72 | 'post_count', |
| 73 | [ |
| 74 | 'label' => esc_html__( 'Post count', 'elementskit-lite' ), |
| 75 | 'type' => Controls_Manager::NUMBER, |
| 76 | 'default' => esc_html__( '3', 'elementskit-lite' ), |
| 77 | |
| 78 | ] |
| 79 | ); |
| 80 | |
| 81 | $this->add_responsive_control( |
| 82 | 'count_col', |
| 83 | [ |
| 84 | 'label' => esc_html__( 'Select Column', 'elementskit-lite' ), |
| 85 | 'type' => Controls_Manager::SELECT, |
| 86 | 'default' => 'ekit___column-2', |
| 87 | 'tablet_default' => 'ekit___column-2', |
| 88 | 'mobile_default' => 'ekit___column-2', |
| 89 | 'options' => [ |
| 90 | 'ekit___column-2' => esc_html__( '2 Column', 'elementskit-lite' ), |
| 91 | 'ekit___column-3' => esc_html__( '3 Column', 'elementskit-lite' ), |
| 92 | 'ekit___column-4' => esc_html__( '4 Column', 'elementskit-lite' ), |
| 93 | ] |
| 94 | ] |
| 95 | ); |
| 96 | |
| 97 | $this->add_control( |
| 98 | 'ekit_post_tab_on_click', |
| 99 | [ |
| 100 | 'label' => esc_html__( 'On Click', 'elementskit-lite' ), |
| 101 | 'type' => Controls_Manager::SWITCHER, |
| 102 | 'label_on' => esc_html__( 'Show', 'elementskit-lite' ), |
| 103 | 'label_off' => esc_html__( 'Hide', 'elementskit-lite' ), |
| 104 | 'return_value' => 'yes', |
| 105 | 'default' => 'no', |
| 106 | 'prefix_class' => 'is-click-', |
| 107 | 'render_type' => 'template', |
| 108 | ] |
| 109 | ); |
| 110 | |
| 111 | $this->add_control( |
| 112 | 'ekit_post_tab_on_click_link_archive', |
| 113 | [ |
| 114 | 'label' => __( 'Link Archive?', 'elementskit-lite' ), |
| 115 | 'type' => Controls_Manager::SWITCHER, |
| 116 | 'label_on' => __( 'Show', 'elementskit-lite' ), |
| 117 | 'label_off' => __( 'Hide', 'elementskit-lite' ), |
| 118 | 'return_value' => 'yes', |
| 119 | 'default' => 'no', |
| 120 | 'condition' => [ |
| 121 | 'ekit_post_tab_on_click' => 'yes' |
| 122 | ] |
| 123 | ] |
| 124 | ); |
| 125 | |
| 126 | $this->end_controls_section(); |
| 127 | |
| 128 | $this->start_controls_section( |
| 129 | 'ekit_post_tab_wraper_style', |
| 130 | [ |
| 131 | 'label' => esc_html__( 'Tab Item Container', 'elementskit-lite' ), |
| 132 | 'tab' => Controls_Manager::TAB_STYLE, |
| 133 | ] |
| 134 | ); |
| 135 | |
| 136 | $this->add_group_control( |
| 137 | Group_Control_Border::get_type(), |
| 138 | [ |
| 139 | 'name' => 'ekit_post_tab_wraper_border', |
| 140 | 'label' => esc_html__( 'Border', 'elementskit-lite' ), |
| 141 | 'selector' => '{{WRAPPER}} .tab__list', |
| 142 | ] |
| 143 | ); |
| 144 | |
| 145 | $this->add_group_control( |
| 146 | Group_Control_Background::get_type(), |
| 147 | [ |
| 148 | 'name' => 'ekit_post_tab_wraper_background', |
| 149 | 'label' => esc_html__( 'Background', 'elementskit-lite' ), |
| 150 | 'types' => [ 'classic', ], |
| 151 | 'exclude' => ['image'], // PHPCS:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude |
| 152 | 'selector' => '{{WRAPPER}} .tab__list', |
| 153 | ] |
| 154 | ); |
| 155 | |
| 156 | $this->add_responsive_control( |
| 157 | 'ekit_post_tab_wraper_margin', |
| 158 | [ |
| 159 | 'label' => esc_html__( 'Margin', 'elementskit-lite' ), |
| 160 | 'type' => Controls_Manager::DIMENSIONS, |
| 161 | 'size_units' => [ 'px', '%', 'em' ], |
| 162 | 'selectors' => [ |
| 163 | '{{WRAPPER}} .tab__list' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 164 | ], |
| 165 | ] |
| 166 | ); |
| 167 | |
| 168 | $this->add_responsive_control( |
| 169 | 'ekit_post_tab_wraper_padding', |
| 170 | [ |
| 171 | 'label' => esc_html__( 'Padding', 'elementskit-lite' ), |
| 172 | 'type' => Controls_Manager::DIMENSIONS, |
| 173 | 'size_units' => [ 'px', '%', 'em' ], |
| 174 | 'selectors' => [ |
| 175 | '{{WRAPPER}} .post--tab .tabHeader .tab__list' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 176 | ], |
| 177 | ] |
| 178 | ); |
| 179 | |
| 180 | $this->end_controls_section(); |
| 181 | |
| 182 | $this->start_controls_section( |
| 183 | 'ekit_post_tab_style', |
| 184 | [ |
| 185 | 'label' => esc_html__( 'Tab Item', 'elementskit-lite' ), |
| 186 | 'tab' => Controls_Manager::TAB_STYLE, |
| 187 | ] |
| 188 | ); |
| 189 | |
| 190 | $this->add_group_control( |
| 191 | Group_Control_Typography::get_type(), |
| 192 | [ |
| 193 | 'name' => 'ekit_post_tab__item_content_typography', |
| 194 | 'label' => esc_html__( 'Typography', 'elementskit-lite' ), |
| 195 | 'selector' => '{{WRAPPER}} .post--tab .tabHeader .tab__list .tab__list__item', |
| 196 | ] |
| 197 | ); |
| 198 | |
| 199 | $this->add_responsive_control( |
| 200 | 'ekit_post_tab__item_margin', |
| 201 | [ |
| 202 | 'label' => esc_html__( 'Margin', 'elementskit-lite' ), |
| 203 | 'type' => Controls_Manager::DIMENSIONS, |
| 204 | 'size_units' => [ 'px', '%', 'em' ], |
| 205 | 'selectors' => [ |
| 206 | '{{WRAPPER}} .post--tab .tabHeader .tab__list .tab__list__item' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 207 | ], |
| 208 | ] |
| 209 | ); |
| 210 | |
| 211 | $this->add_responsive_control( |
| 212 | 'ekit_post_tab__item_padding', |
| 213 | [ |
| 214 | 'label' => esc_html__( 'Padding', 'elementskit-lite' ), |
| 215 | 'type' => Controls_Manager::DIMENSIONS, |
| 216 | 'size_units' => [ 'px', '%', 'em' ], |
| 217 | 'selectors' => [ |
| 218 | '{{WRAPPER}} .post--tab .tabHeader .tab__list .tab__list__item' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 219 | ], |
| 220 | ] |
| 221 | ); |
| 222 | |
| 223 | $this->start_controls_tabs( |
| 224 | 'ekit_post_tab_normal_and_hover_tabs' |
| 225 | ); |
| 226 | $this->start_controls_tab( |
| 227 | 'ekit_post_tab_normal_tab', |
| 228 | [ |
| 229 | 'label' => esc_html__( 'Normal', 'elementskit-lite' ), |
| 230 | ] |
| 231 | ); |
| 232 | |
| 233 | $this->add_control( |
| 234 | 'ekit_post_tab__item__color', |
| 235 | [ |
| 236 | 'label' => esc_html__( 'Color', 'elementskit-lite' ), |
| 237 | 'type' => Controls_Manager::COLOR, |
| 238 | 'selectors' => [ |
| 239 | '{{WRAPPER}} .post--tab .tabHeader .tab__list .tab__list__item' => 'color: {{VALUE}}', |
| 240 | ], |
| 241 | ] |
| 242 | ); |
| 243 | |
| 244 | $this->add_group_control( |
| 245 | Group_Control_Background::get_type(), |
| 246 | [ |
| 247 | 'name' => 'ekit_post_tab__item_background_color_normal', |
| 248 | 'label' => esc_html__( 'Background', 'elementskit-lite' ), |
| 249 | 'types' => [ 'classic', ], |
| 250 | 'exclude' => [ 'image' ], // PHPCS:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude |
| 251 | 'selector' => '{{WRAPPER}} .post--tab .tabHeader .tab__list .tab__list__item', |
| 252 | ] |
| 253 | ); |
| 254 | |
| 255 | $this->add_responsive_control( |
| 256 | 'ekit_post_tab__item_border_radius_normal', |
| 257 | [ |
| 258 | 'label' => esc_html__( 'Border Radius', 'elementskit-lite' ), |
| 259 | 'type' => Controls_Manager::DIMENSIONS, |
| 260 | 'size_units' => [ 'px', '%', 'em' ], |
| 261 | 'selectors' => [ |
| 262 | '{{WRAPPER}} .post--tab .tabHeader .tab__list .tab__list__item' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 263 | ], |
| 264 | ] |
| 265 | ); |
| 266 | |
| 267 | $this->add_group_control( |
| 268 | Group_Control_Box_Shadow::get_type(), |
| 269 | [ |
| 270 | 'name' => 'ekit_post_tab_item_normal_box_shadow', |
| 271 | 'label' => esc_html__( 'Box Shadow', 'elementskit-lite' ), |
| 272 | 'selector' => '{{WRAPPER}} .tab__list .tab__list__item', |
| 273 | ] |
| 274 | ); |
| 275 | |
| 276 | $this->add_group_control( |
| 277 | Group_Control_Border::get_type(), |
| 278 | [ |
| 279 | 'name' => 'ekit_post_tab_item_normal_border', |
| 280 | 'label' => esc_html__( 'Border', 'elementskit-lite' ), |
| 281 | 'selector' => '{{WRAPPER}} .post--tab .tabHeader .tab__list .tab__list__item', |
| 282 | ] |
| 283 | ); |
| 284 | |
| 285 | $this->end_controls_tab(); |
| 286 | |
| 287 | $this->start_controls_tab( |
| 288 | 'ekit_post_tab_hover_tab', |
| 289 | [ |
| 290 | 'label' => esc_html__( 'Active', 'elementskit-lite' ), |
| 291 | ] |
| 292 | ); |
| 293 | |
| 294 | $this->add_control( |
| 295 | 'ekit_post_tab__item__color_hover', |
| 296 | [ |
| 297 | 'label' => esc_html__( 'Color', 'elementskit-lite' ), |
| 298 | 'type' => Controls_Manager::COLOR, |
| 299 | 'selectors' => [ |
| 300 | '{{WRAPPER}} .post--tab .tabHeader .tab__list .tab__list__item.active' => 'color: {{VALUE}}', |
| 301 | ], |
| 302 | ] |
| 303 | ); |
| 304 | |
| 305 | $this->add_group_control( |
| 306 | Group_Control_Background::get_type(), |
| 307 | [ |
| 308 | 'name' => 'ekit_post_tab__item_background_color_hover', |
| 309 | 'label' => esc_html__( 'Background', 'elementskit-lite' ), |
| 310 | 'types' => [ 'classic', ], |
| 311 | 'exclude' => ['image'], // PHPCS:ignore WordPressVIPMinimum.Performance.WPQueryParams.PostNotIn_exclude |
| 312 | 'selector' => '{{WRAPPER}} .post--tab .tabHeader .tab__list .tab__list__item.active', |
| 313 | ] |
| 314 | ); |
| 315 | |
| 316 | $this->add_responsive_control( |
| 317 | 'ekit_post_tab__item_border_radius_hover', |
| 318 | [ |
| 319 | 'label' => esc_html__( 'Border Radius', 'elementskit-lite' ), |
| 320 | 'type' => Controls_Manager::DIMENSIONS, |
| 321 | 'size_units' => [ 'px', '%', 'em' ], |
| 322 | 'selectors' => [ |
| 323 | '{{WRAPPER}} .post--tab .tabHeader .tab__list .tab__list__item.active' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 324 | ], |
| 325 | ] |
| 326 | ); |
| 327 | |
| 328 | $this->add_group_control( |
| 329 | Group_Control_Box_Shadow::get_type(), |
| 330 | [ |
| 331 | 'name' => 'ekit_post_tab_item_hover_box_shadow', |
| 332 | 'label' => esc_html__( 'Box Shadow', 'elementskit-lite' ), |
| 333 | 'selector' => '{{WRAPPER}} .tab__list .tab__list__item.active', |
| 334 | ] |
| 335 | ); |
| 336 | |
| 337 | $this->add_group_control( |
| 338 | Group_Control_Border::get_type(), |
| 339 | [ |
| 340 | 'name' => 'ekit_post_tab_item_hover_border', |
| 341 | 'label' => esc_html__( 'Border', 'elementskit-lite' ), |
| 342 | 'selector' => '{{WRAPPER}} .post--tab .tabHeader .tab__list .tab__list__item.active', |
| 343 | ] |
| 344 | ); |
| 345 | |
| 346 | $this->end_controls_tab(); |
| 347 | |
| 348 | $this->end_controls_tabs(); |
| 349 | |
| 350 | $this->end_controls_section(); |
| 351 | |
| 352 | $this->start_controls_section( |
| 353 | 'ekit_image', |
| 354 | [ |
| 355 | 'label' => esc_html__( 'Image', 'elementskit-lite' ), |
| 356 | 'tab' => Controls_Manager::TAB_STYLE, |
| 357 | ] |
| 358 | ); |
| 359 | |
| 360 | $this->add_control( |
| 361 | 'image_disable_hover_effect', |
| 362 | [ |
| 363 | 'label' => esc_html__( 'Disable Hover Effect', 'elementskit-lite' ), |
| 364 | 'type' => Controls_Manager::SWITCHER, |
| 365 | 'label_on' => esc_html__( 'Yes', 'elementskit-lite' ), |
| 366 | 'label_off' => esc_html__( 'No', 'elementskit-lite' ), |
| 367 | 'default' => 'no', |
| 368 | ] |
| 369 | ); |
| 370 | |
| 371 | $this->add_control( |
| 372 | 'ekit_image_width', |
| 373 | [ |
| 374 | 'label' => esc_html__( 'Width', 'elementskit-lite' ), |
| 375 | 'type' => Controls_Manager::SLIDER, |
| 376 | 'size_units' => [ 'px', '%' ], |
| 377 | 'range' => [ |
| 378 | 'px' => [ |
| 379 | 'min' => 0, |
| 380 | 'max' => 500, |
| 381 | 'step' => 1, |
| 382 | ], |
| 383 | '%' => [ |
| 384 | 'min' => 0, |
| 385 | 'max' => 100, |
| 386 | ], |
| 387 | ], |
| 388 | 'selectors' => [ |
| 389 | '{{WRAPPER}} .ekit--tab__post__details .tab__post--header>img' => 'width: {{SIZE}}{{UNIT}};', |
| 390 | ], |
| 391 | ] |
| 392 | ); |
| 393 | |
| 394 | $this->add_control( |
| 395 | 'ekit_image_height', |
| 396 | [ |
| 397 | 'label' => esc_html__( 'Height', 'elementskit-lite' ), |
| 398 | 'type' => Controls_Manager::SLIDER, |
| 399 | 'size_units' => [ 'px', '%' ], |
| 400 | 'range' => [ |
| 401 | 'px' => [ |
| 402 | 'min' => 0, |
| 403 | 'max' => 500, |
| 404 | 'step' => 1, |
| 405 | ], |
| 406 | '%' => [ |
| 407 | 'min' => 0, |
| 408 | 'max' => 100, |
| 409 | ], |
| 410 | ], |
| 411 | 'selectors' => [ |
| 412 | '{{WRAPPER}} .ekit--tab__post__details .tab__post--header>img' => 'height: {{SIZE}}{{UNIT}};', |
| 413 | ], |
| 414 | ] |
| 415 | ); |
| 416 | |
| 417 | $this->add_responsive_control( |
| 418 | 'ekit_image_alignment', |
| 419 | [ |
| 420 | 'label' =>esc_html__( 'Nav Content Alignment', 'elementskit-lite' ), |
| 421 | 'type' => Controls_Manager::CHOOSE, |
| 422 | 'options' => [ |
| 423 | 'left' => [ |
| 424 | 'title' =>esc_html__( 'Left', 'elementskit-lite' ), |
| 425 | 'icon' => 'eicon-text-align-left', |
| 426 | ], |
| 427 | 'center' => [ |
| 428 | 'title' =>esc_html__( 'Center', 'elementskit-lite' ), |
| 429 | 'icon' => 'eicon-text-align-center', |
| 430 | ], |
| 431 | 'right' => [ |
| 432 | 'title' =>esc_html__( 'Right', 'elementskit-lite' ), |
| 433 | 'icon' => 'eicon-text-align-right', |
| 434 | ], |
| 435 | ], |
| 436 | 'selectors' => [ |
| 437 | '{{WRAPPER}} .ekit--tab__post__details .tab__post--header' => 'text-align: {{VALUE}};' |
| 438 | ], |
| 439 | 'default' => 'left', |
| 440 | ] |
| 441 | ); |
| 442 | $this->end_controls_section(); |
| 443 | |
| 444 | $this->start_controls_section( |
| 445 | 'title_style', |
| 446 | [ |
| 447 | 'label' => esc_html__( 'Title', 'elementskit-lite' ), |
| 448 | 'tab' => Controls_Manager::TAB_STYLE |
| 449 | ] |
| 450 | ); |
| 451 | $this->add_group_control( |
| 452 | \Elementor\Group_Control_Typography::get_type(), |
| 453 | [ |
| 454 | 'name' => 'title_font', |
| 455 | 'label' => esc_html__( 'Typography', 'elementskit-lite' ), |
| 456 | 'selector' => '{{WRAPPER}} .tab__post--title', |
| 457 | ] |
| 458 | ); |
| 459 | $this->add_control( |
| 460 | 'title_color_normal', |
| 461 | [ |
| 462 | 'label' => esc_html__( 'Color', 'elementskit-lite' ), |
| 463 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 464 | 'default' => 'inherit', |
| 465 | 'selectors' => [ |
| 466 | '{{WRAPPER}} .tab__post--title > a' => 'color: {{VALUE}}; transition: all 0.3s ease;', |
| 467 | ], |
| 468 | ] |
| 469 | ); |
| 470 | $this->add_control( |
| 471 | 'title_color_hover', |
| 472 | [ |
| 473 | 'label' => esc_html__( 'Hover Color', 'elementskit-lite' ), |
| 474 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 475 | 'selectors' => [ |
| 476 | '{{WRAPPER}} .tab__post__single--item:hover .tab__post--title > a' => 'color: {{VALUE}}', |
| 477 | ], |
| 478 | ] |
| 479 | ); |
| 480 | |
| 481 | $this->add_responsive_control( |
| 482 | 'title_margin', |
| 483 | [ |
| 484 | 'label' => esc_html__( 'Margin', 'elementskit-lite' ), |
| 485 | 'type' => Controls_Manager::DIMENSIONS, |
| 486 | 'size_units' => [ 'px', '%', 'em' ], |
| 487 | 'selectors' => [ |
| 488 | '{{WRAPPER}} .tab__post--title' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 489 | ], |
| 490 | ] |
| 491 | ); |
| 492 | |
| 493 | $this->end_controls_section(); |
| 494 | |
| 495 | $this->insert_pro_message(); |
| 496 | } |
| 497 | |
| 498 | protected function render( ) { |
| 499 | echo '<div class="ekit-wid-con" >'; |
| 500 | $this->render_raw(); |
| 501 | echo '</div>'; |
| 502 | } |
| 503 | |
| 504 | protected function render_raw( ) { |
| 505 | $settings = $this->get_settings_for_display(); |
| 506 | extract($settings); if(empty($post_cat)){return false;}; |
| 507 | $posttab_uid = uniqid(); |
| 508 | // Link mode renders the headers as real archive links (navigation), so |
| 509 | // tab semantics only apply to the default span-based switcher. |
| 510 | $posttab_is_link = ( isset( $settings['ekit_post_tab_on_click_link_archive'] ) && $settings['ekit_post_tab_on_click_link_archive'] === 'yes' ); |
| 511 | ?> |
| 512 | <div class="ekit-post-tab post--tab hover--active <?php echo !empty($image_disable_hover_effect) && $image_disable_hover_effect == 'yes' ? 'disbale-hover' : ''; ?>"> |
| 513 | <div class="tabHeader"> |
| 514 | <div class="tab__list"<?php echo $posttab_is_link ? '' : ' role="tablist"'; ?>> |
| 515 | <?php $i=1; foreach($post_cat as $cat): |
| 516 | $categoryURL = get_category_link($cat); |
| 517 | ?> |
| 518 | <?php if ($posttab_is_link) { ?> |
| 519 | <a href="<?php echo esc_url( $categoryURL ); ?>" class="<?php echo ($i==1)? 'active': ''; ?> tab__list__item"> |
| 520 | <?php echo esc_html(get_cat_name($cat));?> |
| 521 | </a> |
| 522 | <?php } else { ?> |
| 523 | <span class="<?php echo ($i==1)? 'active': ''; ?> tab__list__item" role="tab" id="ekit-posttab-<?php echo esc_attr($posttab_uid); ?>-tab-<?php echo esc_attr($i); ?>" tabindex="0" aria-selected="<?php echo ($i==1) ? 'true' : 'false'; ?>" aria-controls="ekit-posttab-<?php echo esc_attr($posttab_uid); ?>-panel-<?php echo esc_attr($i); ?>"> |
| 524 | <?php echo esc_html(get_cat_name($cat));?> |
| 525 | </span> |
| 526 | <?php }; ?> |
| 527 | <?php $i++; endforeach; ?> |
| 528 | </div> |
| 529 | </div> |
| 530 | <div class="ekit--tab__post__details tabContent"> |
| 531 | <?php $j=1; foreach($post_cat as $cat): |
| 532 | |
| 533 | $query = array( |
| 534 | 'post_type' => 'post', |
| 535 | 'post_status' => 'publish', |
| 536 | 'cat' => $cat, |
| 537 | 'posts_per_page' => $post_count, |
| 538 | ); |
| 539 | |
| 540 | $count_col_tablet = isset( $settings['count_col_tablet'] ) ? $settings['count_col_tablet'] : ''; |
| 541 | $count_col_mobile = isset( $settings['count_col_mobile'] ) ? $settings['count_col_mobile'] : ''; |
| 542 | |
| 543 | $this->add_render_attribute( |
| 544 | [ |
| 545 | 'ekit-single-item' => [ |
| 546 | 'class' => [ |
| 547 | 'tab__post__single--item', |
| 548 | $count_col, |
| 549 | 'tablet-' . $count_col_tablet, |
| 550 | 'mobile-' . $count_col_mobile, |
| 551 | 'post-count-' . $post_count |
| 552 | ], |
| 553 | ], |
| 554 | ] |
| 555 | ); |
| 556 | ?> |
| 557 | <div class="tabItem <?php echo ($j==1)? 'active': ''; ?>"<?php echo $posttab_is_link ? '' : ' role="tabpanel" id="ekit-posttab-' . esc_attr($posttab_uid) . '-panel-' . esc_attr($j) . '" aria-labelledby="ekit-posttab-' . esc_attr($posttab_uid) . '-tab-' . esc_attr($j) . '" tabindex="0"'; ?>> |
| 558 | <?php $xs_query = new \WP_Query( $query ); |
| 559 | if($xs_query->have_posts()): |
| 560 | while ($xs_query->have_posts()) : |
| 561 | $xs_query->the_post(); |
| 562 | ?> |
| 563 | <?php if(has_post_thumbnail()): ?> |
| 564 | <div <?php echo $this->get_render_attribute_string('ekit-single-item'); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Already escaped by elementor ?>> |
| 565 | <div class="tab__post__single--inner"> |
| 566 | <a href="<?php echo esc_url(get_the_permalink()); ?>" class="tab__post--header" aria-label="<?php echo esc_attr( get_the_title() ); ?>"> |
| 567 | <?php the_post_thumbnail(); ?> |
| 568 | </a> |
| 569 | <h3 class="tab__post--title"><a href="<?php echo esc_url(get_the_permalink()); ?>"><?php the_title(); ?></a></h3> |
| 570 | </div> |
| 571 | </div> |
| 572 | <?php endif; ?> |
| 573 | <?php endwhile; |
| 574 | endif; |
| 575 | wp_reset_postdata(); ?> |
| 576 | <div class="clearfix"></div> |
| 577 | </div> |
| 578 | <?php $j++; endforeach; ?> |
| 579 | </div> |
| 580 | </div> |
| 581 | |
| 582 | <?php |
| 583 | } |
| 584 | } |
| 585 |