templates
4 months ago
Accordion.php
9 months ago
Alerts_Box.php
9 months ago
Blog_Grid.php
6 months ago
Cheat_Sheet.php
6 months ago
Counter.php
6 months ago
Dynamic_Faq.php
1 month ago
Icon_Box.php
6 months ago
Integrations.php
6 months ago
List_Item.php
9 months ago
Tabs.php
6 months ago
Team_Carousel.php
6 months ago
Testimonial.php
6 months ago
Timeline.php
9 months ago
Video_Playlist.php
6 months ago
Video_Popup.php
6 months ago
Blog_Grid.php
1537 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Use namespace to avoid conflict |
| 4 | */ |
| 5 | |
| 6 | namespace SPEL\Widgets; |
| 7 | |
| 8 | use Elementor\Widget_Base; |
| 9 | use Elementor\Controls_Manager; |
| 10 | use Elementor\Group_Control_Typography; |
| 11 | // Exit if accessed directly |
| 12 | if ( ! defined( 'ABSPATH' ) ) { |
| 13 | exit; |
| 14 | } |
| 15 | |
| 16 | |
| 17 | /** |
| 18 | * Blog Grid |
| 19 | * |
| 20 | * Elementor widget for Blog Grid. |
| 21 | * |
| 22 | * @since 1.7.0 |
| 23 | */ |
| 24 | class Blog_Grid extends Widget_Base { |
| 25 | |
| 26 | public static function get_taxonomies( $cate = 'post', $type = 0 ) { |
| 27 | $post_cat = self::_get_terms( $cate ); |
| 28 | |
| 29 | $tag = isset( $post_cat[ $type ] ) && ! empty( $post_cat[ $type ] ) ? $post_cat[ $type ] : 'category'; |
| 30 | $terms = get_terms( array( |
| 31 | 'taxonomy' => $tag, |
| 32 | 'orderby' => 'name', |
| 33 | 'order' => 'DESC', |
| 34 | 'hide_empty' => false, |
| 35 | 'number' => 1500 |
| 36 | ) ); |
| 37 | |
| 38 | return $terms; |
| 39 | } |
| 40 | |
| 41 | public function get_name() { |
| 42 | return 'docy_blog_grid'; // ID of the widget (Don't change this name) |
| 43 | } |
| 44 | |
| 45 | public function get_title() { |
| 46 | return esc_html__( 'Blog Grid', 'spider-elements' ); |
| 47 | } |
| 48 | |
| 49 | public function get_icon() { |
| 50 | return 'eicon-post spel-icon'; |
| 51 | } |
| 52 | |
| 53 | public function get_categories() { |
| 54 | return [ 'spider-elements' ]; |
| 55 | } |
| 56 | |
| 57 | /** |
| 58 | * Name: get_style_depends() |
| 59 | * Desc: Register the required CSS dependencies for the frontend. |
| 60 | */ |
| 61 | public function get_style_depends() { |
| 62 | return [ 'slick', 'slick-theme', 'spel-main' ]; |
| 63 | } |
| 64 | |
| 65 | /** |
| 66 | * Name: get_script_depends() |
| 67 | * Desc: Register the required JS dependencies for the frontend. |
| 68 | */ |
| 69 | public function get_script_depends() { |
| 70 | return [ 'slick', 'spel-el-widgets' ]; |
| 71 | } |
| 72 | |
| 73 | /** |
| 74 | * Name: register_controls() |
| 75 | * Desc: Register controls for these widgets |
| 76 | * Params: no params |
| 77 | * Return: @void |
| 78 | * Since: @1.0.0 |
| 79 | * Package: @spider-elements |
| 80 | * Author: spider-themes |
| 81 | */ |
| 82 | protected function register_controls() { |
| 83 | $this->elementor_layout_setting(); |
| 84 | $this->elementor_post_setting(); |
| 85 | //style section |
| 86 | $this->elementor_blog_style_section(); |
| 87 | |
| 88 | } |
| 89 | |
| 90 | /** |
| 91 | * Name: elementor_layout_setting() |
| 92 | * Desc: Register the Content Tab output on the Elementor editor. |
| 93 | * Params: no params |
| 94 | * Return: @void |
| 95 | * Since: @1.0.0 |
| 96 | * Package: @spider-elements |
| 97 | * Author: spider-themes |
| 98 | */ |
| 99 | public function elementor_layout_setting() { |
| 100 | |
| 101 | //============================= Filter Options =================================== // |
| 102 | $this->start_controls_section( |
| 103 | 'blog_layout', [ |
| 104 | 'label' => esc_html__( 'Layout', 'spider-elements' ), |
| 105 | ] |
| 106 | ); |
| 107 | |
| 108 | // Style |
| 109 | $this->add_control( |
| 110 | 'style', [ |
| 111 | 'label' => esc_html__( 'Skin', 'spider-elements' ), |
| 112 | 'type' => Controls_Manager::CHOOSE, |
| 113 | 'options' => [ |
| 114 | '1' => [ |
| 115 | 'title' => esc_html__( 'Style 01', 'spider-elements' ), |
| 116 | 'icon' => 'blog_1', |
| 117 | ], |
| 118 | '2' => [ |
| 119 | 'title' => esc_html__( 'Style 02', 'spider-elements' ), |
| 120 | 'icon' => 'blog_2', |
| 121 | ], |
| 122 | '3' => [ |
| 123 | 'title' => esc_html__( 'Style 03', 'spider-elements' ), |
| 124 | 'icon' => 'blog_3', |
| 125 | ], |
| 126 | '4' => [ |
| 127 | 'title' => esc_html__( 'Style 04', 'spider-elements' ), |
| 128 | 'icon' => 'blog_4', |
| 129 | ], |
| 130 | '5' => [ |
| 131 | 'title' => esc_html__( 'Blog Carousel 05', 'spider-elements' ), |
| 132 | 'icon' => 'blog_5', |
| 133 | ], |
| 134 | ], |
| 135 | 'toggle' => false, |
| 136 | 'default' => '1', |
| 137 | ] |
| 138 | ); |
| 139 | |
| 140 | $this->add_control( |
| 141 | 'column_grid', [ |
| 142 | 'label' => esc_html__( 'Column', 'spider-elements' ), |
| 143 | 'type' => Controls_Manager::SELECT, |
| 144 | 'options' => [ |
| 145 | '6' => esc_html__( 'Two Column', 'spider-elements' ), |
| 146 | '4' => esc_html__( 'Three Column', 'spider-elements' ), |
| 147 | '3' => esc_html__( 'Four Column', 'spider-elements' ), |
| 148 | '2' => esc_html__( 'Six Column', 'spider-elements' ), |
| 149 | ], |
| 150 | 'default' => '4 ', |
| 151 | 'condition' => [ |
| 152 | 'style' => [ '1', '2', '3', '4', ], |
| 153 | 'style!' => [ '5' ] |
| 154 | ] |
| 155 | ] |
| 156 | ); |
| 157 | |
| 158 | $this->add_control( |
| 159 | 'pagination_switcher', [ |
| 160 | 'label' => esc_html__( 'Pagination', 'spider-elements' ), |
| 161 | 'type' => Controls_Manager::SWITCHER, |
| 162 | 'label_on' => esc_html__( 'Show', 'spider-elements' ), |
| 163 | 'label_off' => esc_html__( 'Hide', 'spider-elements' ), |
| 164 | 'return_value' => 'yes', |
| 165 | 'default' => 'yes', |
| 166 | 'condition' => [ |
| 167 | 'style' => ['1', '2', '3', '4', ], |
| 168 | 'style!' => [ '5' ] |
| 169 | ] |
| 170 | ] |
| 171 | ); |
| 172 | |
| 173 | $this->end_controls_section(); //End Filter |
| 174 | |
| 175 | // arrow icon control section |
| 176 | $this->start_controls_section( |
| 177 | 'arrow_icon_section', [ |
| 178 | 'label' => esc_html__( 'Arrow Icon', 'spider-elements' ), |
| 179 | 'condition' => [ |
| 180 | 'style' => [ '5' ], |
| 181 | 'style!' => [ '1', '2', '3', '4', ] |
| 182 | ] |
| 183 | ] |
| 184 | ); |
| 185 | |
| 186 | $this->add_control( |
| 187 | 'left_arrow_icon', [ |
| 188 | 'label' => esc_html__( 'Left Icon', 'spider-elements' ), |
| 189 | 'type' => Controls_Manager::ICONS, |
| 190 | 'label_block' => true, |
| 191 | 'default' => [ |
| 192 | 'value' => 'arrow_carrot-left', |
| 193 | 'library' => 'ElegantIcons', |
| 194 | ], |
| 195 | ] |
| 196 | ); |
| 197 | |
| 198 | $this->add_control( |
| 199 | 'right_arrow_icon', [ |
| 200 | 'label' => esc_html__( 'Right Icon', 'spider-elements' ), |
| 201 | 'type' => Controls_Manager::ICONS, |
| 202 | 'default' => [ |
| 203 | 'value' => 'arrow_carrot-right', |
| 204 | 'library' => 'ElegantIcons', |
| 205 | ], |
| 206 | ] |
| 207 | ); |
| 208 | |
| 209 | $this->end_controls_section(); |
| 210 | |
| 211 | } |
| 212 | |
| 213 | /** |
| 214 | * Name: elementor_post_setting() |
| 215 | * Desc: Register the Content Tab output on the Elementor editor. |
| 216 | * Params: no params |
| 217 | * Return: @void |
| 218 | * Since: @1.0.0 |
| 219 | * Package: @spider-elements |
| 220 | * Author: spider-themes |
| 221 | */ |
| 222 | |
| 223 | public function elementor_post_setting() { |
| 224 | |
| 225 | $this->start_controls_section( |
| 226 | 'settings_section', |
| 227 | [ |
| 228 | 'label' => esc_html__( 'Query Settings', 'spider-elements' ), |
| 229 | 'tab' => \Elementor\Controls_Manager::TAB_CONTENT, |
| 230 | ] |
| 231 | ); |
| 232 | $this->add_control( |
| 233 | 'blog_queryby', [ |
| 234 | 'label' => esc_html__( 'Query by', 'spider-elements' ), |
| 235 | 'type' => \Elementor\Controls_Manager::CHOOSE, |
| 236 | 'options' => apply_filters( 'blog_query_by', [ |
| 237 | 'all' => [ |
| 238 | 'title' => esc_html__( 'All', 'spider-elements' ), |
| 239 | 'icon' => 'fas fa-border-none', |
| 240 | ], |
| 241 | 'categories' => [ |
| 242 | 'title' => esc_html__( 'By Categories', 'spider-elements' ), |
| 243 | 'icon' => 'eicon-product-categories', |
| 244 | ], |
| 245 | 'posts' => [ |
| 246 | 'title' => esc_html__( 'By Posts', 'spider-elements' ), |
| 247 | 'icon' => 'eicon-post-list', |
| 248 | ], |
| 249 | 'postype' => [ |
| 250 | 'title' => esc_html__( 'By Posttype', 'spider-elements' ), |
| 251 | 'icon' => 'eicon-editor-list-ul', |
| 252 | ], |
| 253 | |
| 254 | ] ), |
| 255 | 'default' => 'all', |
| 256 | |
| 257 | ] |
| 258 | ); |
| 259 | |
| 260 | $this->add_control( |
| 261 | 'blog_bycategories', |
| 262 | [ |
| 263 | 'label' => esc_html__( 'By Categories', 'spider-elements' ), |
| 264 | 'type' => \Elementor\Controls_Manager::HEADING, |
| 265 | 'condition' => [ |
| 266 | 'blog_queryby' => [ 'categories' ] |
| 267 | ], |
| 268 | ] |
| 269 | ); |
| 270 | |
| 271 | $this->add_control( |
| 272 | 'blog_categories', |
| 273 | [ |
| 274 | 'label' => esc_html__( 'Select Categories', 'spider-elements' ), |
| 275 | 'type' => \Elementor\Controls_Manager::SELECT2, |
| 276 | 'multiple' => true, |
| 277 | 'options' => self::get_category(), |
| 278 | 'default' => [], |
| 279 | 'condition' => [ |
| 280 | 'blog_queryby' => [ 'categories' ] |
| 281 | ], |
| 282 | ] |
| 283 | ); |
| 284 | |
| 285 | $this->add_control( |
| 286 | 'blog_byposts', |
| 287 | [ |
| 288 | 'label' => esc_html__( 'By Posts', 'spider-elements' ), |
| 289 | 'type' => \Elementor\Controls_Manager::HEADING, |
| 290 | 'condition' => [ |
| 291 | 'blog_queryby' => [ 'posts' ] |
| 292 | ], |
| 293 | ] |
| 294 | ); |
| 295 | |
| 296 | $this->add_control( |
| 297 | 'blog_post', |
| 298 | [ |
| 299 | 'label' => esc_html__( 'Select Posts', 'spider-elements' ), |
| 300 | 'type' => \Elementor\Controls_Manager::SELECT2, |
| 301 | 'multiple' => true, |
| 302 | 'options' => self::get_posts(), |
| 303 | 'default' => [], |
| 304 | 'condition' => [ |
| 305 | 'blog_queryby' => [ 'posts' ] |
| 306 | ], |
| 307 | ] |
| 308 | ); |
| 309 | |
| 310 | $this->add_control( |
| 311 | 'blog_byposttype', |
| 312 | [ |
| 313 | 'label' => esc_html__( 'By Posttype', 'spider-elements' ), |
| 314 | 'type' => \Elementor\Controls_Manager::HEADING, |
| 315 | 'condition' => [ |
| 316 | 'blog_queryby' => [ 'postype' ] |
| 317 | ], |
| 318 | ] |
| 319 | ); |
| 320 | |
| 321 | $this->add_control( |
| 322 | 'blog_posttype', |
| 323 | [ |
| 324 | 'label' => esc_html__( 'Select Postype', 'spider-elements' ), |
| 325 | 'type' => \Elementor\Controls_Manager::SELECT2, |
| 326 | 'multiple' => true, |
| 327 | 'options' => self::get_posttype(), |
| 328 | 'default' => [], |
| 329 | 'condition' => [ |
| 330 | 'blog_queryby' => [ 'postype' ] |
| 331 | ], |
| 332 | ] |
| 333 | ); |
| 334 | |
| 335 | $this->add_control( |
| 336 | 'blog_otherquery', |
| 337 | [ |
| 338 | 'label' => esc_html__( 'Others Filter', 'spider-elements' ), |
| 339 | 'type' => \Elementor\Controls_Manager::HEADING, |
| 340 | 'separator' => 'before', |
| 341 | ] |
| 342 | ); |
| 343 | |
| 344 | $this->add_control( |
| 345 | 'blog_order_by', |
| 346 | [ |
| 347 | 'label' => esc_html__( 'Order by', 'spider-elements' ), |
| 348 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 349 | 'options' => [ |
| 350 | 'date' => esc_html__( 'Date', 'spider-elements' ), |
| 351 | 'title' => esc_html__( 'Title', 'spider-elements' ), |
| 352 | 'author' => esc_html__( 'Author', 'spider-elements' ), |
| 353 | 'comment_count' => esc_html__( 'Comments', 'spider-elements' ), |
| 354 | ], |
| 355 | 'default' => 'date', |
| 356 | ] |
| 357 | ); |
| 358 | |
| 359 | $this->add_control( |
| 360 | 'blog_order', |
| 361 | [ |
| 362 | 'label' => esc_html__( 'Order', 'spider-elements' ), |
| 363 | 'type' => \Elementor\Controls_Manager::SELECT, |
| 364 | 'options' => [ |
| 365 | 'ASC' => esc_html__( 'ASC', 'spider-elements' ), |
| 366 | 'DESC' => esc_html__( 'DESC', 'spider-elements' ), |
| 367 | ], |
| 368 | 'default' => 'DESC', |
| 369 | ] |
| 370 | ); |
| 371 | |
| 372 | $this->add_control( |
| 373 | 'blog_offset', |
| 374 | [ |
| 375 | 'label' => esc_html__( 'Offset', 'spider-elements' ), |
| 376 | 'type' => \Elementor\Controls_Manager::NUMBER, |
| 377 | 'min' => 0, |
| 378 | 'max' => 15, |
| 379 | 'default' => 0, |
| 380 | ] |
| 381 | ); |
| 382 | |
| 383 | $this->add_control( |
| 384 | 'blog_limit', |
| 385 | [ |
| 386 | 'label' => esc_html__( 'Limit Display', 'spider-elements' ), |
| 387 | 'type' => \Elementor\Controls_Manager::NUMBER, |
| 388 | 'min' => 1, |
| 389 | 'max' => 100, |
| 390 | 'default' => 5, |
| 391 | ] |
| 392 | ); |
| 393 | $this->add_control( |
| 394 | 'content_limit', |
| 395 | [ |
| 396 | 'label' => esc_html__( 'Content Limit Display', 'spider-elements' ), |
| 397 | 'type' => \Elementor\Controls_Manager::NUMBER, |
| 398 | 'min' => 1, |
| 399 | 'max' => 100, |
| 400 | 'default' => 11, |
| 401 | 'condition' => [ |
| 402 | 'style' => [ '2' ] |
| 403 | ] |
| 404 | ] |
| 405 | ); |
| 406 | |
| 407 | $this->add_control( |
| 408 | 'title_length', [ |
| 409 | 'label' => esc_html__( 'Title Length', 'spider-elements' ), |
| 410 | 'type' => Controls_Manager::NUMBER, |
| 411 | 'default' => 8 |
| 412 | ] |
| 413 | ); |
| 414 | |
| 415 | $this->end_controls_section(); |
| 416 | } |
| 417 | |
| 418 | public static function get_category( $cate = 'post' ) { |
| 419 | $post_cat = self::_get_terms( $cate ); |
| 420 | |
| 421 | $taxonomy = isset( $post_cat[0] ) && ! empty( $post_cat[0] ) ? $post_cat[0] : [ 'category' ]; |
| 422 | $query_args = [ |
| 423 | 'taxonomy' => $taxonomy, |
| 424 | 'orderby' => 'name', |
| 425 | 'order' => 'DESC', |
| 426 | 'hide_empty' => false, |
| 427 | 'number' => 1500 |
| 428 | ]; |
| 429 | $terms = get_terms( $query_args ); |
| 430 | |
| 431 | $options = []; |
| 432 | $count = count( (array) $terms ); |
| 433 | if ( $count > 0 ): |
| 434 | foreach ( $terms as $term ) { |
| 435 | if ( $term->parent == 0 ) { |
| 436 | $options[ $term->term_id ] = $term->name; |
| 437 | foreach ( $terms as $subcategory ) { |
| 438 | if ( $subcategory->parent == $term->term_id ) { |
| 439 | $options[ $subcategory->term_id ] = $subcategory->name; |
| 440 | } |
| 441 | } |
| 442 | } |
| 443 | } |
| 444 | endif; |
| 445 | |
| 446 | return $options; |
| 447 | } |
| 448 | |
| 449 | public static function _get_terms( $post = 'post' ) { |
| 450 | $taxonomy_objects = get_object_taxonomies( $post ); |
| 451 | |
| 452 | return $taxonomy_objects; |
| 453 | } |
| 454 | |
| 455 | public static function get_posts() { |
| 456 | $post_args = get_posts( |
| 457 | array( |
| 458 | 'posts_per_page' => - 1, |
| 459 | 'post_status' => 'publish', |
| 460 | ) |
| 461 | ); |
| 462 | |
| 463 | $posts = get_posts( $post_args ); |
| 464 | $posts_list = []; |
| 465 | if ( is_array( $posts ) ) { |
| 466 | foreach ( $posts as $_key => $object ) { |
| 467 | $posts_list[ $object->ID ] = $object->post_title; |
| 468 | } |
| 469 | } |
| 470 | |
| 471 | return $posts_list; |
| 472 | } |
| 473 | |
| 474 | public static function get_posttype() { |
| 475 | $post_types = get_post_types( |
| 476 | array( |
| 477 | 'public' => true, |
| 478 | ), |
| 479 | 'objects' |
| 480 | ); |
| 481 | |
| 482 | $options = array(); |
| 483 | |
| 484 | if ( is_array( $post_types ) ) { |
| 485 | foreach ( $post_types as $post_type ) { |
| 486 | $options[ $post_type->name ] = $post_type->label; |
| 487 | } |
| 488 | } |
| 489 | |
| 490 | return $options; |
| 491 | } |
| 492 | |
| 493 | /** |
| 494 | * Name: elementor_blog_style_section() |
| 495 | * Desc: Register the Content Tab output on the Elementor editor. |
| 496 | * Params: no params |
| 497 | * Return: @void |
| 498 | * Since: @1.0.0 |
| 499 | * Package: @spider-elements |
| 500 | * Author: spider-themes |
| 501 | */ |
| 502 | public function elementor_blog_style_section() { |
| 503 | $this->blog_general_style(); |
| 504 | $this->blog_image_style(); |
| 505 | $this->blog_content_style(); |
| 506 | $this->button_style(); |
| 507 | $this->meta_style(); |
| 508 | $this->icon_style(); |
| 509 | } |
| 510 | |
| 511 | public function blog_general_style() { |
| 512 | $this->start_controls_section( |
| 513 | 'blog_general_styles', |
| 514 | [ |
| 515 | 'label' => esc_html__( 'Blog Item', 'spider-elements' ), |
| 516 | 'tab' => \Elementor\Controls_Manager::TAB_STYLE, |
| 517 | ] |
| 518 | ); |
| 519 | |
| 520 | |
| 521 | $this->start_controls_tabs( |
| 522 | 'blog_style_tabs', |
| 523 | [ |
| 524 | 'condition' => [ |
| 525 | 'style' => [ '1', '2', '3', '4', ], |
| 526 | 'style!' => [ '5' ] |
| 527 | ] |
| 528 | ] |
| 529 | ); |
| 530 | |
| 531 | $this->start_controls_tab( |
| 532 | 'blog_style_normal_tab', |
| 533 | [ |
| 534 | 'label' => esc_html__( 'Normal', 'spider-elements' ), |
| 535 | ] |
| 536 | ); |
| 537 | |
| 538 | $this->add_group_control( |
| 539 | \Elementor\Group_Control_Background::get_type(), |
| 540 | [ |
| 541 | 'name' => 'background', |
| 542 | 'types' => [ 'classic', 'gradient' ], |
| 543 | 'exclude' => [ 'image' ], |
| 544 | 'selector' => '{{WRAPPER}} .blog-meta-two, |
| 545 | {{WRAPPER}} .blog-meta-one', |
| 546 | ] |
| 547 | ); |
| 548 | |
| 549 | $this->end_controls_tab(); |
| 550 | |
| 551 | $this->start_controls_tab( |
| 552 | 'blog_style_hover_tab', |
| 553 | [ |
| 554 | 'label' => esc_html__( 'Hover', 'spider-elements' ), |
| 555 | ] |
| 556 | ); |
| 557 | |
| 558 | $this->add_group_control( |
| 559 | \Elementor\Group_Control_Background::get_type(), |
| 560 | [ |
| 561 | 'name' => 'hover_background', |
| 562 | 'types' => [ 'classic', 'gradient' ], |
| 563 | 'exclude' => [ 'image' ], |
| 564 | 'selector' => '{{WRAPPER}} .blog-meta-two:hover, |
| 565 | {{WRAPPER}} .blog-meta-one:hover', |
| 566 | ] |
| 567 | ); |
| 568 | |
| 569 | $this->end_controls_tab(); |
| 570 | |
| 571 | $this->end_controls_tabs(); |
| 572 | |
| 573 | $this->add_responsive_control( |
| 574 | 'blog_margin', |
| 575 | [ |
| 576 | 'label' => esc_html__( 'Margin', 'spider-elements' ), |
| 577 | 'type' => Controls_Manager::DIMENSIONS, |
| 578 | 'size_units' => [ 'px' ], |
| 579 | 'separator' => 'before', |
| 580 | 'range' => [ |
| 581 | 'px' => [ |
| 582 | 'min' => - 100, |
| 583 | 'max' => 100, |
| 584 | 'step' => 5, |
| 585 | ], |
| 586 | ], |
| 587 | 'default' => [ |
| 588 | 'unit' => 'px', |
| 589 | 'size' => 10, |
| 590 | ], |
| 591 | 'selectors' => [ |
| 592 | '{{WRAPPER}} .blog-grid' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 593 | ], |
| 594 | 'condition' => [ |
| 595 | 'style' => [ '1', '2', '3', '4', ], |
| 596 | 'style!' => [ '5' ] |
| 597 | ] |
| 598 | ] |
| 599 | ); |
| 600 | |
| 601 | $this->add_responsive_control( |
| 602 | 'blog_item_padding', |
| 603 | [ |
| 604 | 'label' => esc_html__( 'Padding', 'spider-elements' ), |
| 605 | 'type' => Controls_Manager::DIMENSIONS, |
| 606 | 'size_units' => [ 'px' ], |
| 607 | 'range' => [ |
| 608 | 'px' => [ |
| 609 | 'min' => - 100, |
| 610 | 'max' => 100, |
| 611 | 'step' => 5, |
| 612 | ], |
| 613 | ], |
| 614 | 'default' => [ |
| 615 | 'unit' => 'px', |
| 616 | 'size' => 10, |
| 617 | ], |
| 618 | 'selectors' => [ |
| 619 | '{{WRAPPER}} .blog-meta-two' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 620 | '{{WRAPPER}} .blog-meta-one' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 621 | '{{WRAPPER}} .card-style-six .blog-item-six' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 622 | ], |
| 623 | ] |
| 624 | ); |
| 625 | |
| 626 | $this->add_responsive_control( |
| 627 | 'blog_item_radius', |
| 628 | [ |
| 629 | 'label' => esc_html__( 'Border Radius', 'spider-elements' ), |
| 630 | 'type' => Controls_Manager::DIMENSIONS, |
| 631 | 'size_units' => [ 'px' ], |
| 632 | 'selectors' => [ |
| 633 | '{{WRAPPER}} .blog-meta-two' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 634 | '{{WRAPPER}} .blog-meta-one' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 635 | ], |
| 636 | 'condition' => [ |
| 637 | 'style' => [ '1', '2', '3', '4', ], |
| 638 | 'style!' => [ '5' ] |
| 639 | ] |
| 640 | ] |
| 641 | ); |
| 642 | |
| 643 | $this->end_controls_section(); |
| 644 | } |
| 645 | |
| 646 | //============ Start Image Style Control Section ================// |
| 647 | public function blog_image_style() { |
| 648 | $this->start_controls_section( |
| 649 | 'blog_image_tab', |
| 650 | [ |
| 651 | 'label' => esc_html__( 'Image', 'spider-elements' ), |
| 652 | 'tab' => \Elementor\Controls_Manager::TAB_STYLE, |
| 653 | 'condition' => [ |
| 654 | 'style' => [ '1', '2', '3', '4' ] |
| 655 | ] |
| 656 | ] |
| 657 | ); |
| 658 | |
| 659 | $this->add_responsive_control( |
| 660 | 'blog_img_radius', |
| 661 | [ |
| 662 | 'label' => esc_html__( 'Border Radius', 'spider-elements' ), |
| 663 | 'type' => Controls_Manager::DIMENSIONS, |
| 664 | 'size_units' => [ 'px' ], |
| 665 | 'selectors' => [ |
| 666 | '{{WRAPPER}} .blog-meta-two .post-img' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 667 | '{{WRAPPER}} .blog-meta-one .post-img' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 668 | ], |
| 669 | ] |
| 670 | ); |
| 671 | |
| 672 | $this->add_responsive_control( |
| 673 | 'blog_img_margin', |
| 674 | [ |
| 675 | 'label' => esc_html__( 'Margin Bottom', 'spider-elements' ), |
| 676 | 'description' => esc_html__( 'Spacing between the image', 'spider-elements' ), |
| 677 | 'type' => Controls_Manager::SLIDER, |
| 678 | 'size_units' => [ 'px', '%', 'em', 'rem', 'vw', 'custom' ], |
| 679 | 'range' => [ |
| 680 | 'px' => [ |
| 681 | 'max' => 250, |
| 682 | ], |
| 683 | 'em' => [ |
| 684 | 'max' => 0, |
| 685 | ], |
| 686 | ], |
| 687 | 'selectors' => [ |
| 688 | '{{WRAPPER}} .blog-meta-two .post-img' => 'margin-bottom: {{SIZE}}{{UNIT}} !important;', |
| 689 | '{{WRAPPER}} .blog-meta-one .post-img' => 'margin-bottom: {{SIZE}}{{UNIT}};', |
| 690 | ], |
| 691 | 'condition' => [ |
| 692 | 'style' => [ '1', '2', '3', '4' ], |
| 693 | 'style!' => [ '5' ] |
| 694 | ], |
| 695 | ] |
| 696 | ); |
| 697 | |
| 698 | $this->end_controls_section(); |
| 699 | } |
| 700 | |
| 701 | |
| 702 | //============ Start Content Section Control============ |
| 703 | public function blog_content_style() { |
| 704 | |
| 705 | $this->start_controls_section( |
| 706 | 'blog_content_tab', |
| 707 | [ |
| 708 | 'label' => esc_html__( 'Contents', 'spider-elements' ), |
| 709 | 'tab' => \Elementor\Controls_Manager::TAB_STYLE, |
| 710 | ] |
| 711 | ); |
| 712 | |
| 713 | $this->start_controls_tabs( |
| 714 | 'style_blog_title_tabs' |
| 715 | ); |
| 716 | |
| 717 | //=== blog Normal icon |
| 718 | $this->start_controls_tab( |
| 719 | 'style_blog_title_normal', |
| 720 | [ |
| 721 | 'label' => esc_html__( 'Normal', 'spider-elements' ), |
| 722 | ] |
| 723 | ); |
| 724 | |
| 725 | $this->add_control( |
| 726 | 'blog_title_options', [ |
| 727 | 'label' => esc_html__( 'Title', 'spider-elements' ), |
| 728 | 'type' => Controls_Manager::HEADING, |
| 729 | ] |
| 730 | ); |
| 731 | |
| 732 | $this->add_group_control( |
| 733 | Group_Control_Typography::get_type(), |
| 734 | [ |
| 735 | 'name' => 'blog_content_title', |
| 736 | 'selector' => '{{WRAPPER}} .blog-meta-two .blog-title, |
| 737 | {{WRAPPER}} .blog-meta-one .blog-title, |
| 738 | {{WRAPPER}} .blog-six-title', |
| 739 | ] |
| 740 | ); |
| 741 | |
| 742 | $this->add_control( |
| 743 | 'blog_title_color', |
| 744 | [ |
| 745 | 'label' => esc_html__( 'Color', 'spider-elements' ), |
| 746 | 'type' => Controls_Manager::COLOR, |
| 747 | 'default' => '', |
| 748 | 'selectors' => [ |
| 749 | '{{WRAPPER}} .blog-meta-two .blog-title' => 'color: {{VALUE}};', |
| 750 | '{{WRAPPER}} .blog-meta-one .blog-title' => 'color: {{VALUE}};', |
| 751 | '{{WRAPPER}} .blog-six-title' => 'color: {{VALUE}};', |
| 752 | ], |
| 753 | ] |
| 754 | ); |
| 755 | |
| 756 | $this->add_responsive_control( |
| 757 | 'blog_title_margin', |
| 758 | [ |
| 759 | 'label' => esc_html__( 'Margin', 'spider-elements' ), |
| 760 | 'type' => Controls_Manager::DIMENSIONS, |
| 761 | 'size_units' => [ 'px' ], |
| 762 | 'range' => [ |
| 763 | 'px' => [ |
| 764 | 'min' => - 100, |
| 765 | 'max' => 100, |
| 766 | 'step' => 5, |
| 767 | ], |
| 768 | ], |
| 769 | 'default' => [ |
| 770 | 'unit' => 'px', |
| 771 | 'size' => 10, |
| 772 | ], |
| 773 | 'selectors' => [ |
| 774 | '{{WRAPPER}} .blog-meta-two .blog-title' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 775 | '{{WRAPPER}} .blog-meta-one .blog-title' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 776 | ], |
| 777 | 'condition' => [ |
| 778 | 'style' => [ '1', '2', '3', '4', ], |
| 779 | 'style!' => [ '5' ] |
| 780 | ] |
| 781 | ] |
| 782 | ); |
| 783 | |
| 784 | $this->end_controls_tab(); //End Normal title |
| 785 | |
| 786 | //=== Hover icon==== |
| 787 | $this->start_controls_tab( |
| 788 | 'blog_hover_title', [ |
| 789 | 'label' => esc_html__( 'Hover', 'spider-elements' ), |
| 790 | ] |
| 791 | ); |
| 792 | |
| 793 | $this->add_control( |
| 794 | 'blog_title_hover_heading', |
| 795 | [ |
| 796 | 'label' => esc_html__( 'Title', 'spider-elements' ), |
| 797 | 'type' => Controls_Manager::HEADING, |
| 798 | ] |
| 799 | ); |
| 800 | |
| 801 | $this->add_control( |
| 802 | 'blog_title_hover_color', |
| 803 | [ |
| 804 | 'label' => esc_html__( 'Color', 'spider-elements' ), |
| 805 | 'type' => Controls_Manager::COLOR, |
| 806 | 'default' => '', |
| 807 | 'selectors' => [ |
| 808 | '{{WRAPPER}} .blog-meta-two .blog-title:hover' => 'color: {{VALUE}};', |
| 809 | '{{WRAPPER}} .blog-meta-one .blog-title:hover' => 'color: {{VALUE}};', |
| 810 | '{{WRAPPER}} .blog-six-title:hover' => 'color: {{VALUE}};', |
| 811 | ], |
| 812 | ] |
| 813 | ); |
| 814 | |
| 815 | $this->end_controls_tab(); // End title hover |
| 816 | $this->end_controls_tabs(); // end normal and hover title tabs |
| 817 | |
| 818 | |
| 819 | //===============Blog Style 2, Description Style...................... |
| 820 | $this->add_control( |
| 821 | 'blog_description_options', [ |
| 822 | 'label' => esc_html__( 'Description', 'spider-elements' ), |
| 823 | 'type' => Controls_Manager::HEADING, |
| 824 | 'separator' => 'before', |
| 825 | 'condition' => [ |
| 826 | 'style' => [ '2' ], |
| 827 | 'style!' => [ '1', '3', '4', '5' ] |
| 828 | ], |
| 829 | ] |
| 830 | ); |
| 831 | |
| 832 | $this->add_group_control( |
| 833 | \Elementor\Group_Control_Typography::get_type(), |
| 834 | [ |
| 835 | 'name' => 'description_typography', |
| 836 | 'selector' => '{{WRAPPER}} .blog-meta-one p', |
| 837 | 'condition' => [ |
| 838 | 'style' => [ '2' ], |
| 839 | 'style!' => [ '1', '3', '4', '5' ] |
| 840 | ], |
| 841 | ] |
| 842 | |
| 843 | ); |
| 844 | |
| 845 | $this->add_control( |
| 846 | 'blog_description_color', |
| 847 | [ |
| 848 | 'label' => esc_html__( 'Text Color', 'spider-elements' ), |
| 849 | 'type' => Controls_Manager::COLOR, |
| 850 | 'default' => '', |
| 851 | 'selectors' => [ |
| 852 | '{{WRAPPER}} .blog-meta-one p' => 'color: {{VALUE}};', |
| 853 | ], |
| 854 | 'condition' => [ |
| 855 | 'style' => [ '2' ], |
| 856 | 'style!' => [ '1', '3', '4', '5' ] |
| 857 | ], |
| 858 | ] |
| 859 | ); |
| 860 | |
| 861 | // End // |
| 862 | |
| 863 | $this->end_controls_section(); |
| 864 | } |
| 865 | |
| 866 | |
| 867 | //===================Start Blog Grid Button Style Controls===============// |
| 868 | public function button_style() { |
| 869 | $this->start_controls_section( |
| 870 | 'blog_button_tab', |
| 871 | [ |
| 872 | 'label' => esc_html__( 'Button', 'spider-elements' ), |
| 873 | 'tab' => \Elementor\Controls_Manager::TAB_STYLE, |
| 874 | 'condition' => [ |
| 875 | 'style' => [ '1', '2', '4', ] |
| 876 | ] |
| 877 | ] |
| 878 | ); |
| 879 | |
| 880 | // ===== Button Style Tabs=====// |
| 881 | $this->start_controls_tabs( |
| 882 | 'style_btn_tabs' |
| 883 | ); |
| 884 | |
| 885 | //==== Normal ====// |
| 886 | $this->start_controls_tab( |
| 887 | 'blog_normal_btn', [ |
| 888 | 'label' => esc_html__( 'Normal', 'spider-elements' ), |
| 889 | ] |
| 890 | ); |
| 891 | |
| 892 | $this->add_group_control( |
| 893 | \Elementor\Group_Control_Typography::get_type(), |
| 894 | [ |
| 895 | 'name' => 'content_typography', |
| 896 | 'selector' => |
| 897 | '{{WRAPPER}} .blog-meta-two .continue-btn, |
| 898 | {{WRAPPER}} .blog-meta-two .read-more-btn a, |
| 899 | {{WRAPPER}} .blog-meta-one .continue-btn', |
| 900 | ] |
| 901 | ); |
| 902 | |
| 903 | $this->add_group_control( |
| 904 | \Elementor\Group_Control_Background::get_type(), |
| 905 | [ |
| 906 | 'name' => 'btn_background', |
| 907 | 'types' => [ 'classic', 'gradient' ], |
| 908 | 'exclude' => [ 'image' ], |
| 909 | 'selector' => '{{WRAPPER}} .blog-meta-two .continue-btn.btn-seven', |
| 910 | 'condition' => [ |
| 911 | 'style' => '4' |
| 912 | ], |
| 913 | ] |
| 914 | ); |
| 915 | |
| 916 | $this->add_control( |
| 917 | 'blog_button_color', |
| 918 | [ |
| 919 | 'label' => esc_html__( 'Text Color', 'spider-elements' ), |
| 920 | 'type' => Controls_Manager::COLOR, |
| 921 | 'default' => '', |
| 922 | 'selectors' => [ |
| 923 | '{{WRAPPER}} .blog-meta-two .continue-btn' => 'color: {{VALUE}};', |
| 924 | '{{WRAPPER}} .blog-meta-two .read-more-btn a' => 'color: {{VALUE}};', |
| 925 | '{{WRAPPER}} .blog-meta-one .continue-btn' => 'color: {{VALUE}};', |
| 926 | ], |
| 927 | ] |
| 928 | ); |
| 929 | |
| 930 | $this->add_responsive_control( |
| 931 | 'blog_btn_padding', |
| 932 | [ |
| 933 | 'label' => esc_html__( 'Padding', 'spider-elements' ), |
| 934 | 'type' => Controls_Manager::DIMENSIONS, |
| 935 | 'size_units' => [ 'px' ], |
| 936 | 'range' => [ |
| 937 | 'px' => [ |
| 938 | 'min' => - 100, |
| 939 | 'max' => 100, |
| 940 | 'step' => 5, |
| 941 | ], |
| 942 | ], |
| 943 | 'default' => [ |
| 944 | 'unit' => 'px', |
| 945 | 'size' => 10, |
| 946 | ], |
| 947 | 'selectors' => [ |
| 948 | '{{WRAPPER}} .blog-meta-two .continue-btn.btn-seven' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 949 | ], |
| 950 | 'condition' => [ |
| 951 | 'style' => '4' |
| 952 | ], |
| 953 | ] |
| 954 | ); |
| 955 | |
| 956 | $this->add_group_control( |
| 957 | \Elementor\Group_Control_Border::get_type(), |
| 958 | [ |
| 959 | 'name' => 'button_border_color', |
| 960 | 'label' => esc_html__( 'Border', 'spider-elements' ), |
| 961 | 'selector' => '{{WRAPPER}} .blog-meta-two .continue-btn.btn-seven', |
| 962 | 'condition' => [ |
| 963 | 'style' => '4' |
| 964 | ], |
| 965 | ] |
| 966 | ); |
| 967 | |
| 968 | $this->add_responsive_control( |
| 969 | 'button_border_radius', |
| 970 | [ |
| 971 | 'label' => esc_html__( 'Border Radius', 'spider-elements' ), |
| 972 | 'type' => Controls_Manager::DIMENSIONS, |
| 973 | 'size_units' => [ 'px' ], |
| 974 | 'selectors' => [ |
| 975 | '{{WRAPPER}} .blog-meta-two .continue-btn.btn-seven' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 976 | ], |
| 977 | 'condition' => [ |
| 978 | 'style' => '4' |
| 979 | ], |
| 980 | ] |
| 981 | ); |
| 982 | |
| 983 | $this->end_controls_tab(); |
| 984 | |
| 985 | //=== Button Hover ====// |
| 986 | $this->start_controls_tab( |
| 987 | 'blog_hover_btn', [ |
| 988 | 'label' => esc_html__( 'Hover', 'spider-elements' ), |
| 989 | ] |
| 990 | ); |
| 991 | |
| 992 | $this->add_group_control( |
| 993 | \Elementor\Group_Control_Background::get_type(), |
| 994 | [ |
| 995 | 'name' => 'btn_hover_background', |
| 996 | 'types' => [ 'classic', 'gradient' ], |
| 997 | 'exclude' => [ 'image' ], |
| 998 | 'selector' => '{{WRAPPER}} .blog-meta-two .continue-btn.btn-seven:hover', |
| 999 | 'condition' => [ |
| 1000 | 'style' => '4' |
| 1001 | ], |
| 1002 | ] |
| 1003 | ); |
| 1004 | |
| 1005 | $this->add_control( |
| 1006 | 'blog_button_hover_color', |
| 1007 | [ |
| 1008 | 'label' => esc_html__( 'Text Color', 'spider-elements' ), |
| 1009 | 'type' => Controls_Manager::COLOR, |
| 1010 | 'default' => '', |
| 1011 | 'selectors' => [ |
| 1012 | '{{WRAPPER}} .blog-meta-two .continue-btn:hover' => 'color: {{VALUE}};', |
| 1013 | '{{WRAPPER}} .blog-meta-two .read-more-btn a:hover' => 'color: {{VALUE}};', |
| 1014 | '{{WRAPPER}} .blog-meta-one .continue-btn:hover' => 'color: {{VALUE}};', |
| 1015 | ], |
| 1016 | ] |
| 1017 | ); |
| 1018 | |
| 1019 | $this->add_control( |
| 1020 | 'button_hover_border_color', |
| 1021 | [ |
| 1022 | 'label' => esc_html__( 'Border Color', 'spider-elements' ), |
| 1023 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 1024 | 'selectors' => [ |
| 1025 | '{{WRAPPER}} .blog-meta-two .continue-btn.btn-seven:hover' => 'border-color: {{VALUE}}', |
| 1026 | ], |
| 1027 | 'condition' => [ |
| 1028 | 'style' => '4' |
| 1029 | ], |
| 1030 | ] |
| 1031 | ); |
| 1032 | |
| 1033 | $this->end_controls_tab(); |
| 1034 | $this->end_controls_tabs(); |
| 1035 | $this->end_controls_section(); |
| 1036 | } |
| 1037 | |
| 1038 | //==================== Start Meta Style Section ==================// |
| 1039 | public function meta_style() { |
| 1040 | $this->start_controls_section( |
| 1041 | 'blog_meta_tab', |
| 1042 | [ |
| 1043 | 'label' => esc_html__( 'Meta', 'spider-elements' ), |
| 1044 | 'tab' => \Elementor\Controls_Manager::TAB_STYLE, |
| 1045 | 'condition' => [ |
| 1046 | 'style' => [ '1', '2', '3', '4', ] |
| 1047 | ] |
| 1048 | ] |
| 1049 | ); |
| 1050 | |
| 1051 | $this->add_control( |
| 1052 | 'date-heading', |
| 1053 | [ |
| 1054 | 'label' => esc_html__( 'Date', 'spider-elements' ), |
| 1055 | 'type' => Controls_Manager::HEADING, |
| 1056 | 'condition' => [ |
| 1057 | 'style' => [ '1', '2', '4', '5' ], |
| 1058 | 'style!' => [ '3' ] |
| 1059 | ], |
| 1060 | ] |
| 1061 | ); |
| 1062 | |
| 1063 | $this->add_group_control( |
| 1064 | Group_Control_Typography::get_type(), |
| 1065 | [ |
| 1066 | 'name' => 'blog_meta_typography', |
| 1067 | 'selector' => '{{WRAPPER}} .blog-meta-two .date a, |
| 1068 | {{WRAPPER}} .blog-meta-one .date a', |
| 1069 | 'condition' => [ |
| 1070 | 'style' => [ '1', '2', '4' ], |
| 1071 | 'style!' => [ '3', '5' ] |
| 1072 | ], |
| 1073 | ] |
| 1074 | ); |
| 1075 | |
| 1076 | $this->add_control( |
| 1077 | 'blog_meta_color', |
| 1078 | [ |
| 1079 | 'label' => esc_html__( 'Text Color', 'spider-elements' ), |
| 1080 | 'type' => Controls_Manager::COLOR, |
| 1081 | 'default' => '', |
| 1082 | 'selectors' => [ |
| 1083 | '{{WRAPPER}} .blog-meta-two .date a' => 'color: {{VALUE}};', |
| 1084 | '{{WRAPPER}} .blog-meta-one .date a' => 'color: {{VALUE}};', |
| 1085 | '{{WRAPPER}} .blog-item .blog-meta .author-info h5, .blog-item .blog-meta .author-info span, |
| 1086 | .blog-item .blog-meta :is(.blog-category, .blog-category a, .blog-read)' => 'color: {{VALUE}} !important;', |
| 1087 | ], |
| 1088 | 'condition' => [ |
| 1089 | 'style' => [ '1', '2', '4', '5' ], |
| 1090 | 'style!' => [ '3' ] |
| 1091 | ], |
| 1092 | ] |
| 1093 | ); |
| 1094 | |
| 1095 | |
| 1096 | //============ Start meta category Style Controls =================// |
| 1097 | $this->add_control( |
| 1098 | 'blog_category_options', [ |
| 1099 | 'label' => esc_html__( 'Category', 'spider-elements' ), |
| 1100 | 'type' => Controls_Manager::HEADING, |
| 1101 | 'separator' => 'before', |
| 1102 | 'condition' => [ |
| 1103 | 'style' => [ '1', '3', '5' ], |
| 1104 | 'style!' => [ '2', '4' ] |
| 1105 | ], |
| 1106 | ] |
| 1107 | ); |
| 1108 | |
| 1109 | $this->add_group_control( |
| 1110 | Group_Control_Typography::get_type(), |
| 1111 | [ |
| 1112 | 'name' => 'blog_category_typography', |
| 1113 | 'selector' => '{{WRAPPER}} .blog-meta-one .tags, |
| 1114 | {{WRAPPER}} .blog-meta-two .post-img .tags, |
| 1115 | {{WRAPPER}} .blog-item .blog-meta .tags', |
| 1116 | ] |
| 1117 | ); |
| 1118 | |
| 1119 | $this->start_controls_tabs( |
| 1120 | 'cat_tabs', [ |
| 1121 | 'condition' => [ |
| 1122 | 'style' => [ '1', '3', '5' ], |
| 1123 | 'style!' => [ '2', '4' ] |
| 1124 | ], |
| 1125 | ] |
| 1126 | ); |
| 1127 | |
| 1128 | $this->start_controls_tab( |
| 1129 | 'cat_normal_tab', |
| 1130 | [ |
| 1131 | 'label' => esc_html__( 'Normal', 'spider-elements' ), |
| 1132 | ] |
| 1133 | ); |
| 1134 | |
| 1135 | $this->add_control( |
| 1136 | 'blog_category_color', |
| 1137 | [ |
| 1138 | 'label' => esc_html__( 'Text Color', 'spider-elements' ), |
| 1139 | 'type' => Controls_Manager::COLOR, |
| 1140 | 'default' => '', |
| 1141 | 'selectors' => [ |
| 1142 | '{{WRAPPER}} .blog-meta-two .post-img .tags' => 'color: {{VALUE}};', |
| 1143 | '{{WRAPPER}} .blog-meta-one .tags' => 'color: {{VALUE}};', |
| 1144 | '{{WRAPPER}} .blog-item .blog-meta .tags, .blog-read::before' => 'color: {{VALUE}};', |
| 1145 | ], |
| 1146 | ] |
| 1147 | ); |
| 1148 | |
| 1149 | $this->add_control( |
| 1150 | 'first_category_bg', |
| 1151 | [ |
| 1152 | 'label' => esc_html__( 'Background', 'spider-elements' ), |
| 1153 | 'type' => Controls_Manager::COLOR, |
| 1154 | 'selectors' => [ |
| 1155 | '{{WRAPPER}} .blog-meta-two .post-img .tags' => 'background: {{VALUE}};', |
| 1156 | ], |
| 1157 | 'condition' => [ |
| 1158 | 'style' => [ '1' ], |
| 1159 | 'style!' => [ '2', '3', '4', '5' ] |
| 1160 | ], |
| 1161 | ] |
| 1162 | ); |
| 1163 | |
| 1164 | $this->end_controls_tab(); |
| 1165 | |
| 1166 | $this->start_controls_tab( |
| 1167 | 'cat_hover_tab', |
| 1168 | [ |
| 1169 | 'label' => esc_html__( 'Hover', 'spider-elements' ), |
| 1170 | ] |
| 1171 | ); |
| 1172 | |
| 1173 | $this->add_control( |
| 1174 | 'category_hover_color', |
| 1175 | [ |
| 1176 | 'label' => esc_html__( 'Text Color', 'spider-elements' ), |
| 1177 | 'type' => Controls_Manager::COLOR, |
| 1178 | 'default' => '', |
| 1179 | 'selectors' => [ |
| 1180 | '{{WRAPPER}} .blog-meta-one .tags:hover' => 'color: {{VALUE}} !important;', |
| 1181 | '{{WRAPPER}} .blog-item .blog-meta .tags:hover' => 'color: {{VALUE}};', |
| 1182 | '{{WRAPPER}} .blog-meta-two .post-img .tags:hover' => 'color: {{VALUE}};', |
| 1183 | ], |
| 1184 | ] |
| 1185 | ); |
| 1186 | |
| 1187 | $this->add_control( |
| 1188 | 'bg_hover_category', |
| 1189 | [ |
| 1190 | 'label' => esc_html__( 'Background', 'spider-elements' ), |
| 1191 | 'type' => Controls_Manager::COLOR, |
| 1192 | 'selectors' => [ |
| 1193 | '{{WRAPPER}} .blog-meta-two .post-img .tags:hover' => 'background: {{VALUE}};', |
| 1194 | ], |
| 1195 | 'condition' => [ |
| 1196 | 'style' => [ '1' ], |
| 1197 | 'style!' => [ '2', '3', '4', '5' ] |
| 1198 | ], |
| 1199 | ] |
| 1200 | ); |
| 1201 | |
| 1202 | $this->end_controls_tab(); |
| 1203 | |
| 1204 | $this->end_controls_tabs(); |
| 1205 | |
| 1206 | //============ End meta category Style Controls =================// |
| 1207 | |
| 1208 | //============ Start meta Author Style Controls =================// |
| 1209 | $this->add_control( |
| 1210 | 'blog_author_options', [ |
| 1211 | 'label' => esc_html__( 'Author Name', 'spider-elements' ), |
| 1212 | 'type' => Controls_Manager::HEADING, |
| 1213 | 'separator' => 'before', |
| 1214 | 'condition' => [ |
| 1215 | 'style' => [ '3', '5' ], |
| 1216 | 'style!' => [ '1', '2', '4' ] |
| 1217 | ], |
| 1218 | ] |
| 1219 | ); |
| 1220 | |
| 1221 | $this->add_group_control( |
| 1222 | \Elementor\Group_Control_Typography::get_type(), |
| 1223 | [ |
| 1224 | 'name' => 'author_typography', |
| 1225 | 'selector' => '{{WRAPPER}} .blog-meta-one .author a, |
| 1226 | {{WRAPPER}} .blog-item .blog-meta .author-info h5 a', |
| 1227 | 'condition' => [ |
| 1228 | 'style' => [ '3', '5' ], |
| 1229 | 'style!' => [ '1', '2', '4' ] |
| 1230 | ], |
| 1231 | ] |
| 1232 | ); |
| 1233 | |
| 1234 | |
| 1235 | $this->start_controls_tabs( |
| 1236 | 'meta_style_tabs', [ |
| 1237 | 'condition' => [ |
| 1238 | 'style' => [ '3', '5' ], |
| 1239 | 'style!' => [ '1', '2', '4' ] |
| 1240 | ], |
| 1241 | ] |
| 1242 | ); |
| 1243 | |
| 1244 | $this->start_controls_tab( |
| 1245 | 'meta_style_normal_tab', |
| 1246 | [ |
| 1247 | 'label' => esc_html__( 'Normal', 'spider-elements' ), |
| 1248 | ] |
| 1249 | ); |
| 1250 | |
| 1251 | $this->add_control( |
| 1252 | 'author_color', |
| 1253 | [ |
| 1254 | 'label' => esc_html__( 'Text Color', 'spider-elements' ), |
| 1255 | 'type' => \Elementor\Controls_Manager::COLOR, |
| 1256 | 'selectors' => [ |
| 1257 | '{{WRAPPER}} .blog-meta-one .post-data, .blog-meta-one .author a' => 'color: {{VALUE}}', |
| 1258 | '{{WRAPPER}} .blog-item .blog-meta .author-info h5 a' => 'color: {{VALUE}}', |
| 1259 | ], |
| 1260 | ] |
| 1261 | ); |
| 1262 | |
| 1263 | $this->end_controls_tab(); |
| 1264 | |
| 1265 | $this->start_controls_tab( |
| 1266 | 'meta_style_hover_tab', |
| 1267 | [ |
| 1268 | 'label' => esc_html__( 'Hover', 'spider-elements' ), |
| 1269 | ] |
| 1270 | ); |
| 1271 | |
| 1272 | $this->add_control( |
| 1273 | 'blog_author_hover_color', |
| 1274 | [ |
| 1275 | 'label' => esc_html__( 'Text Color', 'spider-elements' ), |
| 1276 | 'type' => Controls_Manager::COLOR, |
| 1277 | 'default' => '', |
| 1278 | 'selectors' => [ |
| 1279 | '{{WRAPPER}} .blog-meta-one .author a:hover' => 'color: {{VALUE}};', |
| 1280 | '{{WRAPPER}} .blog-item .blog-meta .author-info h5 a:hover' => 'color: {{VALUE}};', |
| 1281 | ], |
| 1282 | ] |
| 1283 | ); |
| 1284 | |
| 1285 | $this->end_controls_tab(); |
| 1286 | |
| 1287 | $this->end_controls_tabs(); |
| 1288 | |
| 1289 | //============ End meta Author Style Controls =================// |
| 1290 | |
| 1291 | $this->end_controls_section(); |
| 1292 | } |
| 1293 | |
| 1294 | //==================== End Meta Style Section ==================// |
| 1295 | |
| 1296 | public function icon_style() { |
| 1297 | $this->start_controls_section( |
| 1298 | 'blog_icon_tab', |
| 1299 | [ |
| 1300 | 'label' => esc_html__( 'Icon', 'spider-elements' ), |
| 1301 | 'tab' => \Elementor\Controls_Manager::TAB_STYLE, |
| 1302 | 'condition' => [ |
| 1303 | 'style' => [ '5' ], |
| 1304 | 'style!' => [ '1', '2', '3', '4', ] |
| 1305 | ] |
| 1306 | ] |
| 1307 | ); |
| 1308 | |
| 1309 | // Blog icon Normal/hover/ State |
| 1310 | $this->start_controls_tabs( |
| 1311 | 'style_blog_icon_tabs' |
| 1312 | ); |
| 1313 | |
| 1314 | //=== blog Normal icon |
| 1315 | $this->start_controls_tab( |
| 1316 | 'style_blog_icon_normal', |
| 1317 | [ |
| 1318 | 'label' => esc_html__( 'Normal', 'spider-elements' ), |
| 1319 | ] |
| 1320 | ); |
| 1321 | |
| 1322 | $this->add_control( |
| 1323 | 'blog_icon_color', |
| 1324 | [ |
| 1325 | 'label' => esc_html__( 'Color', 'spider-elements' ), |
| 1326 | 'type' => Controls_Manager::COLOR, |
| 1327 | 'selectors' => [ |
| 1328 | '{{WRAPPER}} .slick-arrow' => 'color: {{VALUE}}', |
| 1329 | ], |
| 1330 | ] |
| 1331 | ); |
| 1332 | |
| 1333 | $this->add_control( |
| 1334 | 'blog_icon_bg_color', |
| 1335 | [ |
| 1336 | 'label' => esc_html__( 'Background', 'spider-elements' ), |
| 1337 | 'type' => Controls_Manager::COLOR, |
| 1338 | 'selectors' => [ |
| 1339 | '{{WRAPPER}} .slick-arrow' => 'background: {{VALUE}};', |
| 1340 | |
| 1341 | ], |
| 1342 | ] |
| 1343 | ); |
| 1344 | |
| 1345 | $this->end_controls_tab(); //End Normal icon |
| 1346 | |
| 1347 | //=== Hover icon==== |
| 1348 | $this->start_controls_tab( |
| 1349 | 'blog_hover_icon', [ |
| 1350 | 'label' => esc_html__( 'Hover', 'spider-elements' ), |
| 1351 | ] |
| 1352 | ); |
| 1353 | |
| 1354 | $this->add_control( |
| 1355 | 'icon_hover_color', [ |
| 1356 | 'label' => esc_html__( 'Color', 'spider-elements' ), |
| 1357 | 'type' => Controls_Manager::COLOR, |
| 1358 | 'selectors' => [ |
| 1359 | '{{WRAPPER}} .slick-arrow:hover' => 'color: {{VALUE}};', |
| 1360 | ], |
| 1361 | ] |
| 1362 | ); |
| 1363 | |
| 1364 | $this->add_control( |
| 1365 | 'icon_hover_bg_color', [ |
| 1366 | 'label' => esc_html__( 'Background', 'spider-elements' ), |
| 1367 | 'type' => Controls_Manager::COLOR, |
| 1368 | 'selectors' => [ |
| 1369 | '{{WRAPPER}} .slick-arrow:hover' => 'background: {{VALUE}};', |
| 1370 | ], |
| 1371 | ] |
| 1372 | ); |
| 1373 | |
| 1374 | $this->add_control( |
| 1375 | 'icon_border_color', |
| 1376 | [ |
| 1377 | 'label' => esc_html__( 'Border Color', 'spider-elements' ), |
| 1378 | 'type' => Controls_Manager::COLOR, |
| 1379 | 'selectors' => [ |
| 1380 | '{{WRAPPER}} .slick-arrow:hover' => 'border-color: {{VALUE}}', |
| 1381 | ], |
| 1382 | ] |
| 1383 | ); |
| 1384 | |
| 1385 | $this->end_controls_tab(); // End Active Tab Title |
| 1386 | $this->end_controls_tabs(); // End Accordion icon Normal/Active/ State |
| 1387 | |
| 1388 | $this->add_responsive_control( |
| 1389 | 'blog_icon_size', |
| 1390 | [ |
| 1391 | 'label' => esc_html__( 'Icon Size', 'spider-elements' ), |
| 1392 | 'type' => Controls_Manager::SLIDER, |
| 1393 | 'size_units' => [ 'px', '%' ], |
| 1394 | 'range' => [ |
| 1395 | 'px' => [ |
| 1396 | 'min' => 0, |
| 1397 | 'max' => 100, |
| 1398 | 'step' => 1, |
| 1399 | ], |
| 1400 | '%' => [ |
| 1401 | 'min' => 0, |
| 1402 | 'max' => 100, |
| 1403 | ], |
| 1404 | ], |
| 1405 | 'default' => [ |
| 1406 | 'unit' => 'px', |
| 1407 | ], |
| 1408 | 'selectors' => [ |
| 1409 | '{{WRAPPER}} .slick-arrow ' => 'font-size: {{SIZE}}{{UNIT}};', |
| 1410 | ], |
| 1411 | 'separator' => 'before', |
| 1412 | ] |
| 1413 | ); |
| 1414 | |
| 1415 | $this->add_responsive_control( |
| 1416 | 'icon-gap', |
| 1417 | [ |
| 1418 | 'label' => esc_html__( 'Gap', 'spider-elements' ), |
| 1419 | 'type' => \Elementor\Controls_Manager::SLIDER, |
| 1420 | 'description' => esc_html__( 'Set the gap between icon.', 'spider-elements' ), |
| 1421 | 'range' => [ |
| 1422 | 'px' => [ |
| 1423 | 'min' => 0, |
| 1424 | 'max' => 100, |
| 1425 | 'step' => 1, |
| 1426 | ], |
| 1427 | ], |
| 1428 | 'selectors' => [ |
| 1429 | '{{WRAPPER}} .blog-slider-arrows' => 'column-gap: {{SIZE}}{{UNIT}};', |
| 1430 | ], |
| 1431 | ] |
| 1432 | ); |
| 1433 | |
| 1434 | $this->add_group_control( |
| 1435 | \Elementor\Group_Control_Border::get_type(), |
| 1436 | [ |
| 1437 | 'name' => 'blog_icon_border', |
| 1438 | 'selector' => '{{WRAPPER}} .slick-arrow', |
| 1439 | ] |
| 1440 | ); |
| 1441 | |
| 1442 | $this->add_responsive_control( |
| 1443 | 'blog_icon_border_radius', |
| 1444 | [ |
| 1445 | 'label' => esc_html__( 'Border Radius', 'spider-elements' ), |
| 1446 | 'type' => Controls_Manager::SLIDER, |
| 1447 | 'size_units' => [ 'px', '%', 'em' ], |
| 1448 | 'selectors' => [ |
| 1449 | '{{WRAPPER}} .slick-arrow' => 'border-radius: {{SIZE}}px;', |
| 1450 | ], |
| 1451 | ] |
| 1452 | ); |
| 1453 | |
| 1454 | $this->add_responsive_control( |
| 1455 | 'blog_icon_padding', |
| 1456 | [ |
| 1457 | 'label' => esc_html__( 'Padding', 'spider-elements' ), |
| 1458 | 'type' => Controls_Manager::DIMENSIONS, |
| 1459 | 'size_units' => [ 'px', 'em', '%' ], |
| 1460 | 'selectors' => [ |
| 1461 | '{{WRAPPER}} .slick-arrow' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', |
| 1462 | ], |
| 1463 | ] |
| 1464 | ); |
| 1465 | |
| 1466 | $this->end_controls_section(); |
| 1467 | } |
| 1468 | |
| 1469 | |
| 1470 | protected function render(): void |
| 1471 | { |
| 1472 | $settings = $this->get_settings_for_display(); |
| 1473 | extract( $settings ); // Array to variable conversation |
| 1474 | |
| 1475 | $paged = ( get_query_var('paged') ) ? get_query_var('paged') : ( get_query_var('page') ? get_query_var('page') : 1 ); |
| 1476 | |
| 1477 | // query part |
| 1478 | $query = [ |
| 1479 | 'post_status' => 'publish', |
| 1480 | 'ignore_sticky_posts' => true, |
| 1481 | 'suppress_filters' => false, |
| 1482 | 'paged' => $paged, |
| 1483 | ]; |
| 1484 | |
| 1485 | // Post type |
| 1486 | if ( isset($settings['blog_queryby']) && $settings['blog_queryby'] === 'postype' ) { |
| 1487 | $query['post_type'] = $settings['blog_posttype'] ?? ['post']; |
| 1488 | } else { |
| 1489 | $query['post_type'] = ['post']; |
| 1490 | } |
| 1491 | |
| 1492 | // Order |
| 1493 | if ( !empty($settings['blog_order_by']) ) { |
| 1494 | $query['orderby'] = $settings['blog_order_by']; |
| 1495 | } |
| 1496 | if ( !empty($settings['blog_order']) ) { |
| 1497 | $query['order'] = $settings['blog_order']; |
| 1498 | } |
| 1499 | if ( !empty($settings['blog_limit']) ) { |
| 1500 | $query['posts_per_page'] = (int) $settings['blog_limit']; |
| 1501 | } |
| 1502 | |
| 1503 | // Offset |
| 1504 | if ( !empty($settings['blog_offset']) ) { |
| 1505 | $query['offset'] = (int) $settings['blog_offset']; |
| 1506 | } |
| 1507 | |
| 1508 | // Categories filter |
| 1509 | if ( isset($settings['blog_queryby']) && $settings['blog_queryby'] === 'categories' ) { |
| 1510 | if ( !empty($settings['blog_categories']) && is_array($settings['blog_categories']) ) { |
| 1511 | $query['tax_query'] = [ |
| 1512 | [ |
| 1513 | 'taxonomy' => 'category', |
| 1514 | 'field' => 'term_id', |
| 1515 | 'terms' => $settings['blog_categories'], |
| 1516 | ] |
| 1517 | ]; |
| 1518 | } |
| 1519 | } |
| 1520 | |
| 1521 | // Specific post IDs |
| 1522 | if ( isset($settings['blog_queryby']) && $settings['blog_queryby'] === 'posts' ) { |
| 1523 | if ( !empty($settings['blog_post']) && is_array($settings['blog_post']) ) { |
| 1524 | $query['post__in'] = $settings['blog_post']; |
| 1525 | } |
| 1526 | } |
| 1527 | |
| 1528 | $post_query = new \WP_Query( $query ); |
| 1529 | |
| 1530 | //============ Template Part =============// |
| 1531 | // Whitelist valid style values to prevent Local File Inclusion |
| 1532 | $allowed_styles = array( '1', '2', '3', '4', '5' ); |
| 1533 | $style = isset( $settings['style'] ) && in_array( $settings['style'], $allowed_styles, true ) ? $settings['style'] : '1'; |
| 1534 | include __DIR__ . "/templates/blog-grid/blog-{$style}.php"; |
| 1535 | } |
| 1536 | |
| 1537 | } |