start_controls_section( 'project_masonry', [ 'label' => esc_html__( 'Thinkai Project Masonry', 'thinkai' ), ] ); $this->add_control( 'layout_control', [ 'label' => esc_html__( 'Layout Style', 'thinkai' ), 'label_block' => true, 'type' => Controls_Manager::SELECT, 'default' => '1', 'options' => array( '1' => esc_html__( 'Style One ', 'thinkai'), '2' => esc_html__( 'Style Two ', 'thinkai'), ), ] ); //Shape Image $this->add_control( 'shape_image', [ 'label' => esc_html__( 'BG Shape Image', 'thinkai' ), 'type' => Controls_Manager::MEDIA, 'default' => [ 'url' => Utils::get_placeholder_image_src(), ], 'condition' => [ 'layout_control' => '2', ] ] ); $this->add_control( 'subtitle', [ 'label' => __( 'Sub Title', 'thinkai' ), 'label_block' => true, 'type' => Controls_Manager::TEXT, 'dynamic' => [ 'active' => true, ], 'default' => esc_html__( '[ CASE STUDIES ]', 'thinkai' ), 'condition' => [ 'layout_control' => '2', ] ] ); $this->add_control( 'title', [ 'label' => __( 'Title', 'thinkai' ), 'label_block' => true, 'type' => Controls_Manager::TEXT, 'dynamic' => [ 'active' => true, ], 'default' => esc_html__( 'Explore latest cases', 'thinkai' ), 'condition' => [ 'layout_control' => '2', ] ] ); $this->add_control( 'query_number', [ 'label' => esc_html__( 'Number of post', 'thinkai' ), 'type' => Controls_Manager::NUMBER, 'default' => 3, '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' => 'DESC', 'options' => array( 'DESC' => esc_html__( 'DESC', 'thinkai' ), 'ASC' => esc_html__( 'ASC', 'thinkai' ), ), ] ); $this->add_control( 'query_category', [ 'type' => Controls_Manager::SELECT, 'label' => esc_html__('Category', 'thinkai'), 'label_block' => true, 'options' => get_project_categories() ] ); $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'); $layout = $settings[ 'layout_control' ]; $paged = get_query_var('paged'); $paged = thinkai_set($_REQUEST, 'paged') ? esc_attr($_REQUEST['paged']) : $paged; $this->add_render_attribute( 'wrapper', 'class', 'templatepath-thinkai' ); $args = array( 'post_type' => 'project', '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['project_cat'] = thinkai_set( $settings, 'query_category' ); $query = new \WP_Query( $args ); if ( $query->have_posts() ) { $dimention = get_post_meta( get_the_id(), 'dimension', true ); ?>
<?php bloginfo( 'name' ); ?>

have_posts() ) : $query->the_post(); $term_list = wp_get_post_terms(get_the_id(), 'project_cat', array("fields" => "names")); $post_thumbnail_id = get_post_thumbnail_id($post->ID); $post_thumbnail_url = wp_get_attachment_url($post_thumbnail_id); ?>
    have_posts() ) : $query->the_post(); $term_list = wp_get_post_terms(get_the_id(), 'project_cat', array("fields" => "names")); $post_thumbnail_id = get_post_thumbnail_id($post->ID); $post_thumbnail_url = wp_get_attachment_url($post_thumbnail_id); $ext_link = get_post_meta( get_the_id(), 'project_ext_link', true); ?>