OwlCyberSecurity - MANAGER
Edit File: give-donation.php
<?php use Elementor\Widget_Base; use Elementor\Controls_Manager; use Elementor\Group_Control_Typography; use Elementor\Group_Control_Border; if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly class Chursy_Elementor_Give_Donations extends Widget_Base { public function get_name() { return 'chursy_elementor_give_donations'; } public function get_title() { return esc_html__( 'Give Donations', 'chursy' ); } public function get_icon() { return 'eicon-price-table'; } public function get_categories() { return [ 'chursy' ]; } public function get_script_depends() { return [ 'chursy-elementor-give-donations' ]; } protected function register_controls() { /***** Layout Section *****/ $this->start_controls_section( 'section_layout', [ 'label' => esc_html__( 'Layout', 'chursy' ), ] ); $this->add_control( 'layout_columns', [ 'label' => esc_html__( 'Columns', 'chursy' ), 'type' => \Elementor\Controls_Manager::SELECT, 'default' => 'two_column', 'options' => [ 'one_column' => esc_html__( '1 Columns', 'chursy' ), 'two_column' => esc_html__( '2 Columns', 'chursy' ), 'three_column' => esc_html__( '3 Columns', 'chursy' ), 'four_column' => esc_html__( '4 Columns', 'chursy' ), ], ] ); $this->add_control( 'visibility', [ 'label' => esc_html__( 'Visibility', 'chursy' ), 'type' => Controls_Manager::SELECT, 'default' => 'public', 'options' => [ 'public' => esc_html__( 'Public', 'chursy' ), 'featured' => esc_html__( 'Featured Give Form', 'chursy' ), ], ] ); $args = array( 'taxonomy' => 'give_forms_category', 'orderby' => 'name', 'order' => 'ASC' ); $categories = get_categories($args); $cate_array = array(); $arrayCateAll = array( 'all' => esc_html__( 'All categories', 'chursy' ) ); if ($categories) { foreach ( $categories as $cate ) { $cate_array[$cate->slug] = $cate->cat_name; } } else { $cate_array[ esc_html__( 'No content Category found', 'chursy' ) ] = 0; } $this->add_control( 'category', [ 'label' => esc_html__( 'Category', 'chursy' ), 'type' => Controls_Manager::SELECT, 'default' => 'all', 'options' => array_merge($arrayCateAll,$cate_array), ] ); $this->add_control( 'posts_per_page', [ 'label' => esc_html__( 'Posts Per Page', 'chursy' ), 'type' => Controls_Manager::NUMBER, 'default' => 3, ] ); $this->add_control( 'order', [ 'label' => esc_html__('Order', 'chursy'), 'type' => Controls_Manager::SELECT, 'default' => 'desc', 'options' => [ 'asc' => esc_html__('Ascending', 'chursy'), 'desc' => esc_html__('Descending', 'chursy'), ] ] ); $this->add_control( 'orderby', [ 'label' => esc_html__('Order By', 'chursy'), 'type' => \Elementor\Controls_Manager::SELECT, 'default' => 'ID', 'options' => [ 'ID' => esc_html__('ID', 'chursy'), 'title' => esc_html__('Title', 'chursy'), 'date' => esc_html__('Date', 'chursy'), 'modified' => esc_html__('Modified', 'chursy'), 'rand' => esc_html__('Rand', 'chursy'), ] ] ); $this->add_control( 'show_category', [ 'label' => esc_html__( 'Show Category', 'chursy' ), 'type' => \Elementor\Controls_Manager::SWITCHER, 'label_on' => esc_html__( 'Show', 'chursy' ), 'label_off' => esc_html__( 'Hide', 'chursy' ), 'return_value' => 'yes', 'default' => 'no', ] ); $this->add_control( 'show_excerpt', [ 'label' => esc_html__( 'Show Excerpt', 'chursy' ), 'type' => \Elementor\Controls_Manager::SWITCHER, 'label_on' => esc_html__( 'Show', 'chursy' ), 'label_off' => esc_html__( 'Hide', 'chursy' ), 'return_value' => 'yes', 'default' => 'yes', ] ); $this->add_control( 'limit_text', [ 'label' => esc_html__( 'Description Words Limit', 'chursy' ), 'type' => Controls_Manager::NUMBER, 'default' => 12, 'condition' => [ 'show_excerpt' => 'yes' ] ] ); $this->end_controls_section(); /***** End Layout Section *****/ //SECTION TAB STYLE TITLE $this->start_controls_section( 'section_title_style', [ 'label' => esc_html__( 'Title', 'chursy' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_group_control( \Elementor\Group_Control_Typography::get_type(), [ 'name' => 'content_typography_title', 'label' => esc_html__( 'Typography', 'chursy' ), 'selector' => '{{WRAPPER}} .ova_give_detail .detail_body .title', ] ); $this->add_control( 'color_title', [ 'label' => esc_html__( 'Color', 'chursy' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ova_give_detail .detail_body .title' => 'color : {{VALUE}};', '{{WRAPPER}} .ova_give_detail .detail_body .title a' => 'color : {{VALUE}};', ], ] ); $this->add_control( 'color_title_hover', [ 'label' => esc_html__( 'Color hover', 'chursy' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .ova_give_detail .detail_body .title a:hover' => 'color : {{VALUE}};' ], ] ); $this->add_responsive_control( 'padding_title', [ 'label' => esc_html__( 'Padding', 'chursy' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .ova_give_detail .detail_body .title ' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'margin_title', [ 'label' => esc_html__( 'Margin', 'chursy' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '{{WRAPPER}} .ova_give_detail .detail_body .title ' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->end_controls_section(); //END SECTION TAB STYLE TITLE $this->start_controls_section( 'section_progress_style', [ 'label' => esc_html__( 'Progress', 'chursy' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'color_progress_main', [ 'label' => esc_html__( 'Main Color', 'chursy' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .give-progress .project-percent' => 'background-color : {{VALUE}} !important;', ], ] ); $this->add_control( 'color_progress', [ 'label' => esc_html__( 'Sub Color', 'chursy' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .give-progress' => 'background-color : {{VALUE}} !important;', ], ] ); $this->end_controls_section(); } protected function render() { $settings = $this->get_settings(); $layout_columns = $settings['layout_columns']; $category = $settings['category']; $posts_per_page = $settings['posts_per_page']; $order = $settings['order']; $orderby = $settings['orderby']; if ($settings['visibility'] != 'public') { $layout_show_post = array( array( 'key' => 'ova_met_feature_give', 'value' => 'on', 'compare' => '=', ) ); } else { $layout_show_post = ''; }; $paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1; if ($category == 'all') { $args_base = array( 'post_type' => 'give_forms', 'posts_per_page' => $posts_per_page, 'orderby' => $orderby, 'order' => $order, 'meta_query' => $layout_show_post, ); } else { $args_base = array( 'post_type' => 'give_forms', 'posts_per_page' => $posts_per_page, 'orderby' => $orderby, 'order' => $order, 'meta_query' => $layout_show_post, 'tax_query' => array( array( 'taxonomy' => 'give_forms_category', 'field' => 'slug', 'terms' => $category, ) ), ); } $give_donation = new WP_Query( $args_base ); if( in_array('give/give.php', apply_filters('active_plugins', get_option('active_plugins') ) ) ) { ?> <div class="ova-item-give <?php echo esc_attr($layout_columns); ?>"> <?php if( $give_donation->have_posts() ) : while ( $give_donation->have_posts() ) : $give_donation->the_post(); ob_start(); get_template_part( 'give/template-parts/item-give', null, $settings ); echo ob_get_clean(); ?> <?php endwhile; else: ?> <div class="search_not_found"> <?php esc_html_e( 'Not Found Give Form', 'chursy' ); ?> </div> <?php endif; wp_reset_postdata(); ?> </div> <?php } else { esc_html_e( 'Please active plugins Give Donations', 'chursy' ); } } } $widgets_manager->register( new Chursy_Elementor_Give_Donations() );