/home/techb158/public_html/wp-content/themes/engitech/inc/backend/elementor-widgets
Edit: /home/techb158/public_html/wp-content/themes/engitech/inc/backend/elementor-widgets/post-grid.php (10268B)
start_controls_section(
'content_section',
[
'label' => __( 'Post Grid', 'engitech' ),
]
);
$this->add_control(
'post_cat',
[
'label' => __( 'Select Categories', 'engitech' ),
'type' => Controls_Manager::SELECT2,
'options' => $this->select_param_cate_post(),
'multiple' => true,
'label_block' => true,
'placeholder' => __( 'All Categories', 'engitech' ),
]
);
$this->add_control(
'column',
[
'label' => __( 'Columns', 'engitech' ),
'type' => Controls_Manager::SELECT,
'default' => '3',
'options' => [
'2' => __( '2 Column', 'engitech' ),
'3' => __( '3 Column', 'engitech' ),
'4' => __( '4 Column', 'engitech' ),
'5' => __( '5 Column', 'engitech' ),
],
]
);
$this->add_control(
'number_show',
[
'label' => __( 'Show Number Posts', 'engitech' ),
'type' => Controls_Manager::NUMBER,
'default' => '3',
]
);
$this->add_control(
'excerpt',
[
'label' => __( 'Show Excerpt', 'engitech' ),
'type' => Controls_Manager::SWITCHER,
'label_on' => __( 'Show', 'engitech' ),
'label_off' => __( 'Hide', 'engitech' ),
'return_value' => 'yes',
'default' => 'no',
]
);
$this->add_control(
'detail_btn',
[
'label' => 'Button',
'type' => Controls_Manager::TEXTAREA,
'default' => __( '
LEARN MORE', 'engitech' ),
]
);
$this->end_controls_section();
/*Style*/
$this->start_controls_section(
'style_section',
[
'label' => __( 'General', 'engitech' ),
'tab' => Controls_Manager::TAB_STYLE,
]
);
$this->add_responsive_control(
'info_padd',
[
'label' => __( 'Padding', 'engitech' ),
'type' => Controls_Manager::DIMENSIONS,
'size_units' => [ 'px' ],
'selectors' => [
'{{WRAPPER}} .post-box .inner-post' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
],
]
);
$this->add_control(
'info_border',
[
'label' => __( 'Border Color', 'engitech' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .post-box .inner-post' => 'border-color: {{VALUE}};',
],
]
);
$this->end_controls_section();
//Content Style
$this->start_controls_section(
'content_style',
[
'label' => __( 'Content', 'engitech' ),
'tab' => Controls_Manager::TAB_STYLE
]
);
$this->add_control(
'heading_meta',
[
'label' => __( 'Entry Meta', 'engitech' ),
'type' => Controls_Manager::HEADING,
'separator' => 'before',
]
);
$this->add_responsive_control(
'meta_spacing',
[
'label' => __( 'Spacing', 'engitech' ),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'min' => 0,
'max' => 100,
],
],
'selectors' => [
'{{WRAPPER}} .post-box .entry-meta' => 'margin-bottom: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'meta_typography',
'selector' => '{{WRAPPER}} .post-box .entry-meta',
]
);
$this->add_control(
'heading_title',
[
'label' => __( 'Title', 'engitech' ),
'type' => Controls_Manager::HEADING,
'separator' => 'before',
]
);
$this->add_responsive_control(
'title_spacing',
[
'label' => __( 'Spacing', 'engitech' ),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'min' => 0,
'max' => 100,
],
],
'selectors' => [
'{{WRAPPER}} .post-box .inner-post h3' => 'margin-bottom: {{SIZE}}{{UNIT}};',
],
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'title_typography',
'selector' => '{{WRAPPER}} .post-box .inner-post h3',
]
);
$this->add_control(
'heading_exc',
[
'label' => __( 'Excerpt', 'engitech' ),
'type' => Controls_Manager::HEADING,
'separator' => 'before',
'condition' => [
'excerpt' => 'yes',
]
]
);
$this->add_responsive_control(
'exc_spacing',
[
'label' => __( 'Spacing', 'engitech' ),
'type' => Controls_Manager::SLIDER,
'range' => [
'px' => [
'min' => 0,
'max' => 100,
],
],
'selectors' => [
'{{WRAPPER}} .post-box .the-excerpt' => 'margin-bottom: {{SIZE}}{{UNIT}};',
],
'condition' => [
'excerpt' => 'yes',
]
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'exc_typography',
'selector' => '{{WRAPPER}} .post-box .the-excerpt',
'condition' => [
'excerpt' => 'yes',
]
]
);
$this->end_controls_section();
//Button
$this->start_controls_section(
'btn_section',
[
'label' => __( 'Button', 'engitech' ),
'tab' => Controls_Manager::TAB_STYLE,
'condition' => [
'detail_btn[value]!' => '',
]
]
);
$this->add_control(
'btn_readmore_color',
[
'label' => __( 'Color', 'engitech' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .btn-readmore a' => 'color: {{VALUE}};',
]
]
);
$this->add_control(
'btn_readmore_color_hover',
[
'label' => __( 'Color Hover', 'engitech' ),
'type' => Controls_Manager::COLOR,
'default' => '',
'selectors' => [
'{{WRAPPER}} .btn-readmore a:hover' => 'color: {{VALUE}};',
]
]
);
$this->add_group_control(
Group_Control_Typography::get_type(),
[
'name' => 'btn_readmore_typography',
'selector' => '{{WRAPPER}} .btn-readmore a'
]
);
$this->end_controls_section();
$this->end_controls_section();
}
protected function render() {
$settings = $this->get_settings_for_display();
?>
'post',
'post_status' => 'publish',
'posts_per_page' => $number_show,
'tax_query' => array(
array(
'taxonomy' => 'category',
'field' => 'slug',
'terms' => $settings['post_cat']
),
),
);
}else{
$args = array(
'post_type' => 'post',
'post_status' => 'publish',
'posts_per_page' => $number_show,
);
}
$blogpost = new \WP_Query($args);
if($blogpost->have_posts()) : while($blogpost->have_posts()) : $blogpost->the_post(); ?>
slug] = $term->name;
}
}
return $cat;
}
}
// After the Engitech_Post_Grid class is defined, I must register the new widget class with Elementor:
Plugin::instance()->widgets_manager->register_widget_type( new Engitech_Post_Grid() );