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