Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace Elementor;
- function crowdfunding_all_published_post_raised(){
- $data = array();
- $args = array(
- 'post_type' => 'product',
- 'post_status' => 'publish',
- );
- $query1 = get_posts( $args );
- foreach ( $query1 as $post ) {
- $data[ $post->post_name ] = $post->post_title;
- }
- return $data;
- }
- if ( ! defined( 'ABSPATH' ) ) exit; # Exit if accessed directly
- class Widget_Themeum_Raised_Content extends Widget_Base {
- private $query = null;
- protected $_has_template_content = false;
- public function get_name() {
- return 'backer-fundraised';
- }
- public function get_title() {
- return __( 'Themeum Funded Raised', 'themeum-core' );
- }
- public function get_icon() {
- return 'eicon-slideshow';
- }
- public function get_categories() {
- return [ 'themeum-elementor' ];
- }
- protected function _register_controls() {
- $this->start_controls_section(
- 'section_slider',
- [
- 'label' => __( 'Slider Element', 'themeum-core' )
- ]
- );
- $this->add_control(
- 'slides_item',
- [
- 'label' => __( 'Select Slides', 'themeum-core' ),
- 'type' => Controls_Manager::SELECT2,
- 'options' => crowdfunding_all_published_post_raised(),
- 'multiple' => true,
- ]
- );
- $this->end_controls_section();
- $this->start_controls_section(
- 'section_title_style',
- [
- 'label' => __( 'Title', 'themeum-core' ),
- 'tab' => Controls_Manager::TAB_STYLE,
- ]
- );
- $this->add_control(
- 'title_color',
- [
- 'label' => __( 'Text Color', 'themeum-core' ),
- 'type' => Controls_Manager::COLOR,
- 'scheme' => [
- 'type' => Scheme_Color::get_type(),
- 'value' => Scheme_Color::COLOR_1,
- ],
- 'selectors' => [
- '{{WRAPPER}} .thm-heading-title' => 'color: {{VALUE}};',
- ],
- ]
- );
- $this->add_group_control(
- Group_Control_Typography::get_type(),
- [
- 'name' => 'typography',
- 'scheme' => Scheme_Typography::TYPOGRAPHY_1,
- 'selector' => '{{WRAPPER}} .thm-heading-title',
- ]
- );
- }
- public function get_script_depends() {
- return [ 'jquery-slick' ];
- }
- protected function render( ) {
- $settings = $this->get_settings();
- $slider_list = $settings['slides_item']; ?>
- <div class="online-school pt--100 pb--70">
- <div class="onnline-inner-row">
- <div class="container">
- <div class="row">
- <?php
- foreach ($slider_list as $value) {
- setup_postdata($value);
- $id = get_page_by_path( $value,'OBJECT','product' );
- if( isset($id->ID) ){
- if( $id->ID ){
- $id = $id->ID;
- $link = get_permalink( $id );
- $title = get_the_title( $id );
- $content= get_the_excerpt( $id );
- $img = get_post_meta( $id, 'themeum_slide_images', true );
- $localtion = get_post_meta( $id, '_nf_location', true );
- if($img){ $img = wp_get_attachment_image_src( $img , 'full' ); } ?>
- <div class="col-md-10 col-md-offset-1 col-sm-10 col-sm-offset-1 col-xs-12">
- <div class="on-school-details">
- <h4>Help Us Build a New <span class="theme__text">Church Online School</span></h4>
- <?php
- if( function_exists('crowdfunding_excerpt_max_charlength') ){ ?>
- <div class="product-slide-intro"><?php echo crowdfunding_excerpt_max_charlength( $content, 130 ); ?></div>
- <?php } ?>
- </div>
- <div class="remainings">
- <span class="theme__text">$10,500</span>
- <p>Remaining to helps</p>
- </div>
- <div class="col-md-10 col-md-offset-1 col-sm-10 col-sm-offset-1 col-xs-12">
- <div class="on-scholl-progress">
- <?php
- $css_width = WPNEOCF()->getFundRaisedPercent($id);
- if( $css_width >= 100 ){ $css_width = 100; } ?>
- <div class="pgr-top">
- <span><?php esc_html_e('Donated', 'backer'); ?></span>
- <span><?php echo $css_width; ?>%</span>
- </div>
- <div class="progress-area">
- <div class="progress-bar left-anim" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: <?php echo $css_width; ?>%;"></div>
- </div>
- <div class="pgr-bottom">
- <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>
- <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>
- </div>
- </div>
- <div class="btn-area btn-style-one">
- <a href="#">donate now</a>
- </div>
- </div>
- </div>
- <?php } wp_reset_postdata(); } } ?>
- </div>
- </div>
- </div>
- </div>
- <?php
- }
- protected function _content_template() {}
- }
- Plugin::instance()->widgets_manager->register_widget_type( new Widget_Themeum_Raised_Content() );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement