/
home
/
rekodeb
/
webmars
/
wp-content
/
plugins
/
calmor-core
/
widgets
/
Upload File
HOME
<?php namespace calmorCore\Widgets; use Elementor\Widget_Base; use Elementor\Controls_Manager; use Elementor\Scheme_Typography; use Elementor\Group_Control_Typography; use WP_Query; // Exit if accessed directly if ( ! defined( 'ABSPATH' ) ) { exit; } /** * Text Typing Effect * * Elementor widget for text typing effect. * * @since 1.7.0 */ class calmor_project extends Widget_Base { public function get_name() { return 'calmor_project'; } public function get_title() { return __( 'Calmer Project', 'calmor-core' ); } public function get_icon() { return ' eicon-column'; } public function get_categories() { return [ 'calmor-elements' ]; } protected function register_controls() { // ---------------------------------------- style content ------------------------------ $this->start_controls_section( 'project_style', [ 'label' => __( 'Project Style', 'calmor-core' ), ] ); $this->add_control( 'select_style', [ 'label' => esc_html__( 'Select Style', 'calmor-core' ), 'type' => Controls_Manager::SELECT, 'label_block' => false, 'options' => [ 'style_1' => 'Style 1', 'style_2' => 'Style 2 [ List ]', 'style_3' => 'Style 3 [ Slide ]', 'style_4' => 'Style 3 [ 2 Column ]', 'style_5' => 'Style 3 [ 3 Column ]', ], 'default' => 'style_1' ] ); $this->add_control( 'section_title', [ 'label' => esc_html__( 'Section Title', 'calmor-core' ), 'type' => Controls_Manager::TEXT, 'label_block' => true, 'default' => 'Explore some amazing projects' ] ); $this->end_controls_section(); // End Project content // ---Start Project Setting $this->start_controls_section( 'service_filter', [ 'label' => __( 'Service Settings', 'calmor-core' ), ] ); $this->add_control( 'all_label', [ 'label' => esc_html__( 'All filter label', 'calmor-core' ), 'type' => Controls_Manager::TEXT, 'label_block' => true, 'default' => 'See All' ] ); $this->add_control( 'show_count', [ 'label' => esc_html__( 'Show count', 'calmor-core' ), 'type' => Controls_Manager::NUMBER, 'label_block' => true, 'default' => 8 ] ); $this->add_control( 'order', [ 'label' => esc_html__( 'Order', 'calmor-core' ), 'type' => Controls_Manager::SELECT, 'options' => [ 'ASC' => 'ASC', 'DESC' => 'DESC' ], 'default' => 'ASC' ] ); $this->add_control( 'read_more_Text', [ 'label' => esc_html__( 'Button Title', 'calmor-core' ), 'type' => Controls_Manager::TEXT, 'label_block' => true, 'default' => 'Read More' ] ); $this->end_controls_section(); // ---------------------------------------- Project Button ------------------------------ $this->start_controls_section( 'project_button', [ 'label' => __( 'Project Button', 'calmor-core' ), ] ); $this->add_control( 'button_level', [ 'label' => esc_html__( 'Button Text', 'calmor-core' ), 'type' => Controls_Manager::TEXT, 'label_block' => true, 'default' => 'View More', ] ); $this->add_control( 'button_url', [ 'label' => esc_html__( 'Button URL', 'calmor-core' ), 'type' => Controls_Manager::TEXT, 'label_block' => true, 'default' => '#', ] ); $this->end_controls_section(); // End Button content $this->start_controls_section( 'style_sec_title', [ 'label' => __( 'General Settings', 'calmor-core' ), 'tab' => Controls_Manager::TAB_STYLE ] ); $this->add_group_control( \Elementor\Group_Control_Background::get_type(), [ 'name' => 'section_background', 'label' => esc_html__( 'Background Color', 'calmor-core' ), 'types' => [ 'classic', 'gradient', 'video' ], 'selector' => '{{WRAPPER}} .project', ] ); $this->add_responsive_control( 'proect_margin', [ 'label' => esc_html__('Margin', 'almor-core'), 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'size_units' => ['px', 'em', '%'], 'selectors' => [ '{{WRAPPER}} .project' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'proect_padding', [ 'label' => esc_html__('Padding', 'almor-core'), 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'size_units' => ['px', 'em', '%'], 'selectors' => [ '{{WRAPPER}} .project' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_control( 'section_text_color', [ 'label' => esc_html__('Title Text Color', 'calmor-core'), 'type' => Controls_Manager::COLOR, 'selectors' => array( '{{WRAPPER}} .section_title h2' => 'color: {{VALUE}};', ), ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'section_text_typo', 'selector' => ' {{WRAPPER}} .section_title h2', ] ); $this->end_controls_section(); $this->start_controls_section( 'style_project_sec_title', [ 'label' => __( 'Content Style', 'calmor-core' ), 'tab' => Controls_Manager::TAB_STYLE ] ); $this->add_control( 'project_title_color', [ 'label' => esc_html__('Title Text Color', 'calmor-core'), 'type' => Controls_Manager::COLOR, 'selectors' => array( '{{WRAPPER}} .min_project_area .single_project .project_bottom h4 a' => 'color: {{VALUE}};', '{{WRAPPER}} .min_project_two .project_two_items .single_item .all_content .content h3 a' => 'color: {{VALUE}};', '{{WRAPPER}} .min_project_slider_area .single_project_slider .project_bottom h4 a' => 'color: {{VALUE}};', '{{WRAPPER}} .min_project_area_grid_two .single_project .project_bottom h4 a' => 'color: {{VALUE}};', ), ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'project_title_typo', 'selector' => ' {{WRAPPER}} .min_project_area .single_project .project_bottom h4 a, {{WRAPPER}} .min_project_two .project_two_items .single_item .all_content .content h3 a, {{WRAPPER}} .min_project_slider_area .single_project_slider .project_bottom h4 a, {{WRAPPER}} .min_project_area_grid_two .single_project .project_bottom h4 a', ] ); $this->add_control( 'project_read_more_color', [ 'label' => esc_html__('More Details Color', 'calmor-core'), 'type' => Controls_Manager::COLOR, 'selectors' => array( '{{WRAPPER}} .project_btn' => 'color: {{VALUE}};', ), ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'project_read_more_typo', 'selector' => ' {{WRAPPER}} .project_btn', ] ); $this->end_controls_section(); $this->start_controls_section( 'style_project_sec_cat_button', [ 'label' => __( 'Category Style', 'calmor-core' ), 'tab' => Controls_Manager::TAB_STYLE ] ); $this->add_control( 'project_cate_bg_color', [ 'label' => esc_html__('Background Color', 'calmor-core'), 'type' => Controls_Manager::COLOR, 'selectors' => array( '{{WRAPPER}} .min_project_area .single_project .project_top .tags li a' => 'background-color: {{VALUE}};', '{{WRAPPER}} .min_project_two .project_two_items .single_item .all_content .content .category a' => 'background-color: {{VALUE}};', '{{WRAPPER}} .min_project_slider_area .single_project_slider .project_top .tags li a' => 'background-color: {{VALUE}};', '{{WRAPPER}} .min_project_area_grid_two .single_project .project_top .tags li a' => 'background-color: {{VALUE}};', ), ] ); $this->add_control( 'project_cate_color', [ 'label' => esc_html__('Text Color', 'calmor-core'), 'type' => Controls_Manager::COLOR, 'selectors' => array( '{{WRAPPER}} .min_project_area .single_project .project_top .tags li a' => 'color: {{VALUE}};', '{{WRAPPER}} .min_project_two .project_two_items .single_item .all_content .content .category a' => 'color: {{VALUE}};', '{{WRAPPER}} .min_project_slider_area .single_project_slider .project_top .tags li a' => 'color: {{VALUE}};', '{{WRAPPER}} .min_project_area_grid_two .single_project .project_top .tags li a' => 'color: {{VALUE}};', ), ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'project_cate_typo', 'selector' => ' {{WRAPPER}} .min_project_area .single_project .project_top .tags li a, {{WRAPPER}} .min_project_two .project_two_items .single_item .all_content .content .category a, {{WRAPPER}} .min_project_area_grid_two .single_project .project_top .tags li a, {{WRAPPER}} .min_project_slider_area .single_project_slider .project_top .tags li a', ] ); $this->end_controls_section(); // Button Style $this->start_controls_section( 'section_button_style', [ 'label' => __( 'button Style', 'calmor-core' ), 'tab' => Controls_Manager::TAB_STYLE ] ); $this->start_controls_tabs( 'style_tabs' ); //button Style Normal Style $this->start_controls_tab( 'style_normal', [ 'label' => __( 'Normal', 'calmor-core' ), ] ); $this->add_control( 'btn_font_color', [ 'label' => esc_html__( 'Font color', 'calmor-core' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .bg_btn' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'btn_bg_color', [ 'label' => esc_html__( 'Background Color', 'calmor-core' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .bg_btn' => 'background-color: {{VALUE}};', ], ] ); $this->add_group_control( \Elementor\Group_Control_Border::get_type(), [ 'name' => 'button_border', 'label' => esc_html__( 'Border', 'calmor-core' ), 'selector' => '{{WRAPPER}} .bg_btn', ] ); $this->add_responsive_control( 'button_border_radius', [ 'label' => esc_html__('Border Radius', 'calmor-core'), 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'size_units' => ['px', 'em', '%'], 'selectors' => [ '{{WRAPPER}} .bg_btn' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'button_border_margin', [ 'label' => esc_html__('Margin', 'calmor-core'), 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'size_units' => ['px', 'em', '%'], 'selectors' => [ '{{WRAPPER}} .bg_btn' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'button_border_padding', [ 'label' => esc_html__('Padding', 'calmor-core'), 'type' => \Elementor\Controls_Manager::DIMENSIONS, 'size_units' => ['px', 'em', '%'], 'selectors' => [ '{{WRAPPER}} .bg_btn' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->end_controls_tab(); //Hover Color $this->start_controls_tab( 'style_hover_btn', [ 'label' => __( 'Hover', 'calmor-core' ), ] ); $this->add_control( 'hover_font_color', [ 'label' => __( 'Font Color', 'calmor-core' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .bg_btn:hover' => 'color: {{VALUE}};', ], ] ); $this->add_control( 'hover_bg_color', [ 'label' => __( 'Background Color', 'calmor-core' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .bg_btn:hover' => 'background: {{VALUE}};', ] ] ); $this->add_group_control( \Elementor\Group_Control_Border::get_type(), [ 'name' => 'hover_button_border', 'label' => esc_html__( 'Border', 'calmor-core' ), 'selector' => '{{WRAPPER}} .bg_btn:hover', ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); } protected function render() { $this->load_widget_script(); $settings = $this->get_settings(); $select_style = isset($settings['select_style']) ? $settings['select_style'] : ''; $feature_project = isset($settings['feature_project']) ? $settings['feature_project'] : ''; $blogPost = new WP_Query( array( 'post_type' => 'project', 'posts_per_page' => $settings['show_count'], 'order' => $settings['order'], 'post__not_in' => ! empty( $settings['exclude'] ) ? explode( ',', $settings['exclude'] ) : '' ) ); ?> <?php if($select_style =='style_1'){ ?> <section class="project style_one"> <div class="container"> <?php if($settings['section_title']): ?> <div class="section_title text-center"> <h2 class="wow fadeInLeft" data-wow-delay="0.3s"><?php echo $settings['section_title']; ?></h2> </div> <?php endif; ?> <div class="min_project_area"> <?php if( $blogPost->have_posts() ){ while ( $blogPost->have_posts() ){ $blogPost->the_post(); ?> <div class="single_project wow fadeInLeft" data-wow-delay="0.5s"> <div class="project_top"> <?php if( has_post_thumbnail() ){ ?> <?php the_post_thumbnail(); ?> <?php } ?> <?php $tags = get_the_tags(); if(!empty($tags)): ?> <ul class="tags list-unstyled"> <?php foreach ($tags as $tag){ ?> <li><a href=""><?php echo $tag->name; ?></a></li> <?php } ?> </ul> <?php endif; ?> </div> <div class="project_bottom"> <h4><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4> <a class="project_btn" href="<?php the_permalink(); ?>"><?php echo $settings['read_more_Text']; ?><i class="fa-solid fa-arrow-right"></i></a> </div> </div> <?php } } ?> </div> <?php if($settings['button_level']): ?> <a href="<?php echo esc_url( $settings['button_url'] ); ?>" class="bg_btn wow fadeInLeft" data-wow-delay="0.7s"><?php echo $settings['button_level']; ?></a> <?php endif; ?> </div> </section> <?php }elseif($select_style =='style_2'){ ?> <!-- Project Style Two --> <section class="project_two"> <div class="container"> <div class="section_title text-center wow fadeInLeft" data-wow-delay="0.1s"> <?php if($settings['section_title']): ?> <h2><?php echo $settings['section_title']; ?></h2> <?php endif; ?> </div> <div class="min_project_two"> <ul class="project_two_items"> <?php if( $blogPost->have_posts() ){ while ( $blogPost->have_posts() ){ $blogPost->the_post(); ?> <li class="single_item list-unstyled wow fadeInLeft" data-wow-delay="0.3s"> <div class="all_content"> <div class="content"> <h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3> <?php $tags = get_the_tags(); if(!empty($tags)): ?> <div class="category"> <?php foreach ($tags as $tag){ ?> <span><a href=""><?php echo $tag->name; ?></a></span> <span>/</span> <?php } ?> </div> <?php endif; ?> </div> <i class="fa-solid fa-arrow-right"></i> </div> <?php if( has_post_thumbnail() ){ ?> <?php the_post_thumbnail(); ?> <?php } ?> </li> <?php } } ?> </ul> <?php if($settings['button_level']): ?> <div class="bottom"> <a href="<?php echo esc_url( $settings['button_url'] ); ?>" class="bg_btn wow fadeInLeft" data-wow-delay="1.3s"><?php echo $settings['button_level']; ?><i class="fa-solid fa-arrow-right"></i></a> </div> <?php endif; ?> </div> </div> </section> <?php }elseif($select_style =='style_3'){ ?> <section class="project_slider" data-bg-color="#FC7942"> <div class="container"> <div class="row align-items-center"> <?php if($settings['section_title']): ?> <div class="col-lg-6"> <div class="section_title"> <h2 class="wow fadeInLeft" data-wow-delay="0.3s"><?php echo $settings['section_title']; ?></h2> </div> </div> <?php endif; ?> <?php if($settings['button_level']): ?> <div class="col-lg-6"> <div class="project_slider_btn"> <a href="<?php echo esc_url( $settings['button_url'] ); ?>" class="bg_btn wow fadeInLeft" data-wow-delay="0.5s"><?php echo $settings['button_level']; ?></a> </div> </div> <?php endif; ?> </div> <div class="min_project_slider_area"> <?php if( $blogPost->have_posts() ){ while ( $blogPost->have_posts() ){ $blogPost->the_post(); ?> <div class="single_project_slider wow fadeInLeft" data-wow-delay="0.5s"> <div class="project_top"> <?php if( has_post_thumbnail() ){ ?> <?php the_post_thumbnail(); ?> <?php } ?> <?php $tags = get_the_tags(); if(!empty($tags)): ?> <ul class="tags list-unstyled"> <?php foreach ($tags as $tag){ ?> <li><a href=""><?php echo $tag->name; ?></a></li> <?php } ?> </ul> <?php endif; ?> </div> <div class="project_bottom"> <h4><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4> <a class="project_btn" href="<?php the_permalink(); ?>"><?php echo $settings['read_more_Text']; ?><i class="fa-solid fa-arrow-right"></i></a> </div> </div> <?php } } ?> </div> </div> </section> <?php }elseif($select_style =='style_4'){ ?> <section class="portfolio_grid_two"> <div class="container"> <div class="min_project_area_grid_two"> <div class="row"> <?php if( $blogPost->have_posts() ){ while ( $blogPost->have_posts() ){ $blogPost->the_post(); ?> <div class="col-xl-6"> <div class="single_project wow fadeInLeft" data-wow-delay="0.5s"> <div class="project_top"> <?php if( has_post_thumbnail() ){ ?> <?php the_post_thumbnail(); ?> <?php } ?> <?php $tags = get_the_tags(); if(!empty($tags)): ?> <ul class="tags list-unstyled"> <?php foreach ($tags as $tag){ ?> <li><a href=""><?php echo $tag->name; ?></a></li> <?php } ?> </ul> <?php endif; ?> </div> <div class="project_bottom"> <h4><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4> <a class="project_btn" href="<?php the_permalink(); ?>"><?php echo $settings['read_more_Text']; ?><i class="fa-solid fa-arrow-right"></i></a> </div> </div> </div> <?php } } ?> <?php if($settings['button_level']): ?> <div class="bottom"> <a href="<?php echo esc_url( $settings['button_url'] ); ?>" class="bg_btn" data-wow-delay="1.3s"><?php echo $settings['button_level']; ?><i class="fa-solid fa-arrow-right"></i></a> </div> <?php endif; ?> </div> </div> </div> </section> <?php }elseif($select_style =='style_5'){ ?> <section class="portfolio_grid_two"> <div class="container"> <div class="min_project_area_grid_two three"> <div class="row"> <?php if( $blogPost->have_posts() ){ while ( $blogPost->have_posts() ){ $blogPost->the_post(); ?> <div class="col-xl-4 col-md-6"> <div class="single_project wow fadeInLeft" data-wow-delay="0.5s"> <div class="project_top"> <?php if( has_post_thumbnail() ){ ?> <?php the_post_thumbnail(); ?> <?php } ?> <?php $tags = get_the_tags(); if(!empty($tags)): ?> <ul class="tags list-unstyled"> <?php foreach ($tags as $tag){ ?> <li><a href=""><?php echo $tag->name; ?></a></li> <?php } ?> </ul> <?php endif; ?> </div> <div class="project_bottom"> <h4><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4> <a class="project_btn" href="<?php the_permalink(); ?>"><?php echo $settings['read_more_Text']; ?><i class="fa-solid fa-arrow-right"></i></a> </div> </div> </div> <?php } } ?> </div> <?php if($settings['button_level']): ?> <div class="button_area text-center"> <a href="<?php echo esc_url( $settings['button_url'] ); ?>" class="bg_btn"><?php echo $settings['button_level']; ?></a> </div> <?php endif; ?> </div> </div> </section> <?php }else{ } ?> <?php } public function load_widget_script(){ if( \Elementor\Plugin::$instance->editor->is_edit_mode() === true ) { ?> <script> ( function( $ ){ // main class $('.min_project_slider_area').slick({ autoplay: true, infinite: true, slidesToShow: 3, slidesToScroll: 1, dots: false, arrows: false, speed: 300, responsive: [ { breakpoint: 992, settings: { slidesToShow: 2, } }, { breakpoint: 768, settings: { slidesToShow: 1, } } ] }); // end Slider Script })(jQuery); </script> <?php } } }