Add blocks layout to calendar close #22
This commit is contained in:
@@ -19,6 +19,10 @@
|
||||
content: "\f163";
|
||||
}
|
||||
|
||||
.post-state-format.post-format-blocks:before, .post-format-icon.post-format-blocks:before, a.post-state-format.format-blocks:before {
|
||||
content: "\f164";
|
||||
}
|
||||
|
||||
#sp_videodiv .inside > fieldset > p:last-child {
|
||||
margin-bottom: 1px !important;
|
||||
}
|
||||
|
||||
@@ -51,6 +51,9 @@
|
||||
.sp-icon-list:before {
|
||||
content: "\f163"
|
||||
}
|
||||
.sp-icon-blocks:before {
|
||||
content: "\f164"
|
||||
}
|
||||
.sp-icon-smile:before {
|
||||
content: "\f328";
|
||||
}
|
||||
|
||||
@@ -26,11 +26,6 @@
|
||||
content: "\f140";
|
||||
position: absolute;
|
||||
}
|
||||
.sp-data-table .team-logo {
|
||||
vertical-align: middle;
|
||||
height: 2.5em;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
/* Pagination */
|
||||
.sp-paginated-table {
|
||||
@@ -66,6 +61,13 @@
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* League table */
|
||||
.sp-league-table .team-logo {
|
||||
vertical-align: middle;
|
||||
height: 2.5em;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
/* Event Calendar */
|
||||
.sp-event-calendar tbody td, .sp-event-calendar thead th {
|
||||
text-align: center;
|
||||
@@ -76,6 +78,7 @@
|
||||
.sp-event-calendar #prev {
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
/* Event List */
|
||||
.sp-event-list .column-article {
|
||||
white-space: nowrap;
|
||||
@@ -84,6 +87,33 @@
|
||||
padding-right: 3px;
|
||||
}
|
||||
|
||||
/* Event Blocks */
|
||||
.sp-event-blocks .event-date,
|
||||
.sp-event-blocks .event-time,
|
||||
.sp-event-blocks .event-results,
|
||||
.sp-event-blocks .event-title {
|
||||
text-align: center;
|
||||
display: block;
|
||||
margin: 10px 20%;
|
||||
padding: 0 20px;
|
||||
clear: none;
|
||||
}
|
||||
.sp-event-blocks .team-logo {
|
||||
width: 20%;
|
||||
height: auto;
|
||||
margin: 10px;
|
||||
}
|
||||
.sp-event-blocks .logo-odd {
|
||||
float: left;
|
||||
}
|
||||
.sp-event-blocks .logo-even {
|
||||
float: right;
|
||||
}
|
||||
.widget .sp-event-blocks .event-title {
|
||||
margin: 10px;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
/* Google Maps */
|
||||
.sp-google-map {
|
||||
height: 320px;
|
||||
|
||||
Binary file not shown.
@@ -10,6 +10,7 @@
|
||||
<glyph unicode="" d="M76.8 102.4h102.4v204.8h-102.4v-204.8zM204.8 102.4h102.4v307.2h-102.4v-307.2zM332.8 307.2v-204.8h102.4v204.8h-102.4z" />
|
||||
<glyph unicode="" d="M384 435.2h-51.2v-51.2h51.2v51.2zM435.2 435.2h-25.6v-76.8h-102.4v76.8h-102.4v-76.8h-102.4v76.8h-25.6c-14.16 0-25.6-11.44-25.6-25.6v-358.4c0-14.16 11.44-25.6 25.6-25.6h358.4c14.16 0 25.6 11.44 25.6 25.6v358.4c0 14.16-11.44 25.6-25.6 25.6zM409.6 76.8h-307.2v230.4h307.2v-230.4zM179.2 435.2h-51.2v-51.2h51.2v51.2zM281.6 256h-51.2v-51.2h51.2v51.2zM358.4 256h-51.2v-51.2h51.2v51.2zM204.8 179.2h-51.2v-51.2h51.2v51.2zM204.8 256h-51.2v-51.2h51.2v51.2zM281.6 179.2h-51.2v-51.2h51.2v51.2zM358.4 179.2h-51.2v-51.2h51.2v51.2z" />
|
||||
<glyph unicode="" d="M153.6 332.8h51.2v-51.2h-51.2v51.2zM153.6 256h51.2v-51.2h-51.2v51.2zM153.6 179.2h51.2v-51.2h-51.2v51.2zM256 179.2h102.4v-51.2h-102.4v51.2zM435.2 435.2h-358.4c-14.16 0-25.6-11.44-25.6-25.6v-358.4c0-14.16 11.44-25.6 25.6-25.6h358.4c14.16 0 25.6 11.44 25.6 25.6v358.4c0 14.16-11.44 25.6-25.6 25.6zM409.6 76.8h-307.2v307.2h307.2v-307.2zM256 256h102.4v-51.2h-102.4v51.2zM256 332.8h102.4v-51.2h-102.4v51.2z" />
|
||||
<glyph unicode="" d="M153.6 179.2h204.8v-51.2h-204.8v51.2zM153.6 256h204.8v-51.2h-204.8v51.2zM435.2 435.2h-358.4c-14.16 0-25.6-11.44-25.6-25.6v-358.4c0-14.16 11.44-25.6 25.6-25.6h358.4c14.16 0 25.6 11.44 25.6 25.6v358.4c0 14.16-11.44 25.6-25.6 25.6zM409.6 76.8h-307.2v307.2h307.2v-307.2zM153.6 332.8h204.8v-51.2h-204.8v51.2z" />
|
||||
<glyph unicode="" d="M384 102.4h-256v179.2h-76.8v102.4l130.4 25.6c8.56-33.12 38.56-57.6 74.4-57.6s65.84 24.48 74.4 57.6l130.4-25.6v-102.4h-76.8v-179.2zM384 76.8v-51.2h-256v51.2h256z" />
|
||||
<glyph unicode="" d="M435.2 332.8h-0.8l0.8-177.6v-1.6c0-6.96-2.56-12.96-7.6-18s-11.040-7.6-18-7.6h-307.2c-7.2 0-13.28 2.56-18.24 7.6s-7.36 11.040-7.36 18v1.6l0.8 177.6h-0.8c-7.2 0-13.28 2.48-18.24 7.36s-7.36 11.040-7.36 18.24 2.48 13.28 7.36 18.24 10.96 7.36 18.080 7.36 13.12-2.48 18.24-7.36 7.52-11.040 7.52-18.24c0-8.8-3.6-15.76-10.8-20.8l87.6-124 66.4 147.2c-4.56 1.84-8.16 4.96-11.040 9.2s-4.16 8.96-4.16 14c0 7.2 2.48 13.28 7.36 18.24s10.96 7.36 18 7.36c7.040 0 13.12-2.48 18.24-7.36s7.6-11.040 7.6-18.24c0-5.040-1.44-9.76-4.16-14s-6.48-7.36-11.040-9.2l66.4-147.2 87.6 124c-7.2 5.040-10.8 12-10.8 20.8 0 7.2 2.48 13.28 7.36 18.24s10.96 7.36 18 7.36 13.12-2.48 18.24-7.36 7.6-11.040 7.6-18.24-2.56-13.28-7.6-18.24-11.040-7.36-18-7.36zM76.8 102.4h358.4c6.96 0 12.96-2.48 18-7.36s7.6-10.96 7.6-18-2.56-13.12-7.6-18.24-11.040-7.6-18-7.6h-358.4c-6.96 0-12.96 2.56-18 7.6s-7.6 11.12-7.6 18.16 2.48 13.040 7.36 18 11.040 7.44 18.24 7.44z" />
|
||||
<glyph unicode="" d="M381.28 261.12c-8.56-52.4-48.16-94.16-99.68-104.8v-54c0-28.32 22.96-51.28 51.28-51.28h25.6v-25.6h-204.96v25.6h25.6c28.32 0 51.28 22.96 51.28 51.28v54c-51.44 10.64-91.12 52.4-99.68 104.8-60.48 15.84-105.36 70.4-105.36 135.84 0 4.4 0.88 8.56 1.28 12.8h101.2v51.2h256.24v-51.28h101.2c0.4-4.32 1.28-8.4 1.28-12.8 0-65.44-44.8-119.92-105.28-135.76zM127.92 384.080h-75.6c4.96-44.4 34.96-81.040 75.6-95.6v95.6zM384.080 384.080v-95.6c40.64 14.56 70.56 51.2 75.6 95.6h-75.6z" />
|
||||
|
||||
|
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 6.4 KiB |
Binary file not shown.
Binary file not shown.
@@ -24,6 +24,7 @@ class SP_Meta_Box_Calendar_Details {
|
||||
$season_id = sp_get_the_term_id( $post->ID, 'sp_season', 0 );
|
||||
$venue_id = sp_get_the_term_id( $post->ID, 'sp_venue', 0 );
|
||||
$team_id = get_post_meta( $post->ID, 'sp_team', true );
|
||||
$order = get_post_meta( $post->ID, 'sp_order', true );
|
||||
?>
|
||||
<div>
|
||||
<p><strong><?php _e( 'Status', 'sportspress' ); ?></strong></p>
|
||||
@@ -97,6 +98,13 @@ class SP_Meta_Box_Calendar_Details {
|
||||
endif;
|
||||
?>
|
||||
</p>
|
||||
<p><strong><?php _e( 'Sort Order', 'sportspress' ); ?></strong></p>
|
||||
<p>
|
||||
<select name="sp_order">
|
||||
<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>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
@@ -110,5 +118,6 @@ class SP_Meta_Box_Calendar_Details {
|
||||
wp_set_post_terms( $post_id, sp_array_value( $_POST, 'sp_venue', 0 ), 'sp_venue' );
|
||||
update_post_meta( $post_id, 'sp_status', sp_array_value( $_POST, 'sp_status', 0 ) );
|
||||
update_post_meta( $post_id, 'sp_team', sp_array_value( $_POST, 'sp_team', 0 ) );
|
||||
update_post_meta( $post_id, 'sp_order', sp_array_value( $_POST, 'sp_order', array() ) );
|
||||
}
|
||||
}
|
||||
@@ -19,7 +19,8 @@ class SP_Meta_Box_List_Data {
|
||||
* Output the metabox
|
||||
*/
|
||||
public static function output( $post ) {
|
||||
list( $columns, $usecolumns, $data, $placeholders, $merged ) = sp_get_player_list_data( $post->ID, true );
|
||||
$list = new SP_Player_List( $post );
|
||||
list( $columns, $usecolumns, $data, $placeholders, $merged ) = $list->data( true );
|
||||
$adjustments = get_post_meta( $post->ID, 'sp_adjustments', true );
|
||||
self::table( $columns, $usecolumns, $data, $placeholders, $adjustments );
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ class SP_Meta_Box_List_Details {
|
||||
endif;
|
||||
?>
|
||||
</p>
|
||||
<p><strong><?php _e( 'Sort by:', 'sportspress' ); ?></strong></p>
|
||||
<p><strong><?php _e( 'Sort by', 'sportspress' ); ?></strong></p>
|
||||
<p>
|
||||
<?php
|
||||
$args = array(
|
||||
@@ -87,7 +87,7 @@ class SP_Meta_Box_List_Details {
|
||||
endif;
|
||||
?>
|
||||
</p>
|
||||
<p><strong><?php _e( 'Sort Order:', 'sportspress' ); ?></strong></p>
|
||||
<p><strong><?php _e( 'Sort Order', 'sportspress' ); ?></strong></p>
|
||||
<p>
|
||||
<select name="sp_order">
|
||||
<option value="ASC" <?php selected( 'ASC', $order ); ?>><?php _e( 'Ascending', 'sportspress' ); ?></option>
|
||||
|
||||
@@ -15,6 +15,9 @@ class SP_Calendar extends SP_Custom_Post {
|
||||
/** @var array The events status. */
|
||||
public $status;
|
||||
|
||||
/** @var array The events order. */
|
||||
public $order;
|
||||
|
||||
/**
|
||||
* __construct function.
|
||||
*
|
||||
@@ -31,9 +34,13 @@ class SP_Calendar extends SP_Custom_Post {
|
||||
endif;
|
||||
|
||||
$this->status = $this->__get( 'status' );
|
||||
$this->order = $this->__get( 'order' );
|
||||
|
||||
if ( ! $this->status )
|
||||
$this->status = 'any';
|
||||
|
||||
if ( ! $this->order )
|
||||
$this->order = 'ASC';
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -49,8 +56,8 @@ class SP_Calendar extends SP_Custom_Post {
|
||||
'post_type' => 'sp_event',
|
||||
'numberposts' => -1,
|
||||
'posts_per_page' => -1,
|
||||
'orderby' => 'post_date',
|
||||
'order' => 'ASC',
|
||||
'orderby' => 'date',
|
||||
'order' => $this->order,
|
||||
'post_status' => $this->status,
|
||||
'tax_query' => array(
|
||||
'relation' => 'AND'
|
||||
|
||||
@@ -30,6 +30,7 @@ class SP_Formats {
|
||||
'calendar' => array(
|
||||
'calendar' => __( 'Calendar', 'sportspress' ),
|
||||
'list' => __( 'List', 'sportspress' ),
|
||||
'blocks' => __( 'Blocks', 'sportspress' ),
|
||||
),
|
||||
'list' => array(
|
||||
'list' => __( 'List', 'sportspress' ),
|
||||
|
||||
@@ -151,14 +151,10 @@ if ( ! function_exists( 'sportspress_output_calendar' ) ) {
|
||||
function sportspress_output_calendar() {
|
||||
$id = get_the_ID();
|
||||
$format = get_post_meta( $id, 'sp_format', true );
|
||||
switch ( $format ):
|
||||
case 'list':
|
||||
sp_get_template( 'event-list.php', array( 'id' => $id ) );
|
||||
break;
|
||||
default:
|
||||
if ( array_key_exists( $format, SP()->formats->calendar ) )
|
||||
sp_get_template( 'event-' . $format . '.php', array( 'id' => $id ) );
|
||||
else
|
||||
sp_get_template( 'event-calendar.php', array( 'id' => $id ) );
|
||||
break;
|
||||
endswitch;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -237,14 +233,10 @@ if ( ! function_exists( 'sportspress_output_player_list' ) ) {
|
||||
function sportspress_output_player_list() {
|
||||
$id = get_the_ID();
|
||||
$format = get_post_meta( $id, 'sp_format', true );
|
||||
switch ( $format ):
|
||||
case 'gallery':
|
||||
sp_get_template( 'player-gallery.php', array( 'id' => $id ) );
|
||||
break;
|
||||
default:
|
||||
if ( array_key_exists( $format, SP()->formats->list ) )
|
||||
sp_get_template( 'player-' . $format . '.php', array( 'id' => $id ) );
|
||||
else
|
||||
sp_get_template( 'player-list.php', array( 'id' => $id ) );
|
||||
break;
|
||||
endswitch;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -156,14 +156,6 @@ function sportspress_pre_get_posts( $query ) {
|
||||
if ( is_sp_config_type( $post_type ) ):
|
||||
$query->set( 'orderby', 'menu_order' );
|
||||
$query->set( 'order', 'ASC' );
|
||||
elseif ( $post_type == 'sp_event' ):
|
||||
$query->set( 'orderby', 'post_date' );
|
||||
$query->set( 'order', 'ASC' );
|
||||
endif;
|
||||
else:
|
||||
$post_type = $query->get( 'post_type' );
|
||||
if ( $query->is_post_type_archive && $post_type == 'sp_event' ):
|
||||
$query->set( 'order' , 'ASC' );
|
||||
endif;
|
||||
endif;
|
||||
|
||||
|
||||
94
includes/widgets/class-sp-widget-event-blocks.php
Normal file
94
includes/widgets/class-sp-widget-event-blocks.php
Normal file
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
class SP_Widget_Event_Blocks extends WP_Widget {
|
||||
|
||||
function __construct() {
|
||||
$widget_ops = array('classname' => 'widget_sp_event_blocks', 'description' => __( 'A list of events.', 'sportspress' ) );
|
||||
parent::__construct('sp_event_blocks', __( 'SportsPress Event Blocks', 'sportspress' ), $widget_ops);
|
||||
}
|
||||
|
||||
function widget( $args, $instance ) {
|
||||
extract($args);
|
||||
$title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
|
||||
$id = empty($instance['id']) ? null : $instance['id'];
|
||||
$status = empty($instance['status']) ? 'default' : $instance['status'];
|
||||
$number = empty($instance['number']) ? null : $instance['number'];
|
||||
$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-blocks.php', array( 'id' => $id, 'status' => $status, 'number' => $number, 'order' => $order, 'show_all_events_link' => $show_all_events_link ) );
|
||||
echo $after_widget;
|
||||
}
|
||||
|
||||
function update( $new_instance, $old_instance ) {
|
||||
$instance = $old_instance;
|
||||
$instance['title'] = strip_tags($new_instance['title']);
|
||||
$instance['id'] = intval($new_instance['id']);
|
||||
$instance['status'] = $new_instance['status'];
|
||||
$instance['number'] = intval($new_instance['number']);
|
||||
$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, 'order' => 'default', 'show_all_events_link' => true ) );
|
||||
$title = strip_tags($instance['title']);
|
||||
$id = intval($instance['id']);
|
||||
$status = $instance['status'];
|
||||
$number = intval($instance['number']);
|
||||
$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>
|
||||
<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></p>
|
||||
|
||||
<p><label for="<?php echo $this->get_field_id('id'); ?>"><?php printf( __( 'Select %s:', 'sportspress' ), __( 'Calendar', 'sportspress' ) ); ?></label>
|
||||
<?php
|
||||
$args = array(
|
||||
'post_type' => 'sp_calendar',
|
||||
'show_option_all' => __( 'All', 'sportspress' ),
|
||||
'name' => $this->get_field_name('id'),
|
||||
'id' => $this->get_field_id('id'),
|
||||
'selected' => $id,
|
||||
'values' => 'ID',
|
||||
'class' => 'sp-event-calendar-select widefat',
|
||||
);
|
||||
if ( ! sp_dropdown_pages( $args ) ):
|
||||
sp_post_adder( 'sp_calendar', __( 'Add New', 'sportspress' ) );
|
||||
endif;
|
||||
?>
|
||||
</p>
|
||||
|
||||
<p><label for="<?php echo $this->get_field_id('status'); ?>"><?php _e( 'Status:', 'sportspress' ); ?></label>
|
||||
<?php
|
||||
$args = array(
|
||||
'show_option_default' => __( 'Default', 'sportspress' ),
|
||||
'name' => $this->get_field_name('status'),
|
||||
'id' => $this->get_field_id('status'),
|
||||
'selected' => $status,
|
||||
'class' => 'sp-event-status-select widefat',
|
||||
);
|
||||
sp_dropdown_statuses( $args );
|
||||
?>
|
||||
</p>
|
||||
|
||||
<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-event-calendar-show-all-toggle<?php if ( ! $id ): ?> hidden<?php endif; ?>"><input class="checkbox" type="checkbox" id="<?php echo $this->get_field_id('show_all_events_link'); ?>" name="<?php echo $this->get_field_name('show_all_events_link'); ?>" value="1" <?php checked( $show_all_events_link, 1 ); ?>>
|
||||
<label for="<?php echo $this->get_field_id('show_all_events_link'); ?>"><?php _e( 'Display link to view all events', 'sportspress' ); ?></label></p>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
register_widget( 'SP_Widget_Event_Blocks' );
|
||||
@@ -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
|
||||
|
||||
@@ -19,7 +19,7 @@ class SP_Widget_Player_list extends WP_Widget {
|
||||
if ( $title )
|
||||
echo $before_title . $title . $after_title;
|
||||
echo '<div id="sp_player_list_wrap">';
|
||||
sp_get_template( 'player-list.php', array( 'id' => $id, 'number' => $number, 'performance' => $performance, 'orderby' => $orderby , 'order' => $order, 'show_all_players_link' => $show_all_players_link ) );
|
||||
sp_get_template( 'player-list.php', array( 'id' => $id, 'number' => $number, 'performance' => $performance, 'orderby' => $orderby, 'order' => $order, 'show_all_players_link' => $show_all_players_link ) );
|
||||
echo '</div>';
|
||||
echo $after_widget;
|
||||
}
|
||||
|
||||
@@ -243,6 +243,7 @@ final class SportsPress {
|
||||
include_once( 'includes/widgets/class-sp-widget-countdown.php' );
|
||||
include_once( 'includes/widgets/class-sp-widget-event-calendar.php' );
|
||||
include_once( 'includes/widgets/class-sp-widget-event-list.php' );
|
||||
include_once( 'includes/widgets/class-sp-widget-event-blocks.php' );
|
||||
include_once( 'includes/widgets/class-sp-widget-league-table.php' );
|
||||
include_once( 'includes/widgets/class-sp-widget-player-list.php' );
|
||||
include_once( 'includes/widgets/class-sp-widget-player-gallery.php' );
|
||||
|
||||
98
templates/event-blocks.php
Normal file
98
templates/event-blocks.php
Normal file
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
/**
|
||||
* Event Blocks
|
||||
*
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @version 0.8
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
|
||||
$primary_result = get_option( 'sportspress_primary_result', null );
|
||||
|
||||
$defaults = array(
|
||||
'status' => 'default',
|
||||
'number' => -1,
|
||||
'order' => 'default',
|
||||
'show_all_events_link' => false,
|
||||
);
|
||||
|
||||
extract( $defaults, EXTR_SKIP );
|
||||
|
||||
$calendar = new SP_Calendar( $id );
|
||||
if ( $status != 'default' )
|
||||
$calendar->status = $status;
|
||||
if ( $order != 'default' )
|
||||
$calendar->order = $order;
|
||||
$data = $calendar->data();
|
||||
$usecolumns = $calendar->columns;
|
||||
|
||||
if ( isset( $columns ) )
|
||||
$usecolumns = $columns;
|
||||
?>
|
||||
<div class="sp-table-wrapper">
|
||||
<table class="sp-event-blocks sp-data-table">
|
||||
<tbody>
|
||||
<?php
|
||||
$i = 0;
|
||||
|
||||
if ( is_int( $number ) && $number > 0 )
|
||||
$limit = $number;
|
||||
|
||||
foreach ( $data as $event ):
|
||||
if ( isset( $limit ) && $i >= $limit ) continue;
|
||||
|
||||
$results = get_post_meta( $event->ID, 'sp_results', true );
|
||||
|
||||
$teams = get_post_meta( $event->ID, 'sp_team' );
|
||||
$logos = array();
|
||||
$main_results = array();
|
||||
|
||||
$j = 0;
|
||||
foreach( $teams as $team ):
|
||||
if ( ! has_post_thumbnail ( $team ) )
|
||||
continue;
|
||||
$j++;
|
||||
$logo = get_the_post_thumbnail( $team, 'sportspress-fit-icon', array( 'class' => 'team-logo logo-' . ( $j % 2 ? 'odd' : 'even' ) ) );
|
||||
$logos[] = $logo;
|
||||
$team_results = sp_array_value( $results, $team, null );
|
||||
|
||||
if ( $primary_result ):
|
||||
$team_result = sp_array_value( $team_results, $primary_result, null );
|
||||
else:
|
||||
if ( is_array( $team_results ) ):
|
||||
end( $team_results );
|
||||
$team_result = prev( $team_results );
|
||||
else:
|
||||
$team_result = null;
|
||||
endif;
|
||||
endif;
|
||||
if ( $team_result != null )
|
||||
$main_results[] = $team_result;
|
||||
|
||||
endforeach;
|
||||
?>
|
||||
<tr class="sp-row sp-post<?php echo ( $i % 2 == 0 ? ' alternate' : '' ); ?>">
|
||||
<td>
|
||||
<?php echo implode( $logos, ' ' ); ?>
|
||||
<time class="event-date"><?php echo get_the_time( get_option( 'date_format' ), $event ); ?></time>
|
||||
<?php if ( $event->post_status == 'future' ): ?>
|
||||
<h5 class="event-time"><?php echo get_the_time( get_option( 'time_format' ), $event ); ?></h5>
|
||||
<?php else: ?>
|
||||
<h5 class="event-results"><?php echo implode( $main_results, ' - ' ); ?></h5>
|
||||
<?php endif; ?>
|
||||
<h3 class="event-title"><a href="<?php echo get_post_permalink( $event ); ?>"><?php echo $event->post_title; ?></a></h3>
|
||||
</td>
|
||||
</tr>
|
||||
<?
|
||||
$i++;
|
||||
endforeach;
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
<?php
|
||||
if ( $id && $show_all_events_link )
|
||||
echo '<a class="sp-calendar-link sp-view-all-link" href="' . get_permalink( $id ) . '">' . SP()->text->string('View all events') . '</a>';
|
||||
?>
|
||||
</div>
|
||||
@@ -18,25 +18,28 @@ $defaults = array(
|
||||
'responsive' => get_option( 'sportspress_enable_responsive_tables', 'yes' ) == 'yes' ? true : false,
|
||||
'paginated' => get_option( 'sportspress_calendar_paginated', 'yes' ) == 'yes' ? true : false,
|
||||
'rows' => get_option( 'sportspress_calendar_rows', 10 ),
|
||||
'order' => 'default',
|
||||
'show_all_events_link' => false,
|
||||
);
|
||||
|
||||
extract( $defaults, EXTR_SKIP );
|
||||
|
||||
$calendar = new SP_Calendar( $id );
|
||||
if ( $status != 'default' )
|
||||
$calendar->status = $status;
|
||||
if ( $order != 'default' )
|
||||
$calendar->order = $order;
|
||||
$data = $calendar->data();
|
||||
$usecolumns = $calendar->columns;
|
||||
|
||||
if ( isset( $columns ) )
|
||||
$usecolumns = $columns;
|
||||
?>
|
||||
<div class="sp-table-wrapper">
|
||||
<table class="sp-event-list sp-data-table<?php if ( $responsive ) { ?> sp-responsive-table<?php } if ( $paginated ) { ?> sp-paginated-table<?php } ?>" data-sp-rows="<?php echo $rows; ?>">
|
||||
<thead>
|
||||
<tr>
|
||||
<?php
|
||||
$calendar = new SP_Calendar( $id );
|
||||
if ( $status != 'default' )
|
||||
$calendar->status = $status;
|
||||
$data = $calendar->data();
|
||||
$usecolumns = $calendar->columns;
|
||||
|
||||
if ( isset( $columns ) )
|
||||
$usecolumns = $columns;
|
||||
|
||||
echo '<th class="data-date">' . SP()->text->string('Date') . '</th>';
|
||||
|
||||
if ( $usecolumns == null || in_array( 'event', $usecolumns ) )
|
||||
|
||||
Reference in New Issue
Block a user