start_controls_section( 'team_grid', [ 'label' => esc_html__( 'Thinkai Team Grid', 'thinkai' ), ] ); $this->add_control( 'col_grid', [ 'label' => esc_html__( 'Choose Column', 'thinkai' ), 'label_block' => true, 'type' => Controls_Manager::SELECT, 'default' => 'default', 'options' => array( 'default' => esc_html__( 'Default', 'thinkai' ), 'one' => esc_html__( 'One Column Grid ', 'thinkai'), 'two' => esc_html__( 'Two Column Grid', 'thinkai' ), 'three' => esc_html__( 'Three Column Grid', 'thinkai' ), 'four' => esc_html__( 'Four Column Grid', 'thinkai' ), 'five' => esc_html__( 'Six Column Grid', 'thinkai' ), ), ] ); $this->add_control( 'query_number', [ 'label' => esc_html__( 'Number of post', 'thinkai' ), 'type' => Controls_Manager::NUMBER, 'default' => 5, 'min' => 1, 'max' => 100, 'step' => 1, ] ); $this->add_control( 'query_orderby', [ 'label' => esc_html__( 'Order By', 'thinkai' ), 'label_block' => true, 'type' => Controls_Manager::SELECT, 'default' => 'date', 'options' => array( 'date' => esc_html__( 'Date', 'thinkai' ), 'title' => esc_html__( 'Title', 'thinkai' ), 'menu_order' => esc_html__( 'Menu Order', 'thinkai' ), 'rand' => esc_html__( 'Random', 'thinkai' ), ), ] ); $this->add_control( 'query_order', [ 'label' => esc_html__( 'Order', 'thinkai' ), 'label_block' => true, 'type' => Controls_Manager::SELECT, 'default' => 'ASC', 'options' => array( 'DESC' => esc_html__( 'DESC', 'thinkai' ), 'ASC' => esc_html__( 'ASC', 'thinkai' ), ), ] ); $this->add_control( 'query_category', [ 'type' => Controls_Manager::SELECT2, 'label' => esc_html__('Category', 'thinkai'), 'multiple' => true, 'label_block' => true, 'options' => get_team_categories() ] ); //Button Title $this->add_control( 'btn_title', [ 'label' => esc_html__( 'Button Title', 'thinkai' ), 'type' => Controls_Manager::TEXT, 'label_block' => true, 'placeholder' => esc_html__( 'Enter button title', 'thinkai' ), 'default' => esc_html__( 'Read More', 'financer' ), ] ); $this->end_controls_section(); } /** * Render button 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(); $allowed_tags = wp_kses_allowed_html('post'); $btn_title = $settings[ 'btn_title' ]; $grid_col = $settings[ 'col_grid' ]; if( $grid_col == 'one' ){ $classes = 'col-xl-12 col-lg-12 col-md-12 col-sm-12'; }elseif( $grid_col == 'two' ){ $classes = 'col-xl-6 col-lg-6 col-md-6 col-sm-12'; }elseif( $grid_col == 'three' ){ $classes = 'col-xl-4 col-lg-4 col-md-6 col-sm-12'; }elseif( $grid_col == 'four' ){ $classes = 'col-xl-3 col-lg-3 col-md-6 col-sm-12'; }elseif( $grid_col == 'five' ){ $classes = 'col-xl-2 col-lg-2 col-md-6 col-sm-12'; }else{ $classes = 'col-xl-4 col-lg-4 col-md-6 col-sm-12'; } $paged = get_query_var('paged'); $paged = thinkai_set($_REQUEST, 'paged') ? esc_attr($_REQUEST['paged']) : $paged; $this->add_render_attribute( 'wrapper', 'class', 'templatepath-greenture' ); $args = array( 'post_type' => 'team', 'posts_per_page' => thinkai_set( $settings, 'query_number' ), 'orderby' => thinkai_set( $settings, 'query_orderby' ), 'order' => thinkai_set( $settings, 'query_order' ), 'paged' => $paged ); if( thinkai_set( $settings, 'query_category' ) ) $args['team_cat'] = thinkai_set( $settings, 'query_category' ); $query = new \WP_Query( $args ); if ( $query->have_posts() ) { ?>