theme-elements
6 months ago
accordion.php
6 months ago
audio.php
6 months ago
before-after.php
6 months ago
button.php
6 months ago
carousel-navigation.php
6 months ago
circle-chart.php
6 months ago
contact-box.php
6 months ago
contact-form.php
6 months ago
custom-list.php
6 months ago
divider.php
6 months ago
gallery.php
6 months ago
gmap.php
6 months ago
heading-modern.php
6 months ago
icon.php
6 months ago
image.php
6 months ago
mailchimp.php
6 months ago
modern-button.php
6 months ago
products-grid.php
6 months ago
quote.php
6 months ago
recent-comments.php
6 months ago
recent-posts-grid-carousel.php
6 months ago
recent-posts-land-style.php
6 months ago
recent-posts-masonry.php
6 months ago
recent-posts-tiles-carousel.php
6 months ago
recent-posts-tiles.php
6 months ago
recent-posts-timeline.php
6 months ago
recent-products.php
6 months ago
responsive-table.php
6 months ago
search.php
6 months ago
staff.php
6 months ago
svg.php
6 months ago
tabs.php
6 months ago
testimonial.php
6 months ago
text.php
6 months ago
touch-slider.php
6 months ago
video.php
6 months ago
recent-products.php
755 lines
| 1 | <?php |
| 2 | namespace Auxin\Plugin\CoreElements\Elementor\Elements; |
| 3 | |
| 4 | use Elementor\Plugin; |
| 5 | use Elementor\Widget_Base; |
| 6 | use Elementor\Controls_Manager; |
| 7 | use Elementor\Group_Control_Typography; |
| 8 | use Elementor\Core\Kits\Documents\Tabs\Global_Typography; |
| 9 | |
| 10 | |
| 11 | if ( ! defined( 'ABSPATH' ) ) { |
| 12 | exit; // Exit if accessed directly. |
| 13 | } |
| 14 | |
| 15 | /** |
| 16 | * Elementor 'RecentProducts' widget. |
| 17 | * |
| 18 | * Elementor widget that displays an 'RecentProducts' with lightbox. |
| 19 | * |
| 20 | * @since 1.0.0 |
| 21 | */ |
| 22 | class RecentProducts extends Widget_Base { |
| 23 | |
| 24 | /** |
| 25 | * Get widget name. |
| 26 | * |
| 27 | * Retrieve 'RecentProducts' widget name. |
| 28 | * |
| 29 | * @since 1.0.0 |
| 30 | * @access public |
| 31 | * |
| 32 | * @return string Widget name. |
| 33 | */ |
| 34 | public function get_name() { |
| 35 | return 'aux_recent_product'; |
| 36 | } |
| 37 | |
| 38 | /** |
| 39 | * Get widget title. |
| 40 | * |
| 41 | * Retrieve 'RecentProducts' widget title. |
| 42 | * |
| 43 | * @since 1.0.0 |
| 44 | * @access public |
| 45 | * |
| 46 | * @return string Widget title. |
| 47 | */ |
| 48 | public function get_title() { |
| 49 | return __('Recent Products', 'auxin-elements' ); |
| 50 | } |
| 51 | |
| 52 | public function has_widget_inner_wrapper(): bool { |
| 53 | return ! \Elementor\Plugin::$instance->experiments->is_feature_active( 'e_optimized_markup' ); |
| 54 | } |
| 55 | |
| 56 | |
| 57 | /** |
| 58 | * Get widget icon. |
| 59 | * |
| 60 | * Retrieve 'RecentProducts' widget icon. |
| 61 | * |
| 62 | * @since 1.0.0 |
| 63 | * @access public |
| 64 | * |
| 65 | * @return string Widget icon. |
| 66 | */ |
| 67 | public function get_icon() { |
| 68 | return 'eicon-woocommerce auxin-badge'; |
| 69 | } |
| 70 | |
| 71 | /** |
| 72 | * Get widget categories. |
| 73 | * |
| 74 | * Retrieve 'RecentProducts' widget icon. |
| 75 | * |
| 76 | * @since 1.0.0 |
| 77 | * @access public |
| 78 | * |
| 79 | * @return string Widget icon. |
| 80 | */ |
| 81 | public function get_categories() { |
| 82 | return array( 'auxin-dynamic' ); |
| 83 | } |
| 84 | |
| 85 | /** |
| 86 | * Retrieve the terms in a given taxonomy or list of taxonomies. |
| 87 | * |
| 88 | * Retrieve 'RecentProducts' widget icon. |
| 89 | * |
| 90 | * @since 1.0.0 |
| 91 | * @access public |
| 92 | * |
| 93 | * @return string Widget icon. |
| 94 | */ |
| 95 | public function get_terms() { |
| 96 | // Get terms |
| 97 | $terms = get_terms( |
| 98 | array( |
| 99 | 'taxonomy' => 'product_cat', |
| 100 | 'orderby' => 'count', |
| 101 | 'hide_empty' => true |
| 102 | ) |
| 103 | ); |
| 104 | |
| 105 | // Then create a list |
| 106 | $list = array( ' ' => __('All Categories', 'auxin-elements' ) ) ; |
| 107 | |
| 108 | if ( ! is_wp_error( $terms ) && is_array( $terms ) ){ |
| 109 | foreach ( $terms as $key => $value ) { |
| 110 | $list[$value->term_id] = $value->name; |
| 111 | } |
| 112 | } |
| 113 | |
| 114 | return $list; |
| 115 | } |
| 116 | |
| 117 | /** |
| 118 | * Register 'RecentProducts' widget controls. |
| 119 | * |
| 120 | * Adds different input fields to allow the user to change and customize the widget settings. |
| 121 | * |
| 122 | * @since 1.0.0 |
| 123 | * @access protected |
| 124 | */ |
| 125 | protected function register_controls() { |
| 126 | |
| 127 | /*-----------------------------------------------------------------------------------*/ |
| 128 | /* layout_section |
| 129 | /*-----------------------------------------------------------------------------------*/ |
| 130 | |
| 131 | $this->start_controls_section( |
| 132 | 'layout_section', |
| 133 | array( |
| 134 | 'label' => __('Layout', 'auxin-elements' ), |
| 135 | 'tab' => Controls_Manager::TAB_LAYOUT |
| 136 | ) |
| 137 | ); |
| 138 | |
| 139 | $this->add_responsive_control( |
| 140 | 'columns', |
| 141 | array( |
| 142 | 'label' => __( 'Columns', 'auxin-elements' ), |
| 143 | 'type' => Controls_Manager::SELECT, |
| 144 | 'default' => '4', |
| 145 | 'tablet_default' => 'inherit', |
| 146 | 'mobile_default' => '1', |
| 147 | 'options' => array( |
| 148 | 'inherit' => __( 'Inherited from larger', 'auxin-elements' ), |
| 149 | '1' => '1', |
| 150 | '2' => '2', |
| 151 | '3' => '3', |
| 152 | '4' => '4', |
| 153 | '5' => '5', |
| 154 | '6' => '6' |
| 155 | ), |
| 156 | 'frontend_available' => true, |
| 157 | ) |
| 158 | ); |
| 159 | |
| 160 | // $this->add_control( |
| 161 | // 'content_layout', |
| 162 | // array( |
| 163 | // 'label' => __('Content layout', 'auxin-elements'), |
| 164 | // 'type' => Controls_Manager::SELECT, |
| 165 | // 'default' => 'default', |
| 166 | // 'options' => array( |
| 167 | // 'default' => __('Full Content', 'auxin-elements'), |
| 168 | // 'entry-boxed' => __('Boxed Content', 'auxin-elements') |
| 169 | // ) |
| 170 | // ) |
| 171 | // ); |
| 172 | |
| 173 | $this->end_controls_section(); |
| 174 | |
| 175 | /*-----------------------------------------------------------------------------------*/ |
| 176 | /* display_section |
| 177 | /*-----------------------------------------------------------------------------------*/ |
| 178 | |
| 179 | $this->start_controls_section( |
| 180 | 'display_section', |
| 181 | array( |
| 182 | 'label' => __('Display', 'auxin-elements' ), |
| 183 | 'tab' => Controls_Manager::TAB_LAYOUT |
| 184 | ) |
| 185 | ); |
| 186 | |
| 187 | $this->add_control( |
| 188 | 'display_price', |
| 189 | array( |
| 190 | 'label' => __('Display products price','auxin-elements' ), |
| 191 | 'type' => Controls_Manager::SWITCHER, |
| 192 | 'label_on' => __( 'On', 'auxin-elements' ), |
| 193 | 'label_off' => __( 'Off', 'auxin-elements' ), |
| 194 | 'return_value' => 'yes', |
| 195 | 'default' => 'yes' |
| 196 | ) |
| 197 | ); |
| 198 | |
| 199 | $this->add_control( |
| 200 | 'display_sale_badge', |
| 201 | array( |
| 202 | 'label' => __('Display sale badge','auxin-elements' ), |
| 203 | 'type' => Controls_Manager::SWITCHER, |
| 204 | 'label_on' => __( 'On', 'auxin-elements' ), |
| 205 | 'label_off' => __( 'Off', 'auxin-elements' ), |
| 206 | 'return_value' => 'yes', |
| 207 | 'default' => 'yes' |
| 208 | ) |
| 209 | ); |
| 210 | |
| 211 | $this->add_control( |
| 212 | 'show_media', |
| 213 | array( |
| 214 | 'label' => __('Display post media (image, video, etc)','auxin-elements' ), |
| 215 | 'label_block' => true, |
| 216 | 'type' => Controls_Manager::SWITCHER, |
| 217 | 'label_on' => __( 'On', 'auxin-elements' ), |
| 218 | 'label_off' => __( 'Off', 'auxin-elements' ), |
| 219 | 'return_value' => 'yes', |
| 220 | 'default' => 'yes', |
| 221 | 'label_block' => true |
| 222 | ) |
| 223 | ); |
| 224 | |
| 225 | |
| 226 | $this->add_control( |
| 227 | 'preloadable', |
| 228 | array( |
| 229 | 'label' => __('Preload image','auxin-elements' ), |
| 230 | 'type' => Controls_Manager::SWITCHER, |
| 231 | 'label_on' => __( 'On', 'auxin-elements' ), |
| 232 | 'label_off' => __( 'Off', 'auxin-elements' ), |
| 233 | 'return_value' => 'yes', |
| 234 | 'default' => 'no', |
| 235 | 'condition' => array( |
| 236 | 'show_media' => 'yes', |
| 237 | ) |
| 238 | ) |
| 239 | ); |
| 240 | |
| 241 | $this->add_control( |
| 242 | 'preload_preview', |
| 243 | array( |
| 244 | 'label' => __('While loading image display','auxin-elements' ), |
| 245 | 'label_block' => true, |
| 246 | 'type' => Controls_Manager::SELECT, |
| 247 | 'options' => auxin_get_preloadable_previews(), |
| 248 | 'return_value' => 'yes', |
| 249 | 'default' => 'yes', |
| 250 | 'condition' => array( |
| 251 | 'preloadable' => 'yes' |
| 252 | ) |
| 253 | ) |
| 254 | ); |
| 255 | |
| 256 | $this->add_control( |
| 257 | 'preload_bgcolor', |
| 258 | array( |
| 259 | 'label' => __( 'Placeholder color while loading image', 'auxin-elements' ), |
| 260 | 'type' => Controls_Manager::COLOR, |
| 261 | 'condition' => array( |
| 262 | 'preloadable' => 'yes', |
| 263 | 'preload_preview' => array('simple-spinner', 'simple-spinner-light', 'simple-spinner-dark') |
| 264 | ) |
| 265 | ) |
| 266 | ); |
| 267 | |
| 268 | $this->add_control( |
| 269 | 'display_title', |
| 270 | array( |
| 271 | 'label' => __('Display product title', 'auxin-elements' ), |
| 272 | 'type' => Controls_Manager::SWITCHER, |
| 273 | 'label_on' => __( 'On', 'auxin-elements' ), |
| 274 | 'label_off' => __( 'Off', 'auxin-elements' ), |
| 275 | 'return_value' => 'yes', |
| 276 | 'default' => 'yes' |
| 277 | ) |
| 278 | ); |
| 279 | |
| 280 | $this->add_control( |
| 281 | 'display_categories', |
| 282 | array( |
| 283 | 'label' => __('Display Categories','auxin-elements' ), |
| 284 | 'type' => Controls_Manager::SWITCHER, |
| 285 | 'label_on' => __( 'On', 'auxin-elements' ), |
| 286 | 'label_off' => __( 'Off', 'auxin-elements' ), |
| 287 | 'return_value' => 'yes', |
| 288 | 'default' => 'yes' |
| 289 | ) |
| 290 | ); |
| 291 | |
| 292 | $this->add_control( |
| 293 | 'display_button', |
| 294 | array( |
| 295 | 'label' => __('Display Add To Cart','auxin-elements' ), |
| 296 | 'type' => Controls_Manager::SWITCHER, |
| 297 | 'label_on' => __( 'On', 'auxin-elements' ), |
| 298 | 'label_off' => __( 'Off', 'auxin-elements' ), |
| 299 | 'return_value' => 'yes', |
| 300 | 'default' => 'yes' |
| 301 | ) |
| 302 | ); |
| 303 | |
| 304 | $this->end_controls_section(); |
| 305 | |
| 306 | /*-----------------------------------------------------------------------------------*/ |
| 307 | /* query_section |
| 308 | /*-----------------------------------------------------------------------------------*/ |
| 309 | |
| 310 | $this->start_controls_section( |
| 311 | 'query_section', |
| 312 | array( |
| 313 | 'label' => __('Query', 'auxin-elements' ), |
| 314 | ) |
| 315 | ); |
| 316 | |
| 317 | $this->add_control( |
| 318 | 'cat', |
| 319 | array( |
| 320 | 'label' => __('Categories', 'auxin-elements'), |
| 321 | 'description' => __('Specifies a category that you want to show posts from it.', 'auxin-elements' ), |
| 322 | 'type' => Controls_Manager::SELECT2, |
| 323 | 'multiple' => true, |
| 324 | 'options' => $this->get_terms(), |
| 325 | 'default' => array( ' ' ), |
| 326 | ) |
| 327 | ); |
| 328 | |
| 329 | $this->add_control( |
| 330 | 'num', |
| 331 | array( |
| 332 | 'label' => __('Number of posts to show', 'auxin-elements'), |
| 333 | 'label_block' => true, |
| 334 | 'type' => Controls_Manager::NUMBER, |
| 335 | 'default' => '8', |
| 336 | 'min' => 1, |
| 337 | 'step' => 1 |
| 338 | ) |
| 339 | ); |
| 340 | |
| 341 | $this->add_control( |
| 342 | 'exclude_without_media', |
| 343 | array( |
| 344 | 'label' => __('Exclude posts without media','auxin-elements' ), |
| 345 | 'type' => Controls_Manager::SWITCHER, |
| 346 | 'label_on' => __( 'On', 'auxin-elements' ), |
| 347 | 'label_off' => __( 'Off', 'auxin-elements' ), |
| 348 | 'return_value' => 'yes', |
| 349 | 'default' => 'no' |
| 350 | ) |
| 351 | ); |
| 352 | |
| 353 | $this->add_control( |
| 354 | 'order_by', |
| 355 | array( |
| 356 | 'label' => __('Order by', 'auxin-elements'), |
| 357 | 'type' => Controls_Manager::SELECT, |
| 358 | 'default' => 'date', |
| 359 | 'options' => array( |
| 360 | 'date' => __('Date', 'auxin-elements'), |
| 361 | 'menu_order date' => __('Menu Order', 'auxin-elements'), |
| 362 | 'title' => __('Title', 'auxin-elements'), |
| 363 | 'ID' => __('ID', 'auxin-elements'), |
| 364 | 'rand' => __('Random', 'auxin-elements'), |
| 365 | 'comment_count' => __('Comments', 'auxin-elements'), |
| 366 | 'modified' => __('Date Modified', 'auxin-elements'), |
| 367 | 'author' => __('Author', 'auxin-elements'), |
| 368 | 'post__in' => __('Inserted Post IDs', 'auxin-elements') |
| 369 | ), |
| 370 | ) |
| 371 | ); |
| 372 | |
| 373 | $this->add_control( |
| 374 | 'order', |
| 375 | array( |
| 376 | 'label' => __('Order', 'auxin-elements'), |
| 377 | 'type' => Controls_Manager::SELECT, |
| 378 | 'default' => 'DESC', |
| 379 | 'options' => array( |
| 380 | 'DESC' => __('Descending', 'auxin-elements'), |
| 381 | 'ASC' => __('Ascending', 'auxin-elements'), |
| 382 | ), |
| 383 | ) |
| 384 | ); |
| 385 | |
| 386 | $this->add_control( |
| 387 | 'only_products__in', |
| 388 | array( |
| 389 | 'label' => __('Only products','auxin-elements' ), |
| 390 | 'description' => __('If you intend to display ONLY specific products, you should specify the products here. You have to insert the Products IDs that are separated by comma (eg. 53,34,87,25).', 'auxin-elements' ), |
| 391 | 'type' => Controls_Manager::TEXT |
| 392 | ) |
| 393 | ); |
| 394 | |
| 395 | $this->add_control( |
| 396 | 'include', |
| 397 | array( |
| 398 | 'label' => __('Include products','auxin-elements' ), |
| 399 | 'description' => __('If you intend to include additional products, you should specify the products here. You have to insert the Products IDs that are separated by comma (eg. 53,34,87,25)', 'auxin-elements' ), |
| 400 | 'type' => Controls_Manager::TEXT |
| 401 | ) |
| 402 | ); |
| 403 | |
| 404 | $this->add_control( |
| 405 | 'exclude', |
| 406 | array( |
| 407 | 'label' => __('Exclude products','auxin-elements' ), |
| 408 | 'description' => __('If you intend to exclude specific products from result, you should specify the products here. You have to insert the Products IDs that are separated by comma (eg. 53,34,87,25)', 'auxin-elements' ), |
| 409 | 'type' => Controls_Manager::TEXT |
| 410 | ) |
| 411 | ); |
| 412 | |
| 413 | $this->add_control( |
| 414 | 'offset', |
| 415 | array( |
| 416 | 'label' => __('Start offset','auxin-elements' ), |
| 417 | 'description' => __('Number of post to displace or pass over.', 'auxin-elements' ), |
| 418 | 'type' => Controls_Manager::NUMBER |
| 419 | ) |
| 420 | ); |
| 421 | |
| 422 | $this->add_control( |
| 423 | 'show_pagination', |
| 424 | array( |
| 425 | 'label' => __('Show Pagination','auxin-elements' ), |
| 426 | 'description' => __('Paginates the products', 'auxin-elements' ), |
| 427 | 'type' => Controls_Manager::SWITCHER, |
| 428 | 'label_on' => __( 'On', 'auxin-elements' ), |
| 429 | 'label_off' => __( 'Off', 'auxin-elements' ), |
| 430 | 'return_value' => 'yes', |
| 431 | 'default' => '' |
| 432 | ) |
| 433 | ); |
| 434 | |
| 435 | $this->end_controls_section(); |
| 436 | |
| 437 | /*-----------------------------------------------------------------------------------*/ |
| 438 | /* paginate_section |
| 439 | /*-----------------------------------------------------------------------------------*/ |
| 440 | |
| 441 | // $this->start_controls_section( |
| 442 | // 'paginate_section', |
| 443 | // array( |
| 444 | // 'label' => __('Paginate', 'auxin-elements' ), |
| 445 | // ) |
| 446 | // ); |
| 447 | |
| 448 | // $this->add_control( |
| 449 | // 'loadmore_type', |
| 450 | // array( |
| 451 | // 'label' => __('Load More Type','auxin-elements' ), |
| 452 | // 'type' => 'aux-visual-select', |
| 453 | // 'options' => array( |
| 454 | // '' => array( |
| 455 | // 'label' => __('None', 'auxin-elements' ), |
| 456 | // 'image' => AUXIN_URL . 'images/visual-select/load-more-none.svg' |
| 457 | // ), |
| 458 | // 'scroll' => array( |
| 459 | // 'label' => __('Infinite Scroll', 'auxin-elements' ), |
| 460 | // 'image' => AUXIN_URL . 'images/visual-select/load-more-infinite.svg' |
| 461 | // ), |
| 462 | // 'next' => array( |
| 463 | // 'label' => __('Next Button', 'auxin-elements' ), |
| 464 | // 'image' => AUXIN_URL . 'images/visual-select/load-more-button.svg' |
| 465 | // ), |
| 466 | // 'next-prev' => array( |
| 467 | // 'label' => __('Next Prev', 'auxin-elements' ), |
| 468 | // 'image' => AUXIN_URL . 'images/visual-select/load-more-next-prev.svg' |
| 469 | // ) |
| 470 | // ), |
| 471 | // 'default' => 'scroll' |
| 472 | // ) |
| 473 | // ); |
| 474 | |
| 475 | // $this->end_controls_section(); |
| 476 | |
| 477 | /*-----------------------------------------------------------------------------------*/ |
| 478 | /* image_style_section |
| 479 | /*-----------------------------------------------------------------------------------*/ |
| 480 | |
| 481 | $this->start_controls_section( |
| 482 | 'image_style_section', |
| 483 | array( |
| 484 | 'label' => __( 'Image', 'auxin-elements' ), |
| 485 | 'tab' => Controls_Manager::TAB_STYLE, |
| 486 | 'condition' => array( |
| 487 | 'show_media' => 'yes', |
| 488 | ), |
| 489 | ) |
| 490 | ); |
| 491 | |
| 492 | $this->add_control( |
| 493 | 'image_aspect_ratio', |
| 494 | array( |
| 495 | 'label' => __('Image aspect ratio', 'auxin-elements'), |
| 496 | 'type' => Controls_Manager::SELECT, |
| 497 | 'default' => '0.75', |
| 498 | 'options' => array( |
| 499 | '0.75' => __('Horizontal 4:3' , 'auxin-elements'), |
| 500 | '0.56' => __('Horizontal 16:9', 'auxin-elements'), |
| 501 | '1.00' => __('Square 1:1' , 'auxin-elements'), |
| 502 | '1.33' => __('Vertical 3:4' , 'auxin-elements') |
| 503 | ), |
| 504 | 'condition' => array( |
| 505 | 'show_media' => 'yes', |
| 506 | ), |
| 507 | ) |
| 508 | ); |
| 509 | |
| 510 | $this->add_control( |
| 511 | 'img_border_radius', |
| 512 | array( |
| 513 | 'label' => __( 'Border Radius', 'auxin-elements' ), |
| 514 | 'type' => Controls_Manager::DIMENSIONS, |
| 515 | 'size_units' => array( 'px', '%' ), |
| 516 | 'selectors' => array( |
| 517 | '{{WRAPPER}} .aux-media-frame img' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;', |
| 518 | ), |
| 519 | 'condition' => array( |
| 520 | 'show_media' => 'yes', |
| 521 | ), |
| 522 | ) |
| 523 | ); |
| 524 | |
| 525 | $this->end_controls_section(); |
| 526 | |
| 527 | /*-----------------------------------------------------------------------------------*/ |
| 528 | /* title_style_section |
| 529 | /*-----------------------------------------------------------------------------------*/ |
| 530 | |
| 531 | $this->start_controls_section( |
| 532 | 'title_style_section', |
| 533 | array( |
| 534 | 'label' => __( 'Title', 'auxin-elements' ), |
| 535 | 'tab' => Controls_Manager::TAB_STYLE, |
| 536 | 'condition' => array( |
| 537 | 'display_title' => 'yes', |
| 538 | ), |
| 539 | ) |
| 540 | ); |
| 541 | |
| 542 | $this->add_control( |
| 543 | 'title_color', |
| 544 | array( |
| 545 | 'label' => __( 'Color', 'auxin-elements' ), |
| 546 | 'type' => Controls_Manager::COLOR, |
| 547 | 'selectors' => array( |
| 548 | '{{WRAPPER}} .woocommerce-loop-product__title' => 'color: {{VALUE}};', |
| 549 | ), |
| 550 | 'condition' => array( |
| 551 | 'display_title' => 'yes', |
| 552 | ), |
| 553 | ) |
| 554 | ); |
| 555 | |
| 556 | $this->add_group_control( |
| 557 | Group_Control_Typography::get_type(), |
| 558 | array( |
| 559 | 'name' => 'title_typography', |
| 560 | 'global' => [ |
| 561 | 'default' => Global_Typography::TYPOGRAPHY_PRIMARY, |
| 562 | ], |
| 563 | 'selector' => '{{WRAPPER}} .woocommerce-loop-product__title', |
| 564 | 'condition' => array( |
| 565 | 'display_title' => 'yes', |
| 566 | ), |
| 567 | ) |
| 568 | ); |
| 569 | |
| 570 | $this->add_responsive_control( |
| 571 | 'title_margin_bottom', |
| 572 | array( |
| 573 | 'label' => __( 'Spacing', 'auxin-elements' ), |
| 574 | 'type' => Controls_Manager::SLIDER, |
| 575 | 'range' => array( |
| 576 | 'px' => array( |
| 577 | 'max' => 100, |
| 578 | ), |
| 579 | ), |
| 580 | 'selectors' => array( |
| 581 | '{{WRAPPER}} .woocommerce-loop-product__title' => 'margin-bottom: {{SIZE}}{{UNIT}};', |
| 582 | ), |
| 583 | 'condition' => array( |
| 584 | 'display_title' => 'yes', |
| 585 | ), |
| 586 | ) |
| 587 | ); |
| 588 | |
| 589 | $this->end_controls_section(); |
| 590 | |
| 591 | /*-----------------------------------------------------------------------------------*/ |
| 592 | /* category_style_section |
| 593 | /*-----------------------------------------------------------------------------------*/ |
| 594 | |
| 595 | $this->start_controls_section( |
| 596 | 'category_style_section', |
| 597 | array( |
| 598 | 'label' => __( 'Category', 'auxin-elements' ), |
| 599 | 'tab' => Controls_Manager::TAB_STYLE, |
| 600 | 'condition' => array( |
| 601 | 'display_categories' => 'yes', |
| 602 | ), |
| 603 | ) |
| 604 | ); |
| 605 | |
| 606 | $this->start_controls_tabs( 'category_colors' ); |
| 607 | |
| 608 | $this->start_controls_tab( |
| 609 | 'category_color_normal', |
| 610 | array( |
| 611 | 'label' => __( 'Normal' , 'auxin-elements' ), |
| 612 | 'condition' => array( |
| 613 | 'display_categories' => 'yes', |
| 614 | ), |
| 615 | ) |
| 616 | ); |
| 617 | |
| 618 | $this->add_control( |
| 619 | 'category_color', |
| 620 | array( |
| 621 | 'label' => __( 'Color', 'auxin-elements' ), |
| 622 | 'type' => Controls_Manager::COLOR, |
| 623 | 'selectors' => array( |
| 624 | '{{WRAPPER}} .auxshp-meta-terms a, {{WRAPPER}} .auxshp-meta-terms' => 'color: {{VALUE}};', |
| 625 | ), |
| 626 | 'condition' => array( |
| 627 | 'display_categories' => 'yes', |
| 628 | ), |
| 629 | ) |
| 630 | ); |
| 631 | |
| 632 | $this->end_controls_tab(); |
| 633 | |
| 634 | $this->start_controls_tab( |
| 635 | 'category_color_hover', |
| 636 | array( |
| 637 | 'label' => __( 'Hover' , 'auxin-elements' ), |
| 638 | 'condition' => array( |
| 639 | 'display_categories' => 'yes', |
| 640 | ), |
| 641 | ) |
| 642 | ); |
| 643 | |
| 644 | $this->add_control( |
| 645 | 'category_hover_color', |
| 646 | array( |
| 647 | 'label' => __( 'Color', 'auxin-elements' ), |
| 648 | 'type' => Controls_Manager::COLOR, |
| 649 | 'selectors' => array( |
| 650 | '{{WRAPPER}} .auxshp-meta-terms a:hover' => 'color: {{VALUE}};', |
| 651 | ), |
| 652 | 'condition' => array( |
| 653 | 'display_categories' => 'yes', |
| 654 | ), |
| 655 | ) |
| 656 | ); |
| 657 | |
| 658 | $this->end_controls_tab(); |
| 659 | |
| 660 | $this->end_controls_tabs(); |
| 661 | |
| 662 | $this->add_group_control( |
| 663 | Group_Control_Typography::get_type(), |
| 664 | array( |
| 665 | 'name' => 'category_typography', |
| 666 | 'global' => [ |
| 667 | 'default' => Global_Typography::TYPOGRAPHY_PRIMARY, |
| 668 | ], |
| 669 | 'selector' => '{{WRAPPER}} .auxshp-meta-terms, {{WRAPPER}} .auxshp-meta-terms a', |
| 670 | 'condition' => array( |
| 671 | 'display_categories' => 'yes', |
| 672 | ), |
| 673 | ) |
| 674 | ); |
| 675 | |
| 676 | $this->add_responsive_control( |
| 677 | 'category_margin_bottom', |
| 678 | array( |
| 679 | 'label' => __( 'Bottom space', 'auxin-elements' ), |
| 680 | 'type' => Controls_Manager::SLIDER, |
| 681 | 'range' => array( |
| 682 | 'px' => array( |
| 683 | 'max' => 100, |
| 684 | ), |
| 685 | ), |
| 686 | 'selectors' => array( |
| 687 | '{{WRAPPER}} .product_meta' => 'margin-bottom: {{SIZE}}{{UNIT}};', |
| 688 | ), |
| 689 | 'condition' => array( |
| 690 | 'display_categories' => 'yes', |
| 691 | ), |
| 692 | ) |
| 693 | ); |
| 694 | |
| 695 | $this->end_controls_section(); |
| 696 | } |
| 697 | |
| 698 | /** |
| 699 | * Render image box widget output on the frontend. |
| 700 | * |
| 701 | * Written in PHP and used to generate the final HTML. |
| 702 | * |
| 703 | * @since 1.0.0 |
| 704 | * @access protected |
| 705 | */ |
| 706 | protected function render() { |
| 707 | // Check whether required resources are available |
| 708 | if( ! auxin_is_plugin_active( 'woocommerce/woocommerce.php' ) ) { |
| 709 | auxin_elementor_plugin_missing_notice( array( 'plugin_name' => __( 'WooCommerce', 'auxin-elements' ) ) ); |
| 710 | return; |
| 711 | } |
| 712 | |
| 713 | $settings = $this->get_settings_for_display(); |
| 714 | |
| 715 | $args = array( |
| 716 | // Display Section |
| 717 | 'display_price' => $settings['display_price'], |
| 718 | 'display_sale_badge' => $settings['display_sale_badge'], |
| 719 | 'show_media' => $settings['show_media'], |
| 720 | 'preloadable' => $settings['preloadable'], |
| 721 | 'preload_preview' => $settings['preload_preview'], |
| 722 | 'preload_bgcolor' => $settings['preload_bgcolor'], |
| 723 | 'display_title' => $settings['display_title'], |
| 724 | 'display_categories' => $settings['display_categories'], |
| 725 | 'display_button' => $settings['display_button'], |
| 726 | |
| 727 | // Layout Section |
| 728 | 'desktop_cnum' => $settings['columns'], |
| 729 | 'tablet_cnum' => $settings['columns_tablet'], |
| 730 | 'phone_cnum' => $settings['columns_mobile'], |
| 731 | // 'content_layout' => $settings['content_layout'], |
| 732 | |
| 733 | |
| 734 | // Query Section |
| 735 | 'cat' => $settings['cat'], |
| 736 | 'num' => $settings['num'], |
| 737 | 'exclude_without_media' => $settings['exclude_without_media'], |
| 738 | 'order_by' => $settings['order_by'], |
| 739 | 'order' => $settings['order'], |
| 740 | 'only_products__in' => $settings['only_products__in'], |
| 741 | 'include' => $settings['include'], |
| 742 | 'exclude' => $settings['exclude'], |
| 743 | 'offset' => $settings['offset'], |
| 744 | 'show_pagination' => $settings['show_pagination'], |
| 745 | |
| 746 | // Style Section |
| 747 | 'image_aspect_ratio' => $settings['image_aspect_ratio'], |
| 748 | ); |
| 749 | |
| 750 | // get the shortcode base blog page |
| 751 | echo auxin_widget_the_recent_products_callback( $args ); |
| 752 | } |
| 753 | |
| 754 | } |
| 755 |