start_controls_section( 'filter_sec', [ 'label' => esc_html__( 'Filter Options', 'bbp-core' ), ] ); $this->add_control( 'ppp2', [ 'label' => esc_html__( 'Show Forums', 'bbp-core' ), 'description' => esc_html__( 'Show the forums count at the initial view. Default is 9 forums in a row.', 'bbp-core' ), 'type' => \Elementor\Controls_Manager::NUMBER, 'default' => 9 ] ); $this->add_control( 'order', [ 'label' => esc_html__( 'Order', 'bbp-core' ), 'type' => \Elementor\Controls_Manager::SELECT, 'options' => [ 'ASC' => 'ASC', 'DESC' => 'DESC' ], 'default' => 'ASC' ] ); // button show hide switcher $this->add_control( 'filter_btns', [ 'label' => esc_html__( 'Tab Filter', 'bbp-core' ), 'type' => \Elementor\Controls_Manager::SWITCHER, 'label_on' => esc_html__( 'Show', 'bbp-core' ), 'label_off' => esc_html__( 'Hide', 'bbp-core' ), 'return_value' => 'yes', 'default' => 'yes', ] ); $this->end_controls_section(); /** * Styling section starts */ $this->start_controls_section( 'styling_sec', [ 'label' => esc_html__( 'Title Style', 'bbp-core' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); //forum title $this->add_control( 'forum_heading', [ 'label' => esc_html__( 'Forum Title', 'bbp-core' ), 'type' => \Elementor\Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_control( 'forum_title_color', [ 'label' => esc_html__( 'Color', 'bbp-core' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .single-forum-post-widget .post-title a' => 'color: {{VALUE}}', ], ] ); $this->add_control( 'forum_title_hover_color', [ 'label' => esc_html__( 'Hover Color', 'bbp-core' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .single-forum-post-widget .post-title a:hover' => 'color: {{VALUE}}', ], ] ); $this->add_group_control( \Elementor\Group_Control_Typography::get_type(), [ 'name' => 'forum_title_typography', 'selector' => '{{WRAPPER}} .single-forum-post-widget .post-title a', ] ); // Forum meta $this->add_control( 'forum_meta', [ 'label' => esc_html__( 'Forum Meta', 'bbp-core' ), 'type' => \Elementor\Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_control( 'forum_meta_color', [ 'label' => esc_html__( 'Color', 'bbp-core' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .single-forum-post-widget .post-info .author,{{WRAPPER}} .single-forum-post-widget .post-info .post-time' => 'color: {{VALUE}}', ], ] ); $this->add_group_control( \Elementor\Group_Control_Typography::get_type(), [ 'name' => 'forum_meta_typography', 'selector' => '{{WRAPPER}} .single-forum-post-widget .post-info .author,{{WRAPPER}} .single-forum-post-widget .post-info .post-time', ] ); //parent forum $this->add_control( 'parent_forum', [ 'label' => esc_html__( 'Parent Forum', 'bbp-core' ), 'type' => \Elementor\Controls_Manager::HEADING, 'separator' => 'before', ] ); $this->add_control( 'parent_forum_color', [ 'label' => esc_html__( 'Color', 'bbp-core' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .post-content .post-category a' => 'color: {{VALUE}}', ], ] ); $this->add_control( 'parent_forum_color_hover', [ 'label' => esc_html__( 'Hover color', 'bbp-core' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .post-content .post-category a:hover' => 'color: {{VALUE}}', ], ] ); $this->add_group_control( \Elementor\Group_Control_Typography::get_type(), [ 'name' => 'parent_forum_typo', 'selector' => '{{WRAPPER}} .post-content .post-category a', ] ); $this->end_controls_section(); } protected function render() { $settings = $this->get_settings(); $filter_btns = $settings['filter_btns'] ?? true; $topics = new WP_Query( array( 'post_type' => 'topic', 'posts_per_page' => ! empty( $settings['ppp2'] ) ? $settings['ppp2'] : 9, 'order' => $settings['order'] ? $settings['order'] : 'DESC', ) ); ?>