start_controls_section( 'filter_opt', [ 'label' => __( 'Filter Options', 'bbp-core' ), ] ); $this->add_control( 'ppp', [ 'label' => esc_html__( 'Show Forums', 'bbp-core' ), 'description' => esc_html__( 'Show the forums count at the initial view. Default is 5 forums in a row.', 'bbp-core' ), 'type' => Controls_Manager::NUMBER, 'label_block' => true, 'default' => 5 ] ); $this->add_control( 'ppp2', [ 'label' => esc_html__( 'Hidden Forums', 'bbp-core' ), 'description' => esc_html__( 'Hidden forums will show on clicking on the More button.', 'bbp-core' ), 'type' => Controls_Manager::NUMBER, 'label_block' => true, 'default' => 10 ] ); $this->add_control( 'order', [ 'label' => esc_html__( 'Order', 'bbp-core' ), 'type' => Controls_Manager::SELECT, 'options' => [ 'ASC' => 'ASC', 'DESC' => 'DESC' ], 'default' => 'ASC' ] ); $this->add_control( 'more_txt', [ 'label' => esc_html__( 'Read More Text', 'bbp-core' ), 'type' => Controls_Manager::TEXT, 'label_block' => true, 'default' => 'More Communities' ] ); $this->end_controls_section(); // end Document Setting Section $this->start_controls_section( 'forum_styling', [ 'label' => esc_html__( 'Forum Style', 'bbp-core' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_group_control( \Elementor\Group_Control_Typography::get_type(), [ 'name' => 'forum_title_typography', 'label' => esc_html__( 'Forum Title Typography', 'bbp-core' ), 'selector' => '{{WRAPPER}} .com-box-content .title a', ] ); $this->add_group_control( \Elementor\Group_Control_Typography::get_type(), [ 'name' => 'more_text_typography', 'label' => esc_html__( 'More text typography', 'bbp-core' ), 'selector' => '{{WRAPPER}} .collapse-btn', ] ); $this->add_control( 'more_text_color', [ 'label' => esc_html__( 'More text color', 'bbp-core' ), 'type' => \Elementor\Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .collapse-btn' => 'color: {{VALUE}}', '{{WRAPPER}} .more-communities .collapse-btn svg path' => 'stroke: {{VALUE}}', ], ] ); $this->end_controls_section(); } protected function render() { $settings = $this->get_settings(); $forums = new WP_Query( array( 'post_type' => 'forum', 'posts_per_page' => ! empty( $settings['ppp'] ) ? $settings['ppp'] : 5, 'order' => $settings['order'] ? $settings['order'] : 'ASC', ) ); ?>
have_posts() ) : $forums->the_post(); ?>
'forum', 'posts_per_page' => ! empty( $settings['ppp2'] ) ? $settings['ppp2'] : 10, 'offset' => ! empty( $settings['ppp'] ) ? $settings['ppp'] : 5, 'order' => $settings['order'], ) ); while ( $forums2->have_posts() ) : $forums2->the_post(); ?>