Your IP : 216.73.216.196
<?php
class Crowdngo_Donations extends Apus_Widget {
public function __construct() {
parent::__construct(
'apus_donations',
esc_html__('Apus Donations Widget', 'crowdngo'),
array( 'description' => esc_html__( 'Show list of donations', 'crowdngo' ), )
);
$this->widgetName = 'recent_donations';
}
public function getTemplate() {
$this->template = 'donations.php';
}
public function widget( $args, $instance ) {
$this->display($args, $instance);
}
public function form( $instance ) {
$defaults = array(
'title' => 'Latest Donations',
'type' => 'latest' ,
'number_post' => '4',
'grid_style' => 'default'
);
$instance = wp_parse_args((array) $instance, $defaults);
?>
<p>
<label for="<?php echo esc_attr($this->get_field_id( 'title' )); ?>"><?php esc_html_e( 'Title:', 'crowdngo' ); ?></label>
<input class="widefat" id="<?php echo esc_attr($this->get_field_id( 'title' )); ?>" name="<?php echo esc_attr($this->get_field_name( 'title' )); ?>" type="text" value="<?php echo esc_attr( $instance['title'] ); ?>" />
</p>
<p>
<label for="<?php echo esc_attr($this->get_field_id('type')); ?>">
<?php echo esc_html__('Type:', 'crowdngo' ); ?>
</label>
<br>
<select id="<?php echo esc_attr($this->get_field_id('type')); ?>" name="<?php echo esc_attr($this->get_field_name('type')); ?>">
<option value="<?php echo esc_attr( 'latest' ); ?>" <?php selected($instance['type'],'latest'); ?> ><?php echo esc_html_e( 'Latest', 'crowdngo' ); ?></option>
<option value="<?php echo esc_attr( 'featured' ); ?>" <?php selected($instance['type'],'featured'); ?> ><?php echo esc_html_e( 'Featured', 'crowdngo' ); ?></option>
<option value="<?php echo esc_attr( 'popular' ); ?>" <?php selected($instance['type'],'popular'); ?> ><?php echo esc_html_e( 'Popular', 'crowdngo' ); ?></option>
</select>
</p>
<p>
<label for="<?php echo esc_attr($this->get_field_id( 'number_post' )); ?>"><?php esc_html_e( 'Limit:', 'crowdngo' ); ?></label>
<input class="widefat" id="<?php echo esc_attr($this->get_field_id( 'number_post' )); ?>" name="<?php echo esc_attr($this->get_field_name( 'number_post' )); ?>" type="text" value="<?php echo esc_attr($instance['number_post']); ?>" />
</p>
<p>
<label for="<?php echo esc_attr($this->get_field_id('grid_style')); ?>">
<?php echo esc_html__('Type:', 'crowdngo' ); ?>
</label>
<br>
</p>
<?php
}
public function update( $new_instance, $old_instance ) {
$instance = array();
$instance['title'] = ( ! empty( $new_instance['title'] ) ) ? strip_tags( $new_instance['title'] ) : '';
$instance['type'] = ( ! empty( $new_instance['type'] ) ) ? strip_tags( $new_instance['type'] ) : 'latest';
$instance['number_post'] = ( ! empty( $new_instance['number_post'] ) ) ? strip_tags( $new_instance['number_post'] ) : '';
return $instance;
}
}
if ( function_exists('apus_framework_reg_widget') ) {
apus_framework_reg_widget('Crowdngo_Donations');
}