PATH:
home
/
letacommog
/
aperobusiness
/
wp-content
/
themes
/
deep
/
inc
/
core
/
elementor
/
widgets
<?php namespace Elementor; class Webnus_Element_Widgets_Goal extends \Elementor\Widget_Base { /** * Retrieve Alert widget name. * * @since 1.0.0 * @access public * * @return string Widget name. */ public function get_name() { return 'goal'; } /** * Retrieve Alert widget title. * * @since 1.0.0 * @access public * * @return string Widget title. */ public function get_title() { return __( 'Webnus Goal', 'deep' ); } /** * Retrieve Alert widget icon. * * @since 1.0.0 * @access public * * @return string Widget icon. */ public function get_icon() { return 'icon-target'; } /** * Set widget category. * * @since 1.0.0 * @access public * * @return array Widget category. */ public function get_categories() { return [ 'webnus' ]; } /** * Register Alert widget controls. * * @since 1.0.0 * @access protected */ protected function _register_controls() { // Content Tab $this->start_controls_section( 'content_section', [ 'label' => __( 'General', 'deep' ), 'tab' => \Elementor\Controls_Manager::TAB_CONTENT, ] ); // Select Type Section $this->add_control( 'type', // param_name [ 'label' => __( 'Select Type', 'deep' ), // heading 'type' => \Elementor\Controls_Manager::SELECT, // type 'default' => 'grid', 'options' => [ 'grid' => __( 'grid', 'deep' ), 'list' => __( 'list', 'deep' ), ], ] ); // Select Type Section $this->add_control( 'sort', // param_name [ 'label' => __( 'Order By', 'deep' ), // heading 'type' => \Elementor\Controls_Manager::SELECT, // type 'default' => 'view', 'options' => [ 'recent' => __( 'Most Recent', 'deep' ), 'view' => __( 'Most Popular', 'deep' ), ], ] ); // Alert Content $this->add_control( 'count', // param_name [ 'label' => __( 'Post Count', 'deep' ), // heading 'type' => \Elementor\Controls_Manager::TEXT, // type 'placeholder' => __( 'Number of event(s) to show. Note: When you type nothing it puts for default 6 events to show.', 'deep' ), 'default' => '6', ] ); // Show/Hide Cross Icon $this->add_control( 'page', // param_name [ 'label' => __( 'Page Navigation', 'deep' ), // heading 'type' => \Elementor\Controls_Manager::SWITCHER, // type 'label_on' => __( 'Show', 'deep' ), 'label_off' => __( 'Hide', 'deep' ), 'return_value' => 'yes', 'default' => 'yes', ] ); $this->end_controls_section(); // Custom css tab $this->start_controls_section( 'custom_css_section', [ 'label' => __( 'Custom CSS', 'deep' ), 'tab' => \Elementor\Controls_Manager::TAB_CONTENT, ] ); $this->add_control( 'custom_css', [ 'label' => __( 'Custom CSS', 'deep' ), 'type' => \Elementor\Controls_Manager::CODE, 'language' => 'css', 'rows' => 20, 'show_label' => true, ] ); $this->end_controls_section(); $this->start_controls_section( 'section_content_style', [ 'label' => __( 'Content style', 'deep' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'content_typography', 'label' => __( 'Typography', 'deep' ), 'scheme' => Scheme_Typography::TYPOGRAPHY_2, 'selector' => '#wrap {{WRAPPER}} .alert', ] ); $this->add_control( 'content_color', // param_name [ 'label' => __( 'Color', 'deep' ), // heading 'type' => \Elementor\Controls_Manager::COLOR, // type 'selectors' => [ '#wrap {{WRAPPER}} .alert' => 'color: {{VALUE}} !important', ], ] ); $this->end_controls_section(); $this->start_controls_section( 'section_box_style', [ 'label' => __( 'Box Style', 'deep' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_group_control( Group_Control_Background::get_type(), [ 'name' => 'box_bg', 'label' => __( 'Background', 'deep' ), 'types' => [ 'classic', 'gradient' ], 'selector' => '#wrap {{WRAPPER}} .alert', ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'box_border', 'label' => __( 'Border', 'deep' ), 'selector' => '#wrap {{WRAPPER}} .alert', ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'box_shadow', 'label' => __( 'Box Shadow', 'deep' ), 'selector' => '#wrap {{WRAPPER}} .alert', ] ); $this->add_control( 'box_padding', // param_name [ 'label' => __( 'Padding', 'deep' ), // heading 'type' => \Elementor\Controls_Manager::DIMENSIONS, // type 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '#wrap {{WRAPPER}} .alert' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_control( 'box_margin', // param_name [ 'label' => __( 'Margin', 'deep' ), // heading 'type' => \Elementor\Controls_Manager::DIMENSIONS, // type 'size_units' => [ 'px', 'em', '%' ], 'selectors' => [ '#wrap {{WRAPPER}} .alert' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->end_controls_section(); } /** * Render Alert widget output on the frontend. * * @since 1.0.0 * @access protected */ protected function render() { $settings = $this->get_settings_for_display(); $type = $settings['type']; $sort = $settings['sort']; $count = $settings['count']; $page = $settings['page']; ob_start(); $deep_options = deep_options(); $paged = ( is_front_page() ) ? 'page' : 'paged'; $pages = $page == 'yes' ? get_query_var( $paged ) : '1'; $args = array( 'post_type' => 'goal', 'posts_per_page' => $count, 'paged' => $pages, ); $query = new \WP_Query( $args ); ?> <div class="container goals goals-<?php echo $type; ?>"> <?php $col = ( $count < 5 ) ? 12 / $count : 4; $row = 12 / $col; $rcount = 1; while ( $query->have_posts() ) : $query->the_post(); $post_id = get_the_ID(); $cats = get_the_terms( $post_id, 'goal_category' ); if ( is_array( $cats ) ) { $goal_category = array(); foreach ( $cats as $cat ) { $goal_category[] = $cat->slug; } } else { $goal_category = array(); } $cats = get_the_terms( $post_id, 'goal_category' ); $cats_slug_str = ''; if ( $cats && ! is_wp_error( $cats ) ) : $cat_slugs_arr = array(); foreach ( $cats as $cat ) { $cat_slugs_arr[] = '<a href="' . get_term_link( $cat, 'goal_category' ) . '">' . $cat->name . '</a>'; } $cats_slug_str = implode( ', ', $cat_slugs_arr ); endif; $category = ( $cats_slug_str ) ? esc_html__( 'Category: ', 'webnus-core' ) . $cats_slug_str : ''; $date = get_the_time( 'F d, Y' ); $permalink = get_the_permalink(); $image = get_the_image( array( 'meta_key' => array( 'thumbnail', 'thumbnail' ), 'size' => 'deep_webnus_courses_img', 'echo' => false, ) ); $image2 = get_the_image( array( 'meta_key' => array( 'thumbnail', 'thumbnail' ), 'size' => 'deep_webnus_blog2_img', 'echo' => false, ) ); $title = '<h4><a class="goal-title" href="' . $permalink . '">' . get_the_title() . '</a></h4>'; $content = '<p>' . deep_excerpt( 16 ) . '</p>'; $progressbar = $goal_days = $goal_donate = ''; $percentage = 0; $received = rwmb_meta( 'deep_goal_amount_received_meta' ) ? rwmb_meta( 'deep_goal_amount_received_meta' ) : 0; $amount = rwmb_meta( 'deep_goal_amount_meta' ); $end = rwmb_meta( 'deep_goal_end_meta' ); $currency = esc_html( $deep_options['deep_webnus_currency'] ); if ( $amount ) { $percentage = ( $received / $amount ) * 100; $percentage = round( $percentage ); $out = $percentage . '% ' . esc_html__( 'DONATED OF ', 'webnus-core' ) . $currency . $amount; $progressbar = ' <div class="wn-recived-goal"> '.$out.' <div class="donates" style="margin: 7px 0px; position: relative; display: block; padding: 10px; background: #eee; border-radius: 50px; overflow: hidden;"> <span class="progressbar colorb" style="width:'.$percentage.'%;position: absolute; height: 100%; top: 0; left: 0; transition: all .5s ease-in-out;"><span> </div> </div>'; } $now = date( 'Y-m-d 23:59:59' ); $now = strtotime( $now ); $end_date = $end . ' 23:59:59'; $your_date = strtotime( $end_date ); $datediff = $your_date - $now; $days_left = floor( $datediff / ( 60 * 60 * 24 ) ); $date_msg = ''; if ( $days_left == 0 ) { $date_msg = '1'; } elseif ( $days_left < 0 ) { $date_msg = 'No'; } else { $date_msg = $days_left + '1' . ''; } $goal_days = ( $percentage < 100 ) ? '<span>' . $date_msg . '</span> ' . esc_html__( 'Days left to achieve target', 'webnus-core' ) : esc_html__( 'Thank You', 'webnus-core' ); if ( $type == 'grid' ) { echo ( $rcount == 1 ) ? '<div class="row">' : ''; echo '<div class="col-md-' . $col . ' col-sm-' . $col . '"><article>' . $image; echo '<div class="goal-content">' . $title . $content; echo '<div class="goal-meta">' . $progressbar . '<p class="goal-days">' . $goal_days . '</p>'; if ( $days_left >= 0 && $percentage < 100 && $deep_options['deep_webnus_donate_form'] ) { echo deep_modal_donate(); } else { echo '<p class="goal-completed">' . esc_html__( 'Has been completed', 'webnus-core' ) . '</p>'; } echo '</div></article></div>'; if ( $rcount == $row ) { echo '</div>'; $rcount = 0; } $rcount++; } elseif ( $type == 'list' ) { echo '<article id="post-' . $post_id . '"><div class="row"><div class="col-md-4">'; echo ( $image ) ? '<figure class="goal-img">' . $image2 . '</figure>' : ''; echo '</div><div class="col-md-8"><div class="goal-content">' . $title . '<div class="postmetadata">'; ?> <ul class="goal-metadata"> <li class="goal-date"> <i class="fa-calendar-o"></i><span><?php the_time( 'F d, Y' ); ?></span> </li> <li class="goal-comments"> <i class="fa-folder"></i><span><?php the_terms( $post_id, 'goal_category', '', ' | ', '' ); ?></span> </li> <li class="goal-comments"> <i class="fa-comments"></i><span><?php comments_number(); ?></span> </li> <li class="goal-views"> <i class="fa-eye"></i><span><?php echo deep_getViews( $post_id ); ?></span><?php esc_html_e( ' Views', 'webnus-core' ); ?></li> </ul> </div> <?php echo $content . '<div class="goal-meta">' . $progressbar; if ( $days_left >= 0 && $percentage < 100 && $deep_options['deep_webnus_donate_form'] ) { echo deep_modal_donate(); } else { echo '<p class="goal-completed">' . esc_html__( 'Has been completed', 'webnus-core' ) . '</p>'; } ?> <div class="goal-sharing"> <div class="goal-social"> <a class="facebook" href="http://www.facebook.com/sharer.php?u=<?php the_permalink(); ?>&t=<?php the_title(); ?>" target="blank"><i class="goal-sharing-icon fa-facebook"></i></a> <a class="google" href="https://plusone.google.com/_/+1/confirm?hl=en-US&url=<?php the_permalink(); ?>" target="_blank"><i class="goal-sharing-icon fa-google-plus"></i></a> <a class="twitter" href="https://twitter.com/intent/tweet?original_referer=<?php the_permalink(); ?>&text=<?php the_title(); ?>&tw_p=tweetbutton&url=<?php the_permalink(); ?><?php echo isset( $twitter_user ) ? '&via=' . $twitter_user : ''; ?>" target="_blank"><i class="goal-sharing-icon fa-twitter"></i></a> </div> </div> <?php echo '</div></div></article>'; } endwhile; echo( ( $type == 'grid' ) && ( $rcount != 1 ) ) ? '</div>' : ''; echo '</div>'; if ( $page ) { ?> <section class="container aligncenter"> <?php if ( function_exists( 'wp_pagenavi' ) ) { wp_pagenavi( array( 'query' => $query ) ); } ?> <hr class="vertical-space2"> </section> <?php } $out = ob_get_contents(); ob_end_clean(); wp_reset_postdata(); $custom_css = $settings['custom_css']; if ( $custom_css != '' ) { echo '<style>'. $custom_css .'</style>'; } echo $out; } }
[+]
..
[-] our-client.php
[edit]
[-] icons.php
[edit]
[-] collection.php
[edit]
[-] testimonial-tab.php
[edit]
[-] teaserbox.php
[edit]
[-] instagram.php
[edit]
[-] our-team.php
[edit]
[-] content-carousel.php
[edit]
[-] videoteaser.php
[edit]
[-] like-view-share.php
[edit]
[-] courses-instructors.php
[edit]
[-] widget-flickr.php
[edit]
[-] reservation.php
[edit]
[-] list.php
[edit]
[-] road-map.php
[edit]
[-] max-counter.php
[edit]
[-] magazine.php
[edit]
[-] prayer-wall-items.php
[edit]
[-] facebook-button.php
[edit]
[-] icon-divider.php
[edit]
[-] featured-products.php
[edit]
[-] review-items.php
[edit]
[-] iconbox.php
[edit]
[-] widget-googleplus.php
[edit]
[-] content-slider.php
[edit]
[-] service-carousel.php
[edit]
[-] contact-form.php
[edit]
[-] twitter-feed.php
[edit]
[-] blog.php
[edit]
[-] process-carousel.php
[edit]
[-] course-category.php
[edit]
[-] virtual-coins.php
[edit]
[-] speakers.php
[edit]
[-] the-grid.php
[edit]
[-] custom-menu.php
[edit]
[-] widget-youtube.php
[edit]
[-] testimonial.php
[edit]
[-] callout.php
[edit]
[-] testimonial-slider.php
[edit]
[-] category-tab.php
[edit]
[-] testimonial-carousel.php
[edit]
[-] button.php
[edit]
[-] facebook-comments.php
[edit]
[-] widget-login.php
[edit]
[-] subscribe.php
[edit]
[-] googlemap.php
[edit]
[-] widget-social-icon.php
[edit]
[-] postslider.php
[edit]
[-] alert.php
[edit]
[-] video-play-button.php
[edit]
[-] quote.php
[edit]
[-] donate.php
[edit]
[-] dropcap.php
[edit]
[-] before-after-image.php
[edit]
[-] pricing-tables.php
[edit]
[-] facebook-page.php
[edit]
[-] shop-products.php
[edit]
[-] single-goal.php
[edit]
[-] info-box.php
[edit]
[-] latestfromblog.php
[edit]
[-] goals.php
[edit]
[-] revolution-slider.php
[edit]
[-] widget-subscribe.php
[edit]
[-] tablepress.php
[edit]
[-] tab-content.php
[edit]
[-] schedule.php
[edit]
[-] sermon-category.php
[edit]
[-] pricing-plan.php
[edit]
[-] tabs.php
[edit]
[-] widget-latest-posts.php
[edit]
[-] distance.php
[edit]
[-] widget-popular-posts.php
[edit]
[-] recipes.php
[edit]
[-] causes.php
[edit]
[-] widget-testimonial.php
[edit]
[-] widget-about.php
[edit]
[-] special-offers.php
[edit]
[-] tooltip.php
[edit]
[-] food-menu.php
[edit]
[-] wp-hotel-booking.php
[edit]
[-] widget-tab.php
[edit]
[-] courses.php
[edit]
[-] login.php
[edit]
[-] post-from-blog.php
[edit]
[-] socials.php
[edit]
[-] line.php
[edit]
[-] gallery.php
[edit]
[-] faq.php
[edit]
[-] piecharts.php
[edit]
[-] image-hotspot.php
[edit]
[-] link.php
[edit]
[-] prayer-wall-form.php
[edit]
[-] rooms.php
[edit]
[-] countdown.php
[edit]
[-] portfolio-carousel.php
[edit]
[-] facebook-embed.php
[edit]
[-] single-cause.php
[edit]
[-] review-form.php
[edit]
[-] buy-process.php
[edit]
[-] sermons.php
[edit]
[-] widget-facebook.php
[edit]
[-] single-sermon.php
[edit]
[-] single-course.php
[edit]
[-] image-carousel.php
[edit]
[-] toggle-box.php
[edit]
[-] our-process.php
[edit]
[-] svg.php
[edit]
[-] w-title.php
[edit]
[-] block-quote.php
[edit]