true, ], 'objects'); $options = []; foreach ($post_types as $post_type) { // Exclude Elementor specific post types if (in_array($post_type->name, ['elementor_library', 'attachment'])) { continue; } $options[$post_type->name] = $post_type->label; } return $options; } /** * Get available taxonomies for selected post type */ private function get_taxonomies() { $taxonomies = get_taxonomies([ 'public' => true, ], 'objects'); $options = ['' => esc_html__('None', 'advanced-widget-kit-for-elementor')]; foreach ($taxonomies as $taxonomy) { if (in_array($taxonomy->name, ['post_format', 'nav_menu', 'link_category'])) { continue; } $options[$taxonomy->name] = $taxonomy->label; } return $options; } /** * Register widget controls. */ protected function _register_controls() { // ===================== // QUERY SECTION // ===================== $this->start_controls_section( 'query_section', [ 'label' => esc_html__('Query', 'advanced-widget-kit-for-elementor'), 'tab' => \Elementor\Controls_Manager::TAB_CONTENT, ] ); $this->add_control( 'post_type', [ 'label' => esc_html__('Post Type', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::SELECT, 'default' => 'post', 'options' => $this->get_post_types(), ] ); $this->add_control( 'posts_per_page', [ 'label' => esc_html__('Posts Per Page', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::NUMBER, 'default' => 6, 'min' => 1, 'max' => 100, ] ); $this->add_control( 'order_by', [ 'label' => esc_html__('Order By', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::SELECT, 'default' => 'date', 'options' => [ 'date' => esc_html__('Date', 'advanced-widget-kit-for-elementor'), 'title' => esc_html__('Title', 'advanced-widget-kit-for-elementor'), 'modified' => esc_html__('Modified Date', 'advanced-widget-kit-for-elementor'), 'rand' => esc_html__('Random', 'advanced-widget-kit-for-elementor'), 'menu_order' => esc_html__('Menu Order', 'advanced-widget-kit-for-elementor'), 'ID' => esc_html__('ID', 'advanced-widget-kit-for-elementor'), ], ] ); $this->add_control( 'order', [ 'label' => esc_html__('Order', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::SELECT, 'default' => 'DESC', 'options' => [ 'ASC' => esc_html__('Ascending', 'advanced-widget-kit-for-elementor'), 'DESC' => esc_html__('Descending', 'advanced-widget-kit-for-elementor'), ], ] ); $this->add_control( 'filter_taxonomy', [ 'label' => esc_html__('Filter by Taxonomy', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::SELECT, 'default' => '', 'options' => $this->get_taxonomies(), ] ); $this->add_control( 'taxonomy_terms', [ 'label' => esc_html__('Taxonomy Terms (comma separated IDs)', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::TEXT, 'placeholder' => esc_html__('1, 2, 3', 'advanced-widget-kit-for-elementor'), 'condition' => [ 'filter_taxonomy!' => '', ], ] ); $this->add_control( 'exclude_posts', [ 'label' => esc_html__('Exclude Posts (comma separated IDs)', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::TEXT, 'placeholder' => esc_html__('1, 2, 3', 'advanced-widget-kit-for-elementor'), ] ); $this->end_controls_section(); // ===================== // LAYOUT SECTION // ===================== $this->start_controls_section( 'layout_section', [ 'label' => esc_html__('Layout', 'advanced-widget-kit-for-elementor'), 'tab' => \Elementor\Controls_Manager::TAB_CONTENT, ] ); $this->add_control( 'layout_type', [ 'label' => esc_html__('Layout Type', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::SELECT, 'default' => 'grid', 'options' => [ 'grid' => esc_html__('Grid', 'advanced-widget-kit-for-elementor'), 'list' => esc_html__('List', 'advanced-widget-kit-for-elementor'), 'masonry' => esc_html__('Masonry', 'advanced-widget-kit-for-elementor'), ], ] ); $this->add_responsive_control( 'columns', [ 'label' => esc_html__('Columns', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::SELECT, 'default' => '3', 'tablet_default' => '2', 'mobile_default' => '1', 'options' => [ '1' => '1', '2' => '2', '3' => '3', '4' => '4', '5' => '5', '6' => '6', ], 'condition' => [ 'layout_type!' => 'list', ], ] ); $this->add_responsive_control( 'column_gap', [ 'label' => esc_html__('Column Gap', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::SLIDER, 'default' => [ 'size' => 30, ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .awke-posts-grid' => 'column-gap: {{SIZE}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'row_gap', [ 'label' => esc_html__('Row Gap', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::SLIDER, 'default' => [ 'size' => 30, ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}} .awke-posts-grid' => 'row-gap: {{SIZE}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'grid_alignment', [ 'label' => esc_html__('Grid Alignment', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::CHOOSE, 'options' => [ 'left' => [ 'title' => esc_html__('Left', 'advanced-widget-kit-for-elementor'), 'icon' => 'eicon-h-align-left', ], 'center' => [ 'title' => esc_html__('Center', 'advanced-widget-kit-for-elementor'), 'icon' => 'eicon-h-align-center', ], 'right' => [ 'title' => esc_html__('Right', 'advanced-widget-kit-for-elementor'), 'icon' => 'eicon-h-align-right', ], ], 'default' => 'left', 'prefix_class' => 'awke-grid-align-', 'condition' => [ 'layout_type!' => 'list', ], ] ); $this->add_control( 'image_position_list', [ 'label' => esc_html__('Image Position', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::CHOOSE, 'options' => [ 'left' => [ 'title' => esc_html__('Left', 'advanced-widget-kit-for-elementor'), 'icon' => 'eicon-h-align-left', ], 'right' => [ 'title' => esc_html__('Right', 'advanced-widget-kit-for-elementor'), 'icon' => 'eicon-h-align-right', ], 'top' => [ 'title' => esc_html__('Top', 'advanced-widget-kit-for-elementor'), 'icon' => 'eicon-v-align-top', ], ], 'default' => 'left', 'condition' => [ 'layout_type' => 'list', ], ] ); $this->add_control( 'image_position_grid', [ 'label' => esc_html__('Image Position', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::CHOOSE, 'options' => [ 'top' => [ 'title' => esc_html__('Top', 'advanced-widget-kit-for-elementor'), 'icon' => 'eicon-v-align-top', ], 'bottom' => [ 'title' => esc_html__('Bottom', 'advanced-widget-kit-for-elementor'), 'icon' => 'eicon-v-align-bottom', ], ], 'default' => 'top', 'condition' => [ 'layout_type!' => 'list', ], ] ); $this->add_responsive_control( 'list_image_width', [ 'label' => esc_html__('Image Width', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::SLIDER, 'size_units' => ['px', '%'], 'range' => [ 'px' => [ 'min' => 100, 'max' => 600, ], '%' => [ 'min' => 20, 'max' => 50, ], ], 'default' => [ 'size' => 300, 'unit' => 'px', ], 'selectors' => [ '{{WRAPPER}} .awke-posts-list .awke-post-image' => 'flex: 0 0 {{SIZE}}{{UNIT}}; max-width: {{SIZE}}{{UNIT}};', ], 'condition' => [ 'layout_type' => 'list', 'image_position_list!' => 'top', ], ] ); $this->add_responsive_control( 'content_alignment', [ 'label' => esc_html__('Content Alignment', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::CHOOSE, 'options' => [ 'left' => [ 'title' => esc_html__('Left', 'advanced-widget-kit-for-elementor'), 'icon' => 'eicon-text-align-left', ], 'center' => [ 'title' => esc_html__('Center', 'advanced-widget-kit-for-elementor'), 'icon' => 'eicon-text-align-center', ], 'right' => [ 'title' => esc_html__('Right', 'advanced-widget-kit-for-elementor'), 'icon' => 'eicon-text-align-right', ], 'justify' => [ 'title' => esc_html__('Justified', 'advanced-widget-kit-for-elementor'), 'icon' => 'eicon-text-align-justify', ], ], 'default' => 'left', 'selectors' => [ '{{WRAPPER}} .awke-post-content' => 'text-align: {{VALUE}};', ], 'selectors_dictionary' => [ 'left' => 'text-align: left; align-items: flex-start;', 'center' => 'text-align: center; align-items: center;', 'right' => 'text-align: right; align-items: flex-end;', 'justify' => 'text-align: justify; align-items: flex-start;', ], 'toggle' => true, ] ); $this->add_control( 'show_image', [ 'label' => esc_html__('Show Featured Image', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::SWITCHER, 'label_on' => esc_html__('Yes', 'advanced-widget-kit-for-elementor'), 'label_off' => esc_html__('No', 'advanced-widget-kit-for-elementor'), 'return_value' => 'yes', 'default' => 'yes', ] ); $this->add_control( 'image_size', [ 'label' => esc_html__('Image Size', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::SELECT, 'default' => 'medium', 'options' => [ 'thumbnail' => esc_html__('Thumbnail', 'advanced-widget-kit-for-elementor'), 'medium' => esc_html__('Medium', 'advanced-widget-kit-for-elementor'), 'medium_large' => esc_html__('Medium Large', 'advanced-widget-kit-for-elementor'), 'large' => esc_html__('Large', 'advanced-widget-kit-for-elementor'), 'full' => esc_html__('Full', 'advanced-widget-kit-for-elementor'), ], 'condition' => [ 'show_image' => 'yes', ], ] ); $this->add_control( 'show_title', [ 'label' => esc_html__('Show Title', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::SWITCHER, 'label_on' => esc_html__('Yes', 'advanced-widget-kit-for-elementor'), 'label_off' => esc_html__('No', 'advanced-widget-kit-for-elementor'), 'return_value' => 'yes', 'default' => 'yes', ] ); $this->add_control( 'title_tag', [ 'label' => esc_html__('Title HTML Tag', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::SELECT, 'default' => 'h3', 'options' => [ 'h1' => 'H1', 'h2' => 'H2', 'h3' => 'H3', 'h4' => 'H4', 'h5' => 'H5', 'h6' => 'H6', ], 'condition' => [ 'show_title' => 'yes', ], ] ); $this->add_control( 'show_excerpt', [ 'label' => esc_html__('Show Excerpt', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::SWITCHER, 'label_on' => esc_html__('Yes', 'advanced-widget-kit-for-elementor'), 'label_off' => esc_html__('No', 'advanced-widget-kit-for-elementor'), 'return_value' => 'yes', 'default' => 'yes', ] ); $this->add_control( 'excerpt_length', [ 'label' => esc_html__('Excerpt Length (words)', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::NUMBER, 'default' => 20, 'min' => 1, 'max' => 100, 'condition' => [ 'show_excerpt' => 'yes', ], ] ); $this->add_control( 'show_date', [ 'label' => esc_html__('Show Date', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::SWITCHER, 'label_on' => esc_html__('Yes', 'advanced-widget-kit-for-elementor'), 'label_off' => esc_html__('No', 'advanced-widget-kit-for-elementor'), 'return_value' => 'yes', 'default' => 'yes', ] ); $this->add_control( 'show_author', [ 'label' => esc_html__('Show Author', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::SWITCHER, 'label_on' => esc_html__('Yes', 'advanced-widget-kit-for-elementor'), 'label_off' => esc_html__('No', 'advanced-widget-kit-for-elementor'), 'return_value' => 'yes', 'default' => 'no', ] ); $this->add_control( 'show_read_more', [ 'label' => esc_html__('Show Read More Button', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::SWITCHER, 'label_on' => esc_html__('Yes', 'advanced-widget-kit-for-elementor'), 'label_off' => esc_html__('No', 'advanced-widget-kit-for-elementor'), 'return_value' => 'yes', 'default' => 'yes', ] ); $this->add_control( 'read_more_text', [ 'label' => esc_html__('Read More Text', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::TEXT, 'default' => esc_html__('Read More', 'advanced-widget-kit-for-elementor'), 'condition' => [ 'show_read_more' => 'yes', ], ] ); $this->end_controls_section(); // ===================== // PAGINATION SECTION // ===================== $this->start_controls_section( 'pagination_section', [ 'label' => esc_html__('Pagination', 'advanced-widget-kit-for-elementor'), 'tab' => \Elementor\Controls_Manager::TAB_CONTENT, ] ); $this->add_control( 'show_pagination', [ 'label' => esc_html__('Show Pagination', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::SWITCHER, 'label_on' => esc_html__('Yes', 'advanced-widget-kit-for-elementor'), 'label_off' => esc_html__('No', 'advanced-widget-kit-for-elementor'), 'return_value' => 'yes', 'default' => 'no', ] ); $this->add_control( 'pagination_type', [ 'label' => esc_html__('Pagination Type', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::SELECT, 'default' => 'numbers', 'options' => [ 'numbers' => esc_html__('Numbers', 'advanced-widget-kit-for-elementor'), 'prev_next' => esc_html__('Previous/Next', 'advanced-widget-kit-for-elementor'), 'load_more' => esc_html__('Load More Button', 'advanced-widget-kit-for-elementor'), ], 'condition' => [ 'show_pagination' => 'yes', ], ] ); $this->end_controls_section(); // ===================== // STYLE SECTIONS // ===================== // Post Card Style $this->start_controls_section( 'card_style_section', [ 'label' => esc_html__('Post Card', 'advanced-widget-kit-for-elementor'), 'tab' => \Elementor\Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'card_background', [ 'label' => esc_html__('Background Color', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::COLOR, 'default' => '#ffffff', 'selectors' => [ '{{WRAPPER}} .awke-post-item' => 'background-color: {{VALUE}};', ], ] ); $this->add_group_control( \Elementor\Group_Control_Border::get_type(), [ 'name' => 'card_border', 'selector' => '{{WRAPPER}} .awke-post-item', ] ); $this->add_responsive_control( 'card_border_radius', [ 'label' => esc_html__('Border Radius', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'size_units' => ['px', '%'], 'selectors' => [ '{{WRAPPER}} .awke-post-item' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', '{{WRAPPER}} .awke-post-image img' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} 0 0;', ], ] ); $this->add_group_control( \Elementor\Group_Control_Box_Shadow::get_type(), [ 'name' => 'card_shadow', 'selector' => '{{WRAPPER}} .awke-post-item', ] ); $this->add_responsive_control( 'card_padding', [ 'label' => esc_html__('Padding', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'size_units' => ['px', 'em', '%'], 'selectors' => [ '{{WRAPPER}} .awke-post-content' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->end_controls_section(); // Title Style $this->start_controls_section( 'title_style_section', [ 'label' => esc_html__('Title', 'advanced-widget-kit-for-elementor'), 'tab' => \Elementor\Controls_Manager::TAB_STYLE, 'condition' => [ 'show_title' => 'yes', ], ] ); $this->add_control( 'title_color', [ 'label' => esc_html__('Color', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::COLOR, 'default' => '#333333', 'selectors' => [ '{{WRAPPER}} .awke-post-title a' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'title_hover_color', [ 'label' => esc_html__('Hover Color', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::COLOR, 'default' => '#667eea', 'selectors' => [ '{{WRAPPER}} .awke-post-title a:hover' => 'color: {{VALUE}};', ], ] ); $this->add_group_control( \Elementor\Group_Control_Typography::get_type(), [ 'name' => 'title_typography', 'selector' => '{{WRAPPER}} .awke-post-title', ] ); $this->add_responsive_control( 'title_spacing', [ 'label' => esc_html__('Spacing', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 50, ], ], 'selectors' => [ '{{WRAPPER}} .awke-post-title' => 'margin-bottom: {{SIZE}}{{UNIT}};', ], ] ); $this->end_controls_section(); // Excerpt Style $this->start_controls_section( 'excerpt_style_section', [ 'label' => esc_html__('Excerpt', 'advanced-widget-kit-for-elementor'), 'tab' => \Elementor\Controls_Manager::TAB_STYLE, 'condition' => [ 'show_excerpt' => 'yes', ], ] ); $this->add_control( 'excerpt_color', [ 'label' => esc_html__('Color', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::COLOR, 'default' => '#666666', 'selectors' => [ '{{WRAPPER}} .awke-post-excerpt' => 'color: {{VALUE}};', ], ] ); $this->add_group_control( \Elementor\Group_Control_Typography::get_type(), [ 'name' => 'excerpt_typography', 'selector' => '{{WRAPPER}} .awke-post-excerpt', ] ); $this->add_responsive_control( 'excerpt_spacing', [ 'label' => esc_html__('Spacing', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 50, ], ], 'selectors' => [ '{{WRAPPER}} .awke-post-excerpt' => 'margin-bottom: {{SIZE}}{{UNIT}};', ], ] ); $this->end_controls_section(); // Meta Style $this->start_controls_section( 'meta_style_section', [ 'label' => esc_html__('Meta', 'advanced-widget-kit-for-elementor'), 'tab' => \Elementor\Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'meta_color', [ 'label' => esc_html__('Color', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::COLOR, 'default' => '#999999', 'selectors' => [ '{{WRAPPER}} .awke-post-meta' => 'color: {{VALUE}};', ], ] ); $this->add_group_control( \Elementor\Group_Control_Typography::get_type(), [ 'name' => 'meta_typography', 'selector' => '{{WRAPPER}} .awke-post-meta', ] ); $this->add_responsive_control( 'meta_spacing', [ 'label' => esc_html__('Spacing', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 50, ], ], 'selectors' => [ '{{WRAPPER}} .awke-post-meta' => 'margin-bottom: {{SIZE}}{{UNIT}};', ], ] ); $this->end_controls_section(); // Read More Button Style $this->start_controls_section( 'button_style_section', [ 'label' => esc_html__('Read More Button', 'advanced-widget-kit-for-elementor'), 'tab' => \Elementor\Controls_Manager::TAB_STYLE, 'condition' => [ 'show_read_more' => 'yes', ], ] ); $this->start_controls_tabs('button_style_tabs'); $this->start_controls_tab( 'button_normal_tab', [ 'label' => esc_html__('Normal', 'advanced-widget-kit-for-elementor'), ] ); $this->add_control( 'button_text_color', [ 'label' => esc_html__('Text Color', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::COLOR, 'default' => '#ffffff', 'selectors' => [ '{{WRAPPER}} .awke-post-read-more' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'button_background_color', [ 'label' => esc_html__('Background Color', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::COLOR, 'default' => '#667eea', 'selectors' => [ '{{WRAPPER}} .awke-post-read-more' => 'background-color: {{VALUE}};', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'button_hover_tab', [ 'label' => esc_html__('Hover', 'advanced-widget-kit-for-elementor'), ] ); $this->add_control( 'button_hover_text_color', [ 'label' => esc_html__('Text Color', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::COLOR, 'default' => '#ffffff', 'selectors' => [ '{{WRAPPER}} .awke-post-read-more:hover' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'button_hover_background_color', [ 'label' => esc_html__('Background Color', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::COLOR, 'default' => '#764ba2', 'selectors' => [ '{{WRAPPER}} .awke-post-read-more:hover' => 'background-color: {{VALUE}};', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->add_group_control( \Elementor\Group_Control_Typography::get_type(), [ 'name' => 'button_typography', 'selector' => '{{WRAPPER}} .awke-post-read-more', 'separator' => 'before', ] ); $this->add_responsive_control( 'button_padding', [ 'label' => esc_html__('Padding', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'size_units' => ['px', 'em'], 'selectors' => [ '{{WRAPPER}} .awke-post-read-more' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'button_border_radius', [ 'label' => esc_html__('Border Radius', 'advanced-widget-kit-for-elementor'), 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'size_units' => ['px', '%'], 'selectors' => [ '{{WRAPPER}} .awke-post-read-more' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->end_controls_section(); } /** * Render widget output on the frontend. */ protected function render() { $settings = $this->get_settings_for_display(); // Get current page number $paged = 1; if ($settings['show_pagination'] === 'yes') { // Check multiple sources for page number if (get_query_var('paged')) { $paged = get_query_var('paged'); } elseif (get_query_var('page')) { $paged = get_query_var('page'); } elseif (isset($_GET['paged'])) { $paged = absint($_GET['paged']); } } // Build query arguments $args = [ 'post_type' => $settings['post_type'], 'posts_per_page' => intval($settings['posts_per_page']), 'orderby' => $settings['order_by'], 'order' => $settings['order'], 'post_status' => 'publish', 'paged' => $paged, 'ignore_sticky_posts' => true, ]; // Exclude posts if (!empty($settings['exclude_posts'])) { $exclude_ids = array_map('absint', array_map('trim', explode(',', $settings['exclude_posts']))); $args['post__not_in'] = $exclude_ids; } // Taxonomy filter if (!empty($settings['filter_taxonomy']) && !empty($settings['taxonomy_terms'])) { $term_ids = array_map('absint', array_map('trim', explode(',', $settings['taxonomy_terms']))); $args['tax_query'] = [ [ 'taxonomy' => $settings['filter_taxonomy'], 'field' => 'term_id', 'terms' => $term_ids, ], ]; } $query = new \WP_Query($args); if (!$query->have_posts()) { echo '
' . esc_html__('No posts found.', 'advanced-widget-kit-for-elementor') . '
'; // Debug info for admin if (defined('WP_DEBUG') && WP_DEBUG && current_user_can('manage_options')) { echo '