Your IP : 216.73.216.95


Current Path : /var/test/www/ooareogundevinitiative/wp-content/themes/pain/framework/widgets/
Upload File :
Current File : /var/test/www/ooareogundevinitiative/wp-content/themes/pain/framework/widgets/recent-compains.php

<?php
	class jwstheme_Recent_Compains_Widget extends jwstheme_Widget {
		function __construct() {
			parent::__construct(
			'jw_recent_compains', // Base ID
			__('Recent Compains', 'pain'), // Name
			array('description' => __('Display a new post of your posts on your site.', 'pain'),) // Args
			);
			$this->settings           = array(
			'title'  => array(
			'type'  => 'text',
			'std'   => __( 'Help Compains', 'pain' ),
			'label' => __( 'Title', 'pain' )
			),
			'el_class'  => array(
			'type'  => 'text',
			'std'   => '',
			'label' => __( 'Extra Class', 'pain' )
			),
            'count_number'  => array(
			'type'  => 'text',
			'std'   => '',
			'label' => __( 'Number Campain', 'pain' )
			)
			);
			add_action('admin_enqueue_scripts', array($this, 'widget_scripts'));
		}
		function widget_scripts() {
			wp_enqueue_script('widget_scripts', URI_PATH . '/framework/widgets/widgets.js');
		}
		function widget( $args, $instance ) {
			ob_start();
			global $post;
			extract( $args );
			$title                  = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base );
			$el_class               = sanitize_title( $instance['el_class'] );
            $count_number              = sanitize_title( $instance['count_number'] );
			echo ''.$before_widget;
			if ( $title )
			echo ''.$before_title . $title . $after_title;
			$query_args = array(
			'posts_per_page' => $count_number ,
			'orderby' => 'date',
			'order' => 'DESC',
			'post_type' => 'give_forms',
			'post_status' => 'publish');
			$wp_query = new WP_Query($query_args);   
			if ($wp_query->have_posts()){
			?>
			<div class="jw-recent-compains">
				<?php while ($wp_query->have_posts()){ $wp_query->the_post(); ?>
					<article <?php post_class(); ?>>
						<div class="compains-item">
							<div class="compains-content">
								<div class="compains-content-inner">
									<h3 class="compains-title">
										<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
									</h3>
								</div>
							</div>
						</div>
					</article>
				<?php } ?>
			</div>
			<?php 
			}
			wp_reset_postdata();
			echo ''.$after_widget;
			$content = ob_get_clean();
			echo ''.$content;
		}
	}
	/* Class jwstheme_Recent_Donation_Widget */

      if(function_exists('insert_widgets')) {
       function jwstheme_recent_compains_widget() {
		    	insert_widgets('jwstheme_Recent_Compains_Widget'); 
	   }
  	add_action('widgets_init', 'jwstheme_recent_compains_widget');
    }