Add blocks layout to calendar close #22
This commit is contained in:
@@ -13,11 +13,12 @@ class SP_Widget_Event_List extends WP_Widget {
|
||||
$status = empty($instance['status']) ? 'default' : $instance['status'];
|
||||
$number = empty($instance['number']) ? null : $instance['number'];
|
||||
$columns = empty($instance['columns']) ? null : $instance['columns'];
|
||||
$order = empty($instance['order']) ? 'default' : $instance['order'];
|
||||
$show_all_events_link = empty($instance['show_all_events_link']) ? false : $instance['show_all_events_link'];
|
||||
echo $before_widget;
|
||||
if ( $title )
|
||||
echo $before_title . $title . $after_title;
|
||||
sp_get_template( 'event-list.php', array( 'id' => $id, 'status' => $status, 'number' => $number, 'columns' => $columns, 'show_all_events_link' => $show_all_events_link ) );
|
||||
sp_get_template( 'event-list.php', array( 'id' => $id, 'status' => $status, 'number' => $number, 'columns' => $columns, 'order' => $order, 'show_all_events_link' => $show_all_events_link ) );
|
||||
echo $after_widget;
|
||||
}
|
||||
|
||||
@@ -28,18 +29,20 @@ class SP_Widget_Event_List extends WP_Widget {
|
||||
$instance['status'] = $new_instance['status'];
|
||||
$instance['number'] = intval($new_instance['number']);
|
||||
$instance['columns'] = (array)$new_instance['columns'];
|
||||
$instance['order'] = strip_tags($new_instance['order']);
|
||||
$instance['show_all_events_link'] = $new_instance['show_all_events_link'];
|
||||
|
||||
return $instance;
|
||||
}
|
||||
|
||||
function form( $instance ) {
|
||||
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'id' => null, 'status' => 'default', 'number' => 5, 'columns' => null, 'show_all_events_link' => true ) );
|
||||
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'id' => null, 'status' => 'default', 'number' => 5, 'columns' => null, 'order' => 'default', 'show_all_events_link' => true ) );
|
||||
$title = strip_tags($instance['title']);
|
||||
$id = intval($instance['id']);
|
||||
$status = $instance['status'];
|
||||
$number = intval($instance['number']);
|
||||
$columns = $instance['columns'];
|
||||
$order = strip_tags($instance['order']);
|
||||
$show_all_events_link = $instance['show_all_events_link'];
|
||||
?>
|
||||
<p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e( 'Title:', 'sportspress' ); ?></label>
|
||||
@@ -78,6 +81,13 @@ class SP_Widget_Event_List extends WP_Widget {
|
||||
<p><label for="<?php echo $this->get_field_id('number'); ?>"><?php _e( 'Number of events to show:', 'sportspress' ); ?></label>
|
||||
<input id="<?php echo $this->get_field_id('number'); ?>" name="<?php echo $this->get_field_name('number'); ?>" type="text" value="<?php echo esc_attr($number); ?>" size="3"></p>
|
||||
|
||||
<p><label for="<?php echo $this->get_field_id('order'); ?>"><?php _e( 'Sort Order:', 'sportspress' ); ?></label>
|
||||
<select name="<?php echo $this->get_field_name('order'); ?>" id="<?php echo $this->get_field_id('order'); ?>" class="sp-select-order widefat">
|
||||
<option value="default" <?php selected( 'default', $order ); ?>><?php _e( 'Default', 'sportspress' ); ?></option>
|
||||
<option value="ASC" <?php selected( 'ASC', $order ); ?>><?php _e( 'Ascending', 'sportspress' ); ?></option>
|
||||
<option value="DESC" <?php selected( 'DESC', $order ); ?>><?php _e( 'Descending', 'sportspress' ); ?></option>
|
||||
</select></p>
|
||||
|
||||
<p class="sp-prefs">
|
||||
<?php _e( 'Columns:', 'sportspress' ); ?><br>
|
||||
<?php
|
||||
|
||||
Reference in New Issue
Block a user