Advertisement
rejuancse

section3

Oct 1st, 2018
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 5.71 KB | None | 0 0
  1. <?php
  2. namespace Elementor;
  3. function crowdfunding_all_published_post_raised(){
  4.     $data = array();
  5.     $args = array(
  6.         'post_type'     => 'product',
  7.         'post_status'   => 'publish',
  8.     );
  9.     $query1 = get_posts( $args );
  10.     foreach ( $query1 as $post ) {
  11.         $data[ $post->post_name ] = $post->post_title;
  12.     }
  13.     return $data;
  14. }
  15.  
  16. if ( ! defined( 'ABSPATH' ) ) exit; # Exit if accessed directly
  17.  
  18. class Widget_Themeum_Raised_Content extends Widget_Base {
  19.     private $query = null;
  20.  
  21.     protected $_has_template_content = false;
  22.     public function get_name() {
  23.         return 'backer-fundraised';
  24.     }
  25.  
  26.     public function get_title() {
  27.         return __( 'Themeum Funded Raised', 'themeum-core' );
  28.     }
  29.  
  30.     public function get_icon() {
  31.         return 'eicon-slideshow';
  32.     }
  33.  
  34.     public function get_categories() {
  35.         return [ 'themeum-elementor' ];
  36.     }
  37.  
  38.     protected function _register_controls() {
  39.  
  40.         $this->start_controls_section(
  41.             'section_slider',
  42.             [
  43.                 'label' => __( 'Slider Element', 'themeum-core' )
  44.             ]
  45.         );
  46.  
  47.         $this->add_control(
  48.           'slides_item',
  49.           [
  50.              'label'        => __( 'Select Slides', 'themeum-core' ),
  51.              'type'         => Controls_Manager::SELECT2,
  52.              'options'      => crowdfunding_all_published_post_raised(),
  53.              'multiple'     => true,
  54.  
  55.           ]
  56.         );  
  57.  
  58.         $this->end_controls_section();
  59.  
  60.         $this->start_controls_section(
  61.             'section_title_style',
  62.             [
  63.                 'label' => __( 'Title', 'themeum-core' ),
  64.                 'tab' => Controls_Manager::TAB_STYLE,
  65.             ]
  66.         );
  67.  
  68.         $this->add_control(
  69.             'title_color',
  70.             [
  71.                 'label' => __( 'Text Color', 'themeum-core' ),
  72.                 'type' => Controls_Manager::COLOR,
  73.                 'scheme' => [
  74.                     'type' => Scheme_Color::get_type(),
  75.                     'value' => Scheme_Color::COLOR_1,
  76.                 ],
  77.                 'selectors' => [
  78.                     '{{WRAPPER}} .thm-heading-title' => 'color: {{VALUE}};',
  79.                 ],
  80.             ]
  81.         );
  82.  
  83.         $this->add_group_control(
  84.             Group_Control_Typography::get_type(),
  85.             [
  86.                 'name'      => 'typography',
  87.                 'scheme'    => Scheme_Typography::TYPOGRAPHY_1,
  88.                 'selector'  => '{{WRAPPER}} .thm-heading-title',
  89.             ]
  90.         );
  91.     }
  92.  
  93.     public function get_script_depends() {
  94.         return [ 'jquery-slick' ];
  95.     }
  96.  
  97.     protected function render( ) {
  98.         $settings = $this->get_settings();
  99.         $slider_list = $settings['slides_item']; ?>
  100.  
  101.         <div class="online-school pt--100 pb--70">
  102.             <div class="onnline-inner-row">
  103.                 <div class="container">
  104.                     <div class="row">
  105.  
  106.                     <?php
  107.                     foreach ($slider_list as $value) {
  108.                         setup_postdata($value);
  109.                         $id = get_page_by_path( $value,'OBJECT','product' );
  110.                         if( isset($id->ID) ){
  111.                             if( $id->ID ){
  112.                                 $id     = $id->ID;
  113.                                 $link   = get_permalink( $id );
  114.                                 $title  = get_the_title( $id );
  115.                                 $content= get_the_excerpt( $id );
  116.                                 $img    = get_post_meta( $id, 'themeum_slide_images', true );
  117.                                 $localtion  = get_post_meta( $id, '_nf_location', true );
  118.                                 if($img){ $img  = wp_get_attachment_image_src( $img , 'full' ); } ?>
  119.                    
  120.                                 <div class="col-md-10 col-md-offset-1 col-sm-10 col-sm-offset-1 col-xs-12">
  121.                                     <div class="on-school-details">
  122.                                         <h4>Help Us Build a New <span class="theme__text">Church Online School</span></h4>
  123.                                         <?php
  124.                                         if( function_exists('crowdfunding_excerpt_max_charlength') ){ ?>
  125.                                             <div class="product-slide-intro"><?php echo crowdfunding_excerpt_max_charlength( $content, 130 ); ?></div>
  126.                                         <?php } ?>
  127.                                     </div>
  128.                                     <div class="remainings">
  129.                                         <span class="theme__text">$10,500</span>
  130.                                         <p>Remaining to helps</p>
  131.                                     </div>
  132.                                     <div class="col-md-10 col-md-offset-1 col-sm-10 col-sm-offset-1 col-xs-12">
  133.                                         <div class="on-scholl-progress">
  134.                                             <?php
  135.                                                 $css_width = WPNEOCF()->getFundRaisedPercent($id);
  136.                                                 if( $css_width >= 100 ){ $css_width = 100; } ?>
  137.                                             <div class="pgr-top">
  138.                                                 <span><?php esc_html_e('Donated', 'backer'); ?></span>
  139.                                                 <span><?php echo $css_width; ?>%</span>
  140.                                             </div>
  141.                                             <div class="progress-area">
  142.                                                
  143.                                                 <div class="progress-bar left-anim" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: <?php echo $css_width; ?>%;"></div>
  144.  
  145.                                             </div>
  146.                                             <div class="pgr-bottom">
  147.                                                 <p><?php esc_html_e('Raised: ', 'backer'); ?><span class="theme__text"><?php echo wpneo_crowdfunding_price(wpneo_crowdfunding_get_total_fund_raised_by_campaign($id)); ?></span></p>
  148.                                                 <p><?php esc_html_e('Goal: ', 'backer'); ?> <span class="theme__text"><?php echo wpneo_crowdfunding_price(wpneo_crowdfunding_get_total_goal_by_campaign($id)); ?></span></p>
  149.                                             </div>
  150.                                         </div>
  151.                                         <div class="btn-area btn-style-one">
  152.                                             <a href="#">donate now</a>
  153.                                         </div>
  154.                                     </div>
  155.                                 </div>
  156.                         <?php } wp_reset_postdata(); } } ?>
  157.                     </div>
  158.                 </div>
  159.             </div>
  160.         </div>
  161.  
  162.         <?php
  163.     }
  164.  
  165.     protected function _content_template() {}
  166. }
  167.  
  168. Plugin::instance()->widgets_manager->register_widget_type( new Widget_Themeum_Raised_Content() );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement