$hierarchical ] ) ) ) { return []; } return wp_list_pluck( adqs_get_terms( $name, [ 'hierarchical' => $hierarchical ] ), 'name', $index_type ); } /* array data join */ public function get_join_data( $data = [] ) { if ( empty( $data ) ) { return ''; } // Handle both string and array inputs if ( is_string( $data ) ) { return $data; // Already a string, return as-is } if ( is_array( $data ) ) { return join( ',', $data ); } return ''; } /** * Register listing by widget controls. * * Adds different input fields to allow the user to change and customize the widget settings. * * @since 1.0.0 * @access protected */ protected function register_controls() { $this->start_controls_section( 'section_options', [ 'label' => esc_html__( 'Options', 'adirectory' ), 'tab' => Controls_Manager::TAB_CONTENT, ] ); $this->add_control( 'filter_show', [ 'label' => esc_html__( 'Filter Show ?', 'adirectory' ), 'type' => Controls_Manager::SWITCHER, 'label_on' => esc_html__( 'Yes', 'adirectory' ), 'label_off' => esc_html__( 'No', 'adirectory' ), 'return_value' => 'true', 'default' => 'true', ] ); $this->add_control( 'ajax_filter', [ 'label' => esc_html__( 'Ajax Filters ?', 'adirectory' ), 'type' => Controls_Manager::SWITCHER, 'label_on' => esc_html__( 'Yes', 'adirectory' ), 'label_off' => esc_html__( 'No', 'adirectory' ), 'return_value' => 'true', 'default' => empty( adqs_get_setting_option( 'ajax_filters' ) ) ? 'false' : 'true', ] ); $this->add_control( 'top_bar_show', [ 'label' => esc_html__( 'Top Bar Show ?', 'adirectory' ), 'type' => Controls_Manager::SWITCHER, 'label_on' => esc_html__( 'Yes', 'adirectory' ), 'label_off' => esc_html__( 'No', 'adirectory' ), 'return_value' => 'true', 'default' => 'true', ] ); $this->add_control( 'sort_by_show', [ 'label' => esc_html__( 'Sort By Show ?', 'adirectory' ), 'type' => Controls_Manager::SWITCHER, 'label_on' => esc_html__( 'Yes', 'adirectory' ), 'label_off' => esc_html__( 'No', 'adirectory' ), 'return_value' => 'true', 'default' => 'true', ] ); $this->add_control( 'reset_filter', [ 'label' => esc_html__( 'Reset Filter Show ?', 'adirectory' ), 'type' => Controls_Manager::SWITCHER, 'label_on' => esc_html__( 'Yes', 'adirectory' ), 'label_off' => esc_html__( 'No', 'adirectory' ), 'return_value' => 'true', 'default' => 'true', ] ); $this->add_control( 'filter_layout', [ 'label' => esc_html__( 'Filter Layout Position', 'adirectory' ), 'type' => Controls_Manager::SELECT, 'label_block' => true, 'multiple' => true, 'options' => [ 'top' => esc_html__( 'Top Position', 'adirectory' ), 'sidebar' => esc_html__( 'Sidebar Position', 'adirectory' ), ], 'default' => adqs_get_setting_option( 'filterLayoutPosition' ) === 'sidebar' ? 'sidebar' : 'top', 'conditions' => [ 'terms' => [ [ 'name' => 'filter_show', 'operator' => '==', 'value' => 'true', ], ], ], ] ); $this->add_control( 'view_bar_show', [ 'label' => esc_html__( 'View Bar Show ?', 'adirectory' ), 'type' => Controls_Manager::SWITCHER, 'label_on' => esc_html__( 'Yes', 'adirectory' ), 'label_off' => esc_html__( 'No', 'adirectory' ), 'return_value' => 'true', 'default' => 'true', ] ); $this->add_control( 'has_map_view', [ 'label' => esc_html__( 'Map View Show ?', 'adirectory' ), 'type' => Controls_Manager::SWITCHER, 'label_on' => esc_html__( 'Yes', 'adirectory' ), 'label_off' => esc_html__( 'No', 'adirectory' ), 'return_value' => 'true', 'default' => 'true', ] ); $this->add_control( 'pagination_type', [ 'label' => esc_html__( 'Layout With Type', 'adirectory' ), 'type' => Controls_Manager::SELECT, 'label_block' => true, 'multiple' => true, 'options' => [ '' => esc_html__( 'Default', 'adirectory' ), 'pagination' => esc_html__( 'Pagination', 'adirectory' ), 'carousel' => esc_html__( 'Carousel', 'adirectory' ), ], 'default' => 'pagination', ] ); $this->add_control( 'view_type', [ 'label' => esc_html__( 'View Type', 'adirectory' ), 'type' => Controls_Manager::SELECT, 'label_block' => true, 'multiple' => true, 'options' => [ 'grid' => esc_html__( 'Grid', 'adirectory' ), 'list' => esc_html__( 'List', 'adirectory' ), 'map' => esc_html__( 'Map', 'adirectory' ), ], 'default' => 'grid', ] ); $this->add_control( 'next_icon_upload', [ 'label' => esc_html__( 'Next Icon', 'textdomain' ), 'type' => \Elementor\Controls_Manager::ICONS, 'default' => [], 'recommended' => [ 'fa-solid' => [ 'circle', 'dot-circle', 'square-full', ], 'fa-regular' => [ 'circle', 'dot-circle', 'square-full', ], ], ] ); $this->add_control( 'prev_icon_upload', [ 'label' => esc_html__( 'Previous Icon', 'textdomain' ), 'type' => \Elementor\Controls_Manager::ICONS, 'default' => [], 'recommended' => [ 'fa-solid' => [ 'circle', 'dot-circle', 'square-full', ], 'fa-regular' => [ 'circle', 'dot-circle', 'square-full', ], ], ] ); $this->add_responsive_control( 'icon_area_size', [ 'label' => esc_html__( 'Icon Area Size', 'adirectory' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', 'em', 'rem' ], 'range' => [ 'px' => [ 'min' => 10, 'max' => 200, ], 'em' => [ 'min' => 0.5, 'max' => 10, ], 'rem' => [ 'min' => 0.5, 'max' => 10, ], ], 'default' => [], 'selectors' => [ '{{WRAPPER}} .slick-arrow' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'icon_size', [ 'label' => esc_html__( 'Icon Size', 'adirectory' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', 'em', 'rem' ], 'range' => [ 'px' => [ 'min' => 10, 'max' => 200, ], 'em' => [ 'min' => 0.5, 'max' => 10, ], 'rem' => [ 'min' => 0.5, 'max' => 10, ], ], 'default' => [], 'selectors' => [ '{{WRAPPER}} .slick-arrow i' => 'font-size: {{SIZE}}{{UNIT}};', '{{WRAPPER}} .slick-arrow svg' => 'width: {{SIZE}}{{UNIT}}; height: {{SIZE}}{{UNIT}};', ], ] ); $this->end_controls_section(); // end: Section $this->start_controls_section( 'section_query', [ 'label' => esc_html__( 'Listings Query', 'adirectory' ), 'tab' => Controls_Manager::TAB_CONTENT, ] ); $display_listings = [ '' => esc_html__( 'All', 'adirectory' ), 'featured' => esc_html__( 'Featured', 'adirectory' ), ]; $this->add_control( 'display_listings', [ 'label' => esc_html__( 'Display Listings', 'adirectory' ), 'type' => Controls_Manager::SELECT, 'options' => $display_listings, ] ); $directory_types = wp_list_pluck( adqs_get_directories(), 'name', 'slug' ) ?? []; $this->add_control( 'custom_directory', [ 'label' => esc_html__( 'Include Directories', 'adirectory' ), 'type' => \Elementor\Controls_Manager::SELECT2, 'label_block' => true, 'multiple' => true, 'options' => $directory_types, ] ); $this->add_control( 'directory_dropdown', [ 'label' => esc_html__( 'Directory Dropdown After', 'adirectory' ), 'type' => Controls_Manager::NUMBER, 'min' => 1, 'step' => 1, 'default' => 5, ] ); // With shared taxonomies we expose a single control per taxonomy // Shared Categories control (taxonomy: 'adqs_category') if ( ! empty( $this->getTerms( 'adqs_category', 'slug' ) ) ) { $this->add_control( 'adqs_category', [ 'label' => esc_html__( 'Include Categories', 'adirectory' ), 'type' => \Elementor\Controls_Manager::SELECT2, 'label_block' => true, 'multiple' => true, 'options' => $this->getTerms( 'adqs_category', 'slug' ), 'separator' => 'before', ] ); } // Shared Locations control (taxonomy: 'adqs_location') if ( ! empty( $this->getTerms( 'adqs_location', 'slug' ) ) ) { $this->add_control( 'adqs_location', [ 'label' => esc_html__( 'Include Locations', 'adirectory' ), 'type' => \Elementor\Controls_Manager::SELECT2, 'label_block' => true, 'multiple' => true, 'options' => $this->getTerms( 'adqs_location', 'slug' ), 'separator' => 'before', ] ); } // Shared Tags control (taxonomy: 'adqs_tags') — use term_id as option value if ( ! empty( $this->getTerms( 'adqs_tags', 'term_id', false ) ) ) { $this->add_control( 'adqs_tags', [ 'label' => esc_html__( 'Include Tags', 'adirectory' ), 'type' => \Elementor\Controls_Manager::SELECT2, 'label_block' => true, 'multiple' => true, 'options' => $this->getTerms( 'adqs_tags', 'term_id', false ), 'separator' => 'before', ] ); } // Only show rating control if review system is enabled $enable_review = AD()->Helper->get_setting( 'enable_review' ); if ( ! empty( $enable_review ) ) { $this->add_control( 'rating', [ 'label' => esc_html__( 'Rating Up / Equal', 'adirectory' ), 'type' => Controls_Manager::SELECT, 'options' => [ '' => esc_html__( 'All', 'adirectory' ), '5' => esc_html__( '5', 'adirectory' ), '4' => esc_html__( '4', 'adirectory' ), '3' => esc_html__( '3', 'adirectory' ), '2' => esc_html__( '2', 'adirectory' ), '1' => esc_html__( '1', 'adirectory' ), ], ] ); } // Build sort options based on review system status $base_sort_options = [ 'date-desc' => esc_html__( 'Latest listings', 'adirectory' ), 'date-asc' => esc_html__( 'Oldest listings', 'adirectory' ), 'views-desc' => esc_html__( 'Popular listings', 'adirectory' ), 'title-asc' => esc_html__( 'A to Z (title)', 'adirectory' ), 'title-desc' => esc_html__( 'Z to A (title)', 'adirectory' ), 'price-asc' => esc_html__( 'Price (low to high)', 'adirectory' ), 'price-desc' => esc_html__( 'Price (high to low)', 'adirectory' ), 'rand' => esc_html__( 'Random listings', 'adirectory' ), ]; // Add rating options only if review system is enabled if ( ! empty( $enable_review ) ) { $base_sort_options['rating-desc'] = esc_html__( '5 to 1 (star rating)', 'adirectory' ); $base_sort_options['review-count'] = esc_html__( 'Review Count', 'adirectory' ); } $this->add_control( 'sort_by', [ 'label' => esc_html__( 'Order By', 'adirectory' ), 'type' => Controls_Manager::SELECT, 'options' => $base_sort_options, 'default' => 'date-desc', ] ); $this->add_control( 'per_page', [ 'label' => esc_html__( 'Items Per Page', 'adirectory' ), 'type' => Controls_Manager::NUMBER, 'min' => -1, 'step' => 1, 'default' => 6, ] ); $this->end_controls_section(); // end: Section // Carousel setting $this->start_controls_section( 'slider_option', [ 'label' => esc_html__( 'Carousel Option', 'adirectory' ), 'condition' => [ 'pagination_type' => 'carousel', ], ] ); $this->add_responsive_control( 'slitems', [ 'label' => esc_html__( 'Slider Items', 'adirectory' ), 'type' => Controls_Manager::NUMBER, 'min' => 1, 'max' => 20, 'step' => 1, 'default' => 3, ] ); $this->add_responsive_control( 'slrows', [ 'label' => esc_html__( 'Slider Rows', 'adirectory' ), 'type' => Controls_Manager::NUMBER, 'min' => 0, 'max' => 5, 'step' => 1, ] ); $this->add_control( 'slarrows', [ 'label' => esc_html__( 'Slider Arrow', 'adirectory' ), 'type' => Controls_Manager::SWITCHER, 'return_value' => 'yes', 'separator' => 'before', 'default' => 'yes', ] ); $this->add_responsive_control( 'slitemmargin', [ 'label' => esc_html__( 'Slider Item Margin', 'adirectory' ), 'type' => Controls_Manager::NUMBER, 'min' => 0, 'max' => 100, 'step' => 1, 'default' => 1, 'selectors' => [ '{{WRAPPER}} .slick-slider:not(.slick-vertical) .adqs-slick-item-col' => 'margin-left: {{VALUE}}px;margin-right:{{VALUE}}px;', '{{WRAPPER}} .slick-slider:not(.slick-vertical) .slick-list' => 'margin-left: -{{VALUE}}px;margin-right: -{{VALUE}}px;', '{{WRAPPER}} .slick-slider.slick-vertical .adqs-slick-item-col' => 'margin-top: {{VALUE}}px;margin-bottom:{{VALUE}}px;', '{{WRAPPER}} .slick-slider.slick-vertical .slick-list' => 'margin-top: -{{VALUE}}px;margin-bottom: -{{VALUE}}px;', ], ] ); $this->add_control( 'sldots', [ 'label' => esc_html__( 'Slider dots', 'adirectory' ), 'type' => Controls_Manager::SWITCHER, 'return_value' => 'yes', 'separator' => 'before', 'default' => 'no', ] ); $this->add_control( 'slpause_on_hover', [ 'type' => Controls_Manager::SWITCHER, 'label_off' => __( 'No', 'adirectory' ), 'label_on' => __( 'Yes', 'adirectory' ), 'return_value' => 'yes', 'separator' => 'before', 'default' => 'yes', 'label' => __( 'Pause on Hover?', 'adirectory' ), ] ); $this->add_control( 'slcentermode', [ 'label' => esc_html__( 'Center Mode', 'adirectory' ), 'type' => Controls_Manager::SWITCHER, 'return_value' => 'yes', 'separator' => 'before', 'default' => 'no', ] ); $this->add_control( 'slcenterpadding', [ 'label' => esc_html__( 'Center padding', 'adirectory' ), 'type' => Controls_Manager::NUMBER, 'min' => 0, 'max' => 500, 'step' => 1, 'default' => 50, 'condition' => [ 'slcentermode' => 'yes', ], ] ); $this->add_control( 'slfade', [ 'label' => esc_html__( 'Slider Fade', 'adirectory' ), 'type' => Controls_Manager::SWITCHER, 'return_value' => 'yes', 'separator' => 'before', 'default' => 'no', ] ); $this->add_control( 'slfocusonselect', [ 'label' => esc_html__( 'Focus On Select', 'adirectory' ), 'type' => Controls_Manager::SWITCHER, 'return_value' => 'yes', 'separator' => 'before', 'default' => 'no', ] ); $this->add_control( 'slvertical', [ 'label' => esc_html__( 'Vertical Slide', 'adirectory' ), 'type' => Controls_Manager::SWITCHER, 'return_value' => 'yes', 'separator' => 'before', 'default' => 'no', ] ); $this->add_control( 'slinfinite', [ 'label' => esc_html__( 'Infinite', 'adirectory' ), 'type' => Controls_Manager::SWITCHER, 'return_value' => 'yes', 'separator' => 'before', 'default' => 'yes', ] ); $this->add_control( 'slrtl', [ 'label' => esc_html__( 'RTL Slide', 'adirectory' ), 'type' => Controls_Manager::SWITCHER, 'return_value' => 'yes', 'separator' => 'before', 'default' => 'no', ] ); $this->add_control( 'slautoplay', [ 'label' => esc_html__( 'Slider auto play', 'adirectory' ), 'type' => Controls_Manager::SWITCHER, 'return_value' => 'yes', 'separator' => 'before', 'default' => 'no', ] ); $this->add_control( 'slautoplay_speed', [ 'label' => __( 'Autoplay speed', 'adirectory' ), 'type' => Controls_Manager::NUMBER, 'default' => 3000, ] ); $this->add_control( 'slanimation_speed', [ 'label' => __( 'Autoplay animation speed', 'adirectory' ), 'type' => Controls_Manager::NUMBER, 'default' => 300, ] ); $this->end_controls_section(); /* ----------------------- SLIDER OPTIONS END -------------------------*/ $this->start_controls_section( 'golbal_color', [ 'label' => esc_html__( 'Global Color', 'adirectory' ), 'tab' => \Elementor\Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'golbal_primary_color', [ 'label' => esc_html__( 'Primary Color', 'adirectory' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}}' => '--color-primary: {{VALUE}}', ], ] ); $this->add_control( 'golbal_secondary_color', [ 'label' => esc_html__( 'Secondary Color', 'adirectory' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}}' => '--color-secondary: {{VALUE}}', ], ] ); $this->end_controls_section(); /* ------------------------------ GOLOBAL STYLE OPTIONS END -------------------------------*/ $this->start_controls_section( 'all_listing_filter_container_styles', [ 'label' => esc_html__( 'Filter Box', 'adirectory' ), 'tab' => \Elementor\Controls_Manager::TAB_STYLE, 'condition' => [ 'filter_show' => 'true', ], ] ); $this->add_group_control( \Elementor\Group_Control_Typography::get_type(), [ 'name' => 'all_listing_filter_title_typography', 'selector' => '{{WRAPPER}} .qsd-prodcut-grid-with-side-bar-titel', ] ); $this->add_control( 'all_listing_filter_title_color', [ 'label' => esc_html__( 'Text Color', 'adirectory' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .qsd-prodcut-grid-with-side-bar-titel' => 'color: {{VALUE}}', ], ] ); $this->add_responsive_control( 'all_listing_filter_container_padding', [ 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'label' => esc_html__( 'padding', 'adirectory' ), 'size_units' => [ 'px', '%', 'em', 'rem' ], 'selectors' => [ '{{WRAPPER}} .qsd-prodcut-main-box' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}!important;', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'all_listing_container_styles', [ 'label' => esc_html__( 'Lisitng Container', 'adirectory' ), 'tab' => \Elementor\Controls_Manager::TAB_STYLE, ] ); $this->add_responsive_control( 'all_listing_grid_container_padding', [ 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'label' => esc_html__( 'padding', 'adirectory' ), 'size_units' => [ 'px', '%', 'em', 'rem' ], 'selectors' => [ '{{WRAPPER}} .qsd-prodcut-grid-with-side-bar-main' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}!important;', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'all_listing_styles', [ 'label' => esc_html__( 'Lisitng Grid', 'adirectory' ), 'tab' => \Elementor\Controls_Manager::TAB_STYLE, ] ); $this->add_responsive_control( 'grid_columns', [ 'label' => esc_html__( 'Gird Columns', 'adirectory' ), 'type' => Controls_Manager::NUMBER, 'min' => 1, 'max' => 12, 'step' => 1, 'default' => 3, 'condition' => [ 'pagination_type!' => 'carousel', ], 'selectors' => [ '{{WRAPPER}} .qsd-prodcut-grid-list-main' => '-ms-grid-columns: (1fr)[{{VALUE}}] !important; -webkit-grid-template-columns: repeat({{VALUE}}, 1fr) !important; -moz-grid-template-columns: repeat({{VALUE}}, 1fr) !important; -o-grid-template-columns: repeat({{VALUE}}, 1fr) !important; grid-template-columns: repeat({{VALUE}}, 1fr) !important;', ], ] ); $this->add_responsive_control( 'list_columns', [ 'label' => esc_html__( 'List Columns', 'adirectory' ), 'type' => Controls_Manager::NUMBER, 'min' => 1, 'max' => 12, 'step' => 1, 'default' => 2, 'condition' => [ 'pagination_type!' => 'carousel', ], 'selectors' => [ '{{WRAPPER}} .qsd-prodcut-grid-list-main.list-view' => '-ms-grid-columns: (1fr)[{{VALUE}}] !important; -webkit-grid-template-columns: repeat({{VALUE}}, 1fr) !important; -moz-grid-template-columns: repeat({{VALUE}}, 1fr) !important; -o-grid-template-columns: repeat({{VALUE}}, 1fr) !important; grid-template-columns: repeat({{VALUE}}, 1fr) !important;', ], ] ); $this->add_responsive_control( 'grid_columns_gap', [ 'label' => esc_html__( 'Grid Columns Gap', 'adirectory' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ '%', 'px', 'vw' ], 'range' => [ '%' => [ 'min' => 0, 'max' => 100, ], 'px' => [ 'min' => 0, 'max' => 1000, ], 'vw' => [ 'min' => 0, 'max' => 100, ], ], 'condition' => [ 'pagination_type!' => 'carousel', ], 'selectors' => [ '{{WRAPPER}} .qsd-prodcut-grid-list-main' => 'gap: {{SIZE}}{{UNIT}} !important;', ], ] ); $this->add_responsive_control( 'list_columns_gap', [ 'label' => esc_html__( 'List Columns Gap', 'adirectory' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ '%', 'px', 'vw' ], 'range' => [ '%' => [ 'min' => 0, 'max' => 100, ], 'px' => [ 'min' => 0, 'max' => 1000, ], 'vw' => [ 'min' => 0, 'max' => 100, ], ], 'condition' => [ 'pagination_type!' => 'carousel', ], 'selectors' => [ '{{WRAPPER}} .qsd-prodcut-grid-list-main.list-view' => 'gap: {{SIZE}}{{UNIT}} !important;', ], ] ); $this->start_controls_tabs( 'all_listing_style_tabs' ); $this->start_controls_tab( 'all_listing_style_normal_tab', [ 'label' => esc_html__( 'Normal', 'adirectory' ), ] ); $this->add_group_control( \Elementor\Group_Control_Typography::get_type(), [ 'name' => 'all_listing_title_typography', 'selector' => '{{WRAPPER}} .grid-list-inner-txt', ] ); $this->add_control( 'all_listing_title_color', [ 'label' => esc_html__( 'Text Color', 'adirectory' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .grid-list-inner-txt' => 'color: {{VALUE}}', ], ] ); $this->add_control( 'all_listing_title_wishlist_color', [ 'label' => esc_html__( 'Fovorite Color', 'adirectory' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .qsd-single-group.adqs-add-fav-btn button path' => 'fill: {{VALUE}}', ], ] ); $this->add_responsive_control( 'all_listing_grid_padding', [ 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'label' => esc_html__( 'Padding', 'adirectory' ), 'size_units' => [ 'px', '%', 'em', 'rem' ], 'selectors' => [ '{{WRAPPER}} .qsd-prodcut-grid-list-inner' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}}!important;', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'all_listing_style_hover_tab', [ 'label' => esc_html__( 'Hover', 'adirectory' ), ] ); $this->add_control( 'all_listing_title_hover_color', [ 'label' => esc_html__( 'Text Color', 'adirectory' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .grid-list-inner-txt:hover' => 'color: {{VALUE}}', ], ] ); $this->add_control( 'all_listing_title_wishlist_hover_color', [ 'label' => esc_html__( 'Fovorite Color', 'adirectory' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .qsd-single-group.adqs-active-fav button path' => 'fill: {{VALUE}}', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); } /** * Render Advanced widget output on the frontend. * * Written in PHP and used to generate the final HTML. * * @since 1.0.0 * @access protected */ protected function render() { $settings = $this->get_settings_for_display(); $action_elementor = Plugin::instance()->editor->is_edit_mode() ? true : false; $filter_show = $settings['filter_show'] ?? 'true'; $filter_layout = $settings['filter_layout'] ?? 'top'; $ajax_filter = $settings['ajax_filter'] ?? ''; $top_bar_show = $settings['top_bar_show'] ?? 'true'; $view_bar_show = $settings['view_bar_show'] ?? 'true'; $reset_filter = $settings['reset_filter'] ?? 'true'; $sort_by_show = $settings['sort_by_show'] ?? 'true'; $pagination_type = $settings['pagination_type'] ?? 'pagination'; $view_type = $settings['view_type'] ?? 'grid'; $has_map_view = $settings['has_map_view'] ?? 'true'; // Only use rating if review system is enabled $enable_review = AD()->Helper->get_setting( 'enable_review' ); $rating = ( ! empty( $enable_review ) && isset( $settings['rating'] ) ) ? $settings['rating'] : ''; $display_listings = $settings['display_listings'] ?? ''; $sort_by = $settings['sort_by'] ?? ''; $per_page = $settings['per_page'] ?? 6; $directory_dropdown = $settings['directory_dropdown'] ?? 5; $style_type = $settings['style_type'] ?? ''; // Handle multi-directory taxonomies $custom_directory = $this->get_join_data( $settings['custom_directory'] ?? [] ); // Collect taxonomies from all selected directories // Taxonomies are now static and shared across all post types (works with or without custom_directory) // Get terms directly from settings without looping through directories $all_categories = ! empty( $settings['adqs_category'] ) ? (array) $settings['adqs_category'] : []; $all_locations = ! empty( $settings['adqs_location'] ) ? (array) $settings['adqs_location'] : []; $all_tags = ! empty( $settings['adqs_tags'] ) ? (array) $settings['adqs_tags'] : []; // Join collected taxonomies $categories = $this->get_join_data( $all_categories ); $locations = $this->get_join_data( $all_locations ); $tags = $this->get_join_data( $all_tags ); $breakpoints = \Elementor\Plugin::$instance->breakpoints->get_active_breakpoints(); $responsiveBreakpoints = []; foreach ( $breakpoints as $key => $breakpoint ) { $responsiveBreakpoints[ $key ] = $breakpoint->is_enabled() ? $breakpoint->get_value() : 0; } $carousel_settings = []; if ( $pagination_type === 'carousel' ) { $carousel_settings = [ 'arrows' => ( 'yes' === ( $settings['slarrows'] ?? '' ) ), 'dots' => ( 'yes' === ( $settings['sldots'] ?? '' ) ), 'autoplay' => ( 'yes' === ( $settings['slautoplay'] ?? '' ) ), 'autoplay_speed' => absint( $settings['slautoplay_speed'] ?? 3000 ), 'animation_speed' => absint( $settings['slanimation_speed'] ?? 300 ), 'pause_on_hover' => ( 'yes' === ( $settings['slpause_on_hover'] ?? '' ) ), 'center_mode' => ( 'yes' === ( $settings['slcentermode'] ?? '' ) ), 'center_padding' => ! empty( $settings['slcenterpadding'] ?? '' ) ? $settings['slcenterpadding'] . 'px' : '50px', 'rows' => absint( $settings['slrows'] ?? 1 ), 'fade' => ( 'yes' === ( $settings['slfade'] ?? '' ) ), 'focusonselect' => ( 'yes' === ( $settings['slfocusonselect'] ?? '' ) ), 'vertical' => ( 'yes' === ( $settings['slvertical'] ?? '' ) ), 'rtl' => ( 'yes' === ( $settings['slrtl'] ?? '' ) ), 'infinite' => ( 'yes' === ( $settings['slinfinite'] ?? '' ) ), 'display_columns' => absint( $settings['slitems'] ?? 3 ), 'display_scroll' => absint( $settings['slrows'] ?? 1 ), 'display_columns_widescreen' => isset( $responsiveBreakpoints['widescreen'] ) ? absint( $settings['slitems_widescreen'] ?? 0 ) : 0, 'display_scroll_widescreen' => isset( $responsiveBreakpoints['widescreen'] ) ? absint( $settings['slrows_widescreen'] ?? 0 ) : 0, 'display_columns_laptop' => absint( $settings['slitems_laptop'] ?? 0 ), 'display_scroll_laptop' => absint( $settings['slrows_laptop'] ?? 0 ), 'display_columns_tablet_extra' => absint( $settings['slitems_tablet_extra'] ?? 0 ), 'display_scroll_tablet_extra' => absint( $settings['slrows_tablet_extra'] ?? 0 ), 'display_columns_tablet' => absint( $settings['slitems_tablet'] ?? 0 ), 'display_scroll_tablet' => absint( $settings['slrows_tablet'] ?? 0 ), 'display_columns_mobile_extra' => absint( $settings['slitems_mobile_extra'] ?? 0 ), 'display_scroll_mobile_extra' => absint( $settings['slrows_mobile_extra'] ?? 0 ), 'display_columns_mobile' => absint( $settings['slitems_mobile'] ?? 0 ), 'display_scroll_mobile' => absint( $settings['slrows_mobile'] ?? 0 ), 'responsive_breakpoints' => $responsiveBreakpoints, ]; } $uniqId = uniqid(); $carousel_settings['uniq_id'] = $uniqId; $carousel_settings = wp_json_encode( $carousel_settings ); // Next Icon ob_start(); \Elementor\Icons_Manager::render_icon( $settings['next_icon_upload'], [ 'aria-hidden' => 'true' ] ); $next_icon = ob_get_clean(); // Previous Icon ob_start(); \Elementor\Icons_Manager::render_icon( $settings['prev_icon_upload'], [ 'aria-hidden' => 'true' ] ); $prev_icon = ob_get_clean(); $shortcode = "[adqs_listings filter_show='{$filter_show}' ajax_filter='{$ajax_filter}' top_bar_show='{$top_bar_show}' view_bar_show='{$view_bar_show}' sort_by_show='{$sort_by_show}' reset_filter='{$reset_filter}' filter_layout='{$filter_layout}' pagination_type='{$pagination_type}' view_type='{$view_type}' has_map_view='{$has_map_view}' per_page='{$per_page}' custom_directory='{$custom_directory}' categories='{$categories}' locations='{$locations}' tags='{$tags}' rating='{$rating}' display_listings='{$display_listings}' sort_by='{$sort_by}' carousel_settings='{$carousel_settings}' uniq_id='{$uniqId}' directory_dropdown='{$directory_dropdown}' style_type='{$style_type}' from_addon='true' next_icon='{$next_icon}' prev_icon='{$prev_icon}' ]"; echo do_shortcode( $shortcode ); } /** * Render widget output in the editor. * * Written as a Backbone JavaScript template and used to generate the live preview. * * @since 1.0.0 * @access protected */ // protected function _content_template(){} } Plugin::instance()->widgets_manager->register( new Listing_By() );