265 lines
9.1 KiB
PHP
265 lines
9.1 KiB
PHP
<?php namespace THINKAIPLUGIN\Element;
|
|
|
|
use Elementor\Controls_Manager;
|
|
use Elementor\Controls_Stack;
|
|
use Elementor\Group_Control_Typography;
|
|
use Elementor\Group_Control_Border;
|
|
use Elementor\Repeater;
|
|
use Elementor\Widget_Base;
|
|
use Elementor\Utils;
|
|
use Elementor\Group_Control_Text_Shadow;
|
|
use \Elementor\Group_Control_Box_Shadow;
|
|
use \Elementor\Group_Control_Background;
|
|
use \Elementor\Group_Control_Text_Stroke;
|
|
use Elementor\Plugin;
|
|
/**
|
|
* Elementor button widget.
|
|
* Elementor widget that displays a button with the ability to control every
|
|
* aspect of the button design.
|
|
*
|
|
* @since 1.0.0
|
|
*/
|
|
class Team_Grid extends Widget_Base {
|
|
/**
|
|
* Get widget name.
|
|
* Retrieve button widget name.
|
|
*
|
|
* @since 1.0.0
|
|
* @access public
|
|
* @return string Widget name.
|
|
*/
|
|
public function get_name() {
|
|
return 'thinkai_team_grid';
|
|
}
|
|
/**
|
|
* Get widget title.
|
|
* Retrieve button widget title.
|
|
*
|
|
* @since 1.0.0
|
|
* @access public
|
|
* @return string Widget title.
|
|
*/
|
|
public function get_title() {
|
|
return esc_html__( 'Thinkai Team Grid', 'thinkai' );
|
|
}
|
|
/**
|
|
* Get widget icon.
|
|
* Retrieve button widget icon.
|
|
*
|
|
* @since 1.0.0
|
|
* @access public
|
|
* @return string Widget icon.
|
|
*/
|
|
public function get_icon() {
|
|
return 'eicon-gallery-grid';
|
|
}
|
|
/**
|
|
* Get widget categories.
|
|
* Retrieve the list of categories the button widget belongs to.
|
|
* Used to determine where to display the widget in the editor.
|
|
*
|
|
* @since 2.0.0
|
|
* @access public
|
|
* @return array Widget categories.
|
|
*/
|
|
public function get_categories() {
|
|
return [ 'thinkai' ];
|
|
}
|
|
/**
|
|
* Register button widget controls.
|
|
* Adds different input fields to allow the user to change and customize the widget settings.
|
|
*
|
|
* @since 1.0.0
|
|
* @access protected
|
|
*/
|
|
protected function register_controls() {
|
|
$this->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() )
|
|
{ ?>
|
|
|
|
<!--Start Team Style1 -->
|
|
<div class="team-style1 p-0 m-0">
|
|
<div class="row">
|
|
<?php
|
|
while ( $query->have_posts() ) : $query->the_post();
|
|
$team_overlay_image = get_post_meta(get_the_id(), 'team_overlay_image', true);
|
|
?>
|
|
<!--Start Team Style1 Single-->
|
|
<div class="<?php echo esc_attr( $classes );?>">
|
|
<div class="team-style1__single">
|
|
<div class="team-style1__single-img">
|
|
<div class="inner">
|
|
<?php if( !empty( $team_overlay_image['id']) ){ ?>
|
|
<img src="<?php echo (wp_get_attachment_url($team_overlay_image['id']));?>" alt="<?php bloginfo( 'name' ); ?>">
|
|
<?php } ?>
|
|
<?php the_post_thumbnail('thinkai_370x420'); ?>
|
|
<div class="overlay-content">
|
|
<h2><a href="<?php echo esc_url( get_the_permalink( get_the_id() ) );?>"><?php the_title(); ?></a></h2>
|
|
</div>
|
|
<div class="text-box">
|
|
<p><?php echo (get_post_meta( get_the_id(), 'designation', true ));?></p>
|
|
<div class="btn-box">
|
|
<a href="<?php echo esc_url( get_the_permalink( get_the_id() ) );?>"><span class="icon-right-arrow1"></span>
|
|
<?php if( !empty( $btn_title ) ):?>
|
|
<?php echo wp_kses( $btn_title, true );?>
|
|
<?php else:?>
|
|
<?php esc_html_e('Read more', 'banqix');?>
|
|
<?php endif;?>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
<?php
|
|
$icons = get_post_meta(get_the_id(), 'social_media_tabs', true); if ($icons) :
|
|
?>
|
|
<div class="social-links">
|
|
<?php
|
|
for ( $i=0; $i < count( $icons['select_social_media'] ); $i++ ) {
|
|
$social_icon = ( isset( $icons['select_social_media'][$i] ) && !empty( $icons['select_social_media'][$i] ) ) ? $icons['select_social_media'][$i] : '';
|
|
$social_link = ( isset( $icons['link_social_media'][$i] ) && !empty( $icons['link_social_media'][$i] ) ) ? $icons['link_social_media'][$i] : '';
|
|
?>
|
|
<a class="fb" href="<?php echo esc_url($social_link); ?>"><span class="fa-brands fab <?php echo esc_attr(str_replace("fa ", " ", $social_icon)); ?>"></span></a>
|
|
<?php } ?>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<!--End Team Style1 Single-->
|
|
<?php endwhile; ?>
|
|
</div>
|
|
</div>
|
|
<!--End Team Style1 -->
|
|
|
|
<?php }
|
|
wp_reset_postdata();
|
|
}
|
|
}
|