Add table heading option to widgets

This commit is contained in:
Brian Miyaji
2015-07-17 15:32:29 +10:00
parent f3c6a6878b
commit f7742a69cd
18 changed files with 162 additions and 53 deletions

View File

@@ -2,13 +2,14 @@
class SP_Widget_Countdown extends WP_Widget {
function __construct() {
$widget_ops = array('classname' => 'widget_countdown widget_sp_countdown', 'description' => __( 'A clock that counts down to an upcoming event.', 'sportspress' ) );
$widget_ops = array('classname' => 'widget_sportspress widget_countdown widget_sp_countdown', 'description' => __( 'A clock that counts down to an upcoming event.', 'sportspress' ) );
parent::__construct('sportspress-countdown', __( 'Countdown', 'sportspress' ), $widget_ops);
}
function widget( $args, $instance ) {
extract($args);
$title = apply_filters('widget_title', empty($instance['title']) ? null : $instance['title'], $instance, $this->id_base);
$caption = empty($instance['caption']) ? null : $instance['caption'];
$team = empty($instance['team']) ? null : $instance['team'];
$id = empty($instance['id']) ? null : $instance['id'];
$show_venue = empty($instance['show_venue']) ? false : $instance['show_venue'];
@@ -23,7 +24,7 @@ class SP_Widget_Countdown extends WP_Widget {
// Action to hook into
do_action( 'sportspress_before_widget_template', $args, $instance, 'countdown' );
sp_get_template( 'countdown.php', array( 'team' => $team, 'id' => $id, 'show_venue' => $show_venue, 'show_league' => $show_league ) );
sp_get_template( 'countdown.php', array( 'team' => $team, 'id' => $id, 'title' => $caption, 'show_venue' => $show_venue, 'show_league' => $show_league ) );
// Action to hook into
do_action( 'sportspress_after_widget_template', $args, $instance, 'countdown' );
@@ -36,6 +37,7 @@ class SP_Widget_Countdown extends WP_Widget {
$instance = $old_instance;
$instance['title'] = strip_tags($new_instance['title']);
$instance['team'] = intval($new_instance['team']);
$instance['caption'] = strip_tags($new_instance['caption']);
$instance['id'] = intval($new_instance['id']);
$instance['show_venue'] = intval($new_instance['show_venue']);
$instance['show_league'] = intval($new_instance['show_league']);
@@ -47,8 +49,9 @@ class SP_Widget_Countdown extends WP_Widget {
}
function form( $instance ) {
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'team' => '', 'id' => '', 'show_venue' => false, 'show_league' => false ) );
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'team' => '', 'id' => '', 'caption' => '', 'show_venue' => false, 'show_league' => false ) );
$title = strip_tags($instance['title']);
$caption = strip_tags($instance['caption']);
$team = intval($instance['team']);
$id = intval($instance['id']);
$show_venue = intval($instance['show_venue']);
@@ -60,6 +63,9 @@ class SP_Widget_Countdown extends WP_Widget {
<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('caption'); ?>"><?php _e( 'Heading:', 'sportspress' ); ?></label>
<input class="widefat" id="<?php echo $this->get_field_id('caption'); ?>" name="<?php echo $this->get_field_name('caption'); ?>" type="text" value="<?php echo esc_attr($caption); ?>" /></p>
<p class="sp-dropdown-filter"><label for="<?php echo $this->get_field_id('team'); ?>"><?php printf( __( 'Select %s:', 'sportspress' ), __( 'Team', 'sportspress' ) ); ?></label>
<?php
$args = array(

View File

@@ -2,7 +2,7 @@
class SP_Widget_Event_Blocks extends WP_Widget {
function __construct() {
$widget_ops = array('classname' => 'widget_sp_event_blocks', 'description' => __( 'A list of events.', 'sportspress' ) );
$widget_ops = array('classname' => 'widget_sportspress widget_sp_event_blocks', 'description' => __( 'A list of events.', 'sportspress' ) );
parent::__construct('sportspress-event-blocks', __( 'Event Blocks', 'sportspress' ), $widget_ops);
}
@@ -10,6 +10,7 @@ class SP_Widget_Event_Blocks extends WP_Widget {
extract($args);
$title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
$id = empty($instance['id']) ? null : $instance['id'];
$caption = empty($instance['caption']) ? null : $instance['caption'];
$status = empty($instance['status']) ? 'default' : $instance['status'];
$date = empty($instance['date']) ? 'default' : $instance['date'];
$date_from = empty($instance['date_from']) ? 'default' : $instance['date_from'];
@@ -27,7 +28,7 @@ class SP_Widget_Event_Blocks extends WP_Widget {
// Action to hook into
do_action( 'sportspress_before_widget_template', $args, $instance, 'event-blocks' );
sp_get_template( 'event-blocks.php', array( 'id' => $id, 'status' => $status, 'date' => $date, 'date_from' => $date_from, 'date_to' => $date_to, 'number' => $number, 'order' => $order, 'show_all_events_link' => $show_all_events_link ) );
sp_get_template( 'event-blocks.php', array( 'id' => $id, 'title' => $caption, 'status' => $status, 'date' => $date, 'date_from' => $date_from, 'date_to' => $date_to, 'number' => $number, 'order' => $order, 'show_all_events_link' => $show_all_events_link ) );
// Action to hook into
do_action( 'sportspress_after_widget_template', $args, $instance, 'event-blocks' );
@@ -40,6 +41,7 @@ class SP_Widget_Event_Blocks extends WP_Widget {
$instance = $old_instance;
$instance['title'] = strip_tags($new_instance['title']);
$instance['id'] = intval($new_instance['id']);
$instance['caption'] = strip_tags($new_instance['caption']);
$instance['status'] = $new_instance['status'];
$instance['date'] = $new_instance['date'];
$instance['date_from'] = $new_instance['date_from'];
@@ -55,9 +57,10 @@ class SP_Widget_Event_Blocks extends WP_Widget {
}
function form( $instance ) {
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'id' => null, 'status' => 'default', 'date' => 'default', 'date_from' => date_i18n( 'Y-m-d' ), 'date_to' => date_i18n( 'Y-m-d' ), 'number' => 5, 'order' => 'default', 'show_all_events_link' => true ) );
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'id' => null, 'caption' => '', 'status' => 'default', 'date' => 'default', 'date_from' => date_i18n( 'Y-m-d' ), 'date_to' => date_i18n( 'Y-m-d' ), 'number' => 5, 'order' => 'default', 'show_all_events_link' => true ) );
$title = strip_tags($instance['title']);
$id = intval($instance['id']);
$caption = strip_tags($instance['caption']);
$status = $instance['status'];
$date = $instance['date'];
$date_from = $instance['date_from'];
@@ -72,6 +75,9 @@ class SP_Widget_Event_Blocks extends WP_Widget {
<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('caption'); ?>"><?php _e( 'Heading:', 'sportspress' ); ?></label>
<input class="widefat" id="<?php echo $this->get_field_id('caption'); ?>" name="<?php echo $this->get_field_name('caption'); ?>" type="text" value="<?php echo esc_attr($caption); ?>" /></p>
<p><label for="<?php echo $this->get_field_id('id'); ?>"><?php printf( __( 'Select %s:', 'sportspress' ), __( 'Calendar', 'sportspress' ) ); ?></label>
<?php
$args = array(

View File

@@ -2,7 +2,7 @@
class SP_Widget_Event_Calendar extends WP_Widget {
function __construct() {
$widget_ops = array('classname' => 'widget_calendar widget_sp_event_calendar', 'description' => __( 'A calendar of events.', 'sportspress' ) );
$widget_ops = array('classname' => 'widget_sportspress widget_calendar widget_sp_event_calendar', 'description' => __( 'A calendar of events.', 'sportspress' ) );
parent::__construct('sportspress-event-calendar', __( 'Event Calendar', 'sportspress' ), $widget_ops);
}

View File

@@ -2,7 +2,7 @@
class SP_Widget_Event_List extends WP_Widget {
function __construct() {
$widget_ops = array('classname' => 'widget_sp_event_list', 'description' => __( 'A list of events.', 'sportspress' ) );
$widget_ops = array('classname' => 'widget_sportspress widget_sp_event_list', 'description' => __( 'A list of events.', 'sportspress' ) );
parent::__construct('sportspress-event-list', __( 'Event List', 'sportspress' ), $widget_ops);
}
@@ -10,6 +10,7 @@ class SP_Widget_Event_List extends WP_Widget {
extract($args);
$title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
$id = empty($instance['id']) ? null : $instance['id'];
$caption = empty($instance['caption']) ? null : $instance['caption'];
$status = empty($instance['status']) ? 'default' : $instance['status'];
$date = empty($instance['date']) ? 'default' : $instance['date'];
$date_from = empty($instance['date_from']) ? 'default' : $instance['date_from'];
@@ -28,7 +29,7 @@ class SP_Widget_Event_List extends WP_Widget {
// Action to hook into
do_action( 'sportspress_before_widget_template', $args, $instance, 'event-list' );
sp_get_template( 'event-list.php', array( 'id' => $id, 'status' => $status, 'date' => $date, 'date_from' => $date_from, 'date_to' => $date_to, 'number' => $number, 'columns' => $columns, 'order' => $order, 'show_all_events_link' => $show_all_events_link ) );
sp_get_template( 'event-list.php', array( 'id' => $id, 'title' => $caption, 'status' => $status, 'date' => $date, 'date_from' => $date_from, 'date_to' => $date_to, 'number' => $number, 'columns' => $columns, 'order' => $order, 'show_all_events_link' => $show_all_events_link ) );
// Action to hook into
do_action( 'sportspress_after_widget_template', $args, $instance, 'event-list' );
@@ -41,6 +42,7 @@ class SP_Widget_Event_List extends WP_Widget {
$instance = $old_instance;
$instance['title'] = strip_tags($new_instance['title']);
$instance['id'] = intval($new_instance['id']);
$instance['caption'] = strip_tags($new_instance['caption']);
$instance['status'] = $new_instance['status'];
$instance['date'] = $new_instance['date'];
$instance['date_from'] = $new_instance['date_from'];
@@ -57,9 +59,10 @@ class SP_Widget_Event_List extends WP_Widget {
}
function form( $instance ) {
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'id' => null, 'status' => 'default', 'date' => 'default', 'date_from' => date_i18n( 'Y-m-d' ), 'date_to' => date_i18n( 'Y-m-d' ), 'number' => 5, 'columns' => null, 'order' => 'default', 'show_all_events_link' => true ) );
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'id' => null, 'caption' => '', 'status' => 'default', 'date' => 'default', 'date_from' => date_i18n( 'Y-m-d' ), 'date_to' => date_i18n( 'Y-m-d' ), 'number' => 5, 'columns' => null, 'order' => 'default', 'show_all_events_link' => true ) );
$title = strip_tags($instance['title']);
$id = intval($instance['id']);
$caption = strip_tags($instance['caption']);
$status = $instance['status'];
$date = $instance['date'];
$date_from = $instance['date_from'];
@@ -75,6 +78,9 @@ class SP_Widget_Event_List extends WP_Widget {
<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('caption'); ?>"><?php _e( 'Heading:', 'sportspress' ); ?></label>
<input class="widefat" id="<?php echo $this->get_field_id('caption'); ?>" name="<?php echo $this->get_field_name('caption'); ?>" type="text" value="<?php echo esc_attr($caption); ?>" /></p>
<p><label for="<?php echo $this->get_field_id('id'); ?>"><?php printf( __( 'Select %s:', 'sportspress' ), __( 'Calendar', 'sportspress' ) ); ?></label>
<?php
$args = array(

View File

@@ -2,7 +2,7 @@
class SP_Widget_League_Table extends WP_Widget {
function __construct() {
$widget_ops = array('classname' => 'widget_league_table widget_sp_league_table', 'description' => __( 'Display a league table.', 'sportspress' ) );
$widget_ops = array('classname' => 'widget_sportspress widget_league_table widget_sp_league_table', 'description' => __( 'Display a league table.', 'sportspress' ) );
parent::__construct('sportspress-league-table', __( 'League Table', 'sportspress' ), $widget_ops);
}
@@ -11,6 +11,7 @@ class SP_Widget_League_Table extends WP_Widget {
$id = empty($instance['id']) ? 0 : $instance['id'];
if ( $id <= 0 ) return;
$title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
$caption = empty($instance['caption']) ? null : $instance['caption'];
$number = empty($instance['number']) ? null : $instance['number'];
$columns = empty($instance['columns']) ? array() : $instance['columns'];
$show_team_logo = empty($instance['show_team_logo']) ? false : $instance['show_team_logo'];
@@ -25,7 +26,7 @@ class SP_Widget_League_Table extends WP_Widget {
// Action to hook into
do_action( 'sportspress_before_widget_template', $args, $instance, 'league-table' );
sp_get_template( 'league-table.php', array( 'id' => $id, 'number' => $number, 'columns' => $columns, 'show_full_table_link' => $show_full_table_link, 'show_team_logo' => $show_team_logo ) );
sp_get_template( 'league-table.php', array( 'id' => $id, 'title' => $caption, 'number' => $number, 'columns' => $columns, 'show_full_table_link' => $show_full_table_link, 'show_team_logo' => $show_team_logo ) );
// Action to hook into
do_action( 'sportspress_after_widget_template', $args, $instance, 'league-table' );
@@ -38,6 +39,7 @@ class SP_Widget_League_Table extends WP_Widget {
$instance = $old_instance;
$instance['title'] = strip_tags($new_instance['title']);
$instance['id'] = intval($new_instance['id']);
$instance['caption'] = strip_tags($new_instance['caption']);
$instance['number'] = intval($new_instance['number']);
$instance['columns'] = (array)$new_instance['columns'];
$instance['show_team_logo'] = $new_instance['show_team_logo'];
@@ -50,10 +52,11 @@ class SP_Widget_League_Table extends WP_Widget {
}
function form( $instance ) {
$defaults = apply_filters( 'sportspress_widget_defaults', array( 'title' => '', 'id' => '', 'number' => 5, 'columns' => null, 'show_team_logo' => false, 'show_full_table_link' => true ) );
$defaults = apply_filters( 'sportspress_widget_defaults', array( 'title' => '', 'id' => '', 'caption' => '', 'number' => 5, 'columns' => null, 'show_team_logo' => false, 'show_full_table_link' => true ) );
$instance = wp_parse_args( (array) $instance, $defaults );
$title = strip_tags($instance['title']);
$id = intval($instance['id']);
$caption = strip_tags($instance['caption']);
$number = intval($instance['number']);
$columns = $instance['columns'];
$show_team_logo = $instance['show_team_logo'];
@@ -65,6 +68,9 @@ class SP_Widget_League_Table extends WP_Widget {
<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('caption'); ?>"><?php _e( 'Heading:', 'sportspress' ); ?></label>
<input class="widefat" id="<?php echo $this->get_field_id('caption'); ?>" name="<?php echo $this->get_field_name('caption'); ?>" type="text" value="<?php echo esc_attr($caption); ?>" /></p>
<p><label for="<?php echo $this->get_field_id('id'); ?>"><?php printf( __( 'Select %s:', 'sportspress' ), __( 'League Table', 'sportspress' ) ); ?></label>
<?php
$args = array(

View File

@@ -2,7 +2,7 @@
class SP_Widget_Player_Gallery extends WP_Widget {
function __construct() {
$widget_ops = array('classname' => 'widget_player_gallery widget_sp_player_gallery', 'description' => __( 'Display a gallery of players.', 'sportspress' ) );
$widget_ops = array('classname' => 'widget_sportspress widget_player_gallery widget_sp_player_gallery', 'description' => __( 'Display a gallery of players.', 'sportspress' ) );
parent::__construct('sportspress-player-gallery', __( 'Player Gallery', 'sportspress' ), $widget_ops);
}
@@ -11,6 +11,7 @@ class SP_Widget_Player_Gallery extends WP_Widget {
$id = empty($instance['id']) ? 0 : $instance['id'];
if ( $id <= 0 ) return;
$title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
$caption = empty($instance['caption']) ? null : $instance['caption'];
$number = empty($instance['number']) ? null : $instance['number'];
$columns = empty($instance['columns']) ? null : $instance['columns'];
$orderby = empty($instance['orderby']) ? 'default' : $instance['orderby'];
@@ -27,7 +28,7 @@ class SP_Widget_Player_Gallery extends WP_Widget {
// Action to hook into
do_action( 'sportspress_before_widget_template', $args, $instance, 'player-gallery' );
sp_get_template( 'player-gallery.php', array( 'id' => $id, 'number' => $number, 'columns' => $columns, 'orderby' => $orderby , 'order' => $order, 'grouping' => 0, 'show_all_players_link' => $show_all_players_link, 'show_names_on_hover' => $show_names_on_hover ) );
sp_get_template( 'player-gallery.php', array( 'id' => $id, 'title' => $caption, 'number' => $number, 'columns' => $columns, 'orderby' => $orderby , 'order' => $order, 'grouping' => 0, 'show_all_players_link' => $show_all_players_link, 'show_names_on_hover' => $show_names_on_hover ) );
// Action to hook into
do_action( 'sportspress_after_widget_template', $args, $instance, 'player-gallery' );
@@ -40,6 +41,7 @@ class SP_Widget_Player_Gallery extends WP_Widget {
$instance = $old_instance;
$instance['title'] = strip_tags($new_instance['title']);
$instance['id'] = intval($new_instance['id']);
$instance['caption'] = strip_tags($new_instance['caption']);
$instance['number'] = intval($new_instance['number']);
$instance['columns'] = intval($new_instance['columns']);
$instance['orderby'] = strip_tags($new_instance['orderby']);
@@ -54,9 +56,10 @@ class SP_Widget_Player_Gallery extends WP_Widget {
}
function form( $instance ) {
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'id' => '', 'number' => 5, 'columns' => 2, 'orderby' => 'default', 'order' => 'ASC', 'show_all_players_link' => true, 'show_names_on_hover' => false ) );
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'id' => '', 'caption' => '', 'number' => 5, 'columns' => 2, 'orderby' => 'default', 'order' => 'ASC', 'show_all_players_link' => true, 'show_names_on_hover' => false ) );
$title = strip_tags($instance['title']);
$id = intval($instance['id']);
$caption = strip_tags($instance['caption']);
$number = intval($instance['number']);
$columns = intval($instance['columns']);
$orderby = strip_tags($instance['orderby']);
@@ -70,6 +73,9 @@ class SP_Widget_Player_Gallery extends WP_Widget {
<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('caption'); ?>"><?php _e( 'Heading:', 'sportspress' ); ?></label>
<input class="widefat" id="<?php echo $this->get_field_id('caption'); ?>" name="<?php echo $this->get_field_name('caption'); ?>" type="text" value="<?php echo esc_attr($caption); ?>" /></p>
<p><label for="<?php echo $this->get_field_id('id'); ?>"><?php printf( __( 'Select %s:', 'sportspress' ), __( 'Player List', 'sportspress' ) ); ?></label>
<?php
$args = array(

View File

@@ -2,7 +2,7 @@
class SP_Widget_Player_list extends WP_Widget {
function __construct() {
$widget_ops = array('classname' => 'widget_player_list widget_sp_player_list', 'description' => __( 'Display a list of players.', 'sportspress' ) );
$widget_ops = array('classname' => 'widget_sportspress widget_player_list widget_sp_player_list', 'description' => __( 'Display a list of players.', 'sportspress' ) );
parent::__construct('sportspress-player-list', __( 'Player List', 'sportspress' ), $widget_ops);
}
@@ -11,6 +11,7 @@ class SP_Widget_Player_list extends WP_Widget {
$id = empty($instance['id']) ? 0 : $instance['id'];
if ( $id <= 0 ) return;
$title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base);
$caption = empty($instance['caption']) ? null : $instance['caption'];
$number = empty($instance['number']) ? null : $instance['number'];
$columns = $instance['columns'];
$orderby = empty($instance['orderby']) ? 'default' : $instance['orderby'];
@@ -26,7 +27,7 @@ class SP_Widget_Player_list extends WP_Widget {
// Action to hook into
do_action( 'sportspress_before_widget_template', $args, $instance, 'player-list' );
sp_get_template( 'player-list.php', array( 'id' => $id, 'number' => $number, 'columns' => $columns, 'orderby' => $orderby, 'order' => $order, 'grouping' => 0, 'show_all_players_link' => $show_all_players_link ) );
sp_get_template( 'player-list.php', array( 'id' => $id, 'title' => $caption, 'number' => $number, 'columns' => $columns, 'orderby' => $orderby, 'order' => $order, 'grouping' => 0, 'show_all_players_link' => $show_all_players_link ) );
// Action to hook into
do_action( 'sportspress_after_widget_template', $args, $instance, 'player-list' );
@@ -39,6 +40,7 @@ class SP_Widget_Player_list extends WP_Widget {
$instance = $old_instance;
$instance['title'] = strip_tags($new_instance['title']);
$instance['id'] = intval($new_instance['id']);
$instance['caption'] = strip_tags($new_instance['caption']);
$instance['number'] = intval($new_instance['number']);
$instance['columns'] = (array)$new_instance['columns'];
$instance['orderby'] = strip_tags($new_instance['orderby']);
@@ -52,9 +54,10 @@ class SP_Widget_Player_list extends WP_Widget {
}
function form( $instance ) {
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'id' => '', 'number' => 5, 'columns' => null, 'orderby' => 'default', 'order' => 'ASC', 'show_all_players_link' => true ) );
$instance = wp_parse_args( (array) $instance, array( 'title' => '', 'id' => '', 'caption' => '', 'number' => 5, 'columns' => null, 'orderby' => 'default', 'order' => 'ASC', 'show_all_players_link' => true ) );
$title = strip_tags($instance['title']);
$id = intval($instance['id']);
$caption = strip_tags($instance['caption']);
$number = intval($instance['number']);
$columns = $instance['columns'];
$orderby = strip_tags($instance['orderby']);
@@ -67,6 +70,9 @@ class SP_Widget_Player_list extends WP_Widget {
<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('caption'); ?>"><?php _e( 'Heading:', 'sportspress' ); ?></label>
<input class="widefat" id="<?php echo $this->get_field_id('caption'); ?>" name="<?php echo $this->get_field_name('caption'); ?>" type="text" value="<?php echo esc_attr($caption); ?>" /></p>
<p><label for="<?php echo $this->get_field_id('id'); ?>"><?php printf( __( 'Select %s:', 'sportspress' ), __( 'Player List', 'sportspress' ) ); ?></label>
<?php
$args = array(

View File

@@ -2,7 +2,7 @@
class SP_Widget_Staff extends WP_Widget {
function __construct() {
$widget_ops = array('classname' => 'widget_staff widget_sp_staff', 'description' => __( 'Display a single staff member.', 'sportspress' ) );
$widget_ops = array('classname' => 'widget_sportspress widget_staff widget_sp_staff', 'description' => __( 'Display a single staff member.', 'sportspress' ) );
parent::__construct('sportspress-staff', __( 'Staff', 'sportspress' ), $widget_ops);
}
@@ -20,6 +20,8 @@ class SP_Widget_Staff extends WP_Widget {
// Action to hook into
do_action( 'sportspress_before_widget_template', $args, $instance, 'staff' );
echo '<h4 class="sp-table-caption">' . get_the_title( $id ) . '</h4>';
sp_get_template( 'staff-photo.php', array( 'id' => $id ) );
sp_get_template( 'staff-details.php', array( 'id' => $id ) );

View File

@@ -12,6 +12,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
$defaults = array(
'team' => null,
'id' => null,
'title' => null,
'live' => get_option( 'sportspress_enable_live_countdowns', 'yes' ) == 'yes' ? true : false,
'link_events' => get_option( 'sportspress_link_events', 'yes' ) == 'yes' ? true : false,
'link_teams' => get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false,
@@ -31,6 +32,9 @@ extract( $defaults, EXTR_SKIP );
if ( ! isset( $post ) ) return;
if ( $title )
echo '<h4 class="sp-table-caption">' . $title . '</h4>';
$title = $post->post_title;
if ( $link_events ) $title = '<a href="' . get_post_permalink( $post->ID, false, true ) . '">' . $title . '</a>';
?>

View File

@@ -13,6 +13,7 @@ $primary_result = get_option( 'sportspress_primary_result', null );
$defaults = array(
'id' => null,
'title' => false,
'status' => 'default',
'date' => 'default',
'date_from' => 'default',
@@ -46,13 +47,16 @@ if ( $order != 'default' )
$data = $calendar->data();
$usecolumns = $calendar->columns;
if ( $show_title && false === $title && $id )
$title = get_the_title( $id );
if ( isset( $columns ) ) {
$usecolumns = $columns;
}
if ( $show_title && $id ) {
echo '<h4 class="sp-table-caption">' . get_the_title( $id ) . '</h4>';
}
if ( $title )
echo '<h4 class="sp-table-caption">' . $title . '</h4>';
?>
<div class="sp-template sp-template-event-blocks">
<div class="sp-table-wrapper">
@@ -71,6 +75,7 @@ if ( $show_title && $id ) {
$results = get_post_meta( $event->ID, 'sp_results', true );
$teams = array_unique( get_post_meta( $event->ID, 'sp_team' ) );
$teams = array_filter( $teams, 'sp_filter_positive' );
$logos = array();
$main_results = array();
@@ -79,7 +84,7 @@ if ( $show_title && $id ) {
$j++;
if ( has_post_thumbnail ( $team ) ):
if ( $link_teams ):
$logo = '<a class="team-logo logo-' . ( $j % 2 ? 'odd' : 'even' ) . '" href="' . get_post_permalink( $team, false, true ) . '" title="' . get_the_title( $team ) . '">' . get_the_post_thumbnail( $team, 'sportspress-fit-icon' ) . '</a>';
$logo = '<a class="team-logo logo-' . ( $j % 2 ? 'odd' : 'even' ) . '" href="' . get_permalink( $team, false, true ) . '" title="' . get_the_title( $team ) . '">' . get_the_post_thumbnail( $team, 'sportspress-fit-icon' ) . '</a>';
else:
$logo = get_the_post_thumbnail( $team, 'sportspress-fit-icon', array( 'class' => 'team-logo logo-' . ( $j % 2 ? 'odd' : 'even' ) ) );
endif;
@@ -106,11 +111,7 @@ if ( $show_title && $id ) {
<td>
<?php echo implode( $logos, ' ' ); ?>
<time class="sp-event-date" datetime="<?php echo $event->post_date; ?>"><?php echo get_the_time( get_option( 'date_format' ), $event ); ?></time>
<?php if ( ! empty( $main_results ) ): ?>
<h5 class="sp-event-results"><?php echo implode( $main_results, ' - ' ); ?></h5>
<?php else: ?>
<h5 class="sp-event-time"><?php echo get_the_time( get_option( 'time_format' ), $event ); ?></h5>
<?php endif; ?>
<h5 class="sp-event-results"><span class="sp-result"><?php echo implode( '</span>-<span class="sp-result">', sp_get_main_results_or_time( $event ) ); ?></span></h5>
<?php if ( $show_league ): $leagues = get_the_terms( $event, 'sp_league' ); if ( $leagues ): $league = array_shift( $leagues ); ?>
<div class="sp-event-league"><?php echo $league->name; ?></div>
<?php endif; endif; ?>
@@ -139,6 +140,6 @@ if ( $show_title && $id ) {
</div>
<?php
if ( $id && $show_all_events_link )
echo '<a class="sp-calendar-link sp-view-all-link" href="' . get_permalink( $id ) . '">' . __( 'View all events', 'sportspress' ) . '</a>';
echo '<div class="sp-calendar-link sp-view-all-link"><a href="' . get_permalink( $id ) . '">' . __( 'View all events', 'sportspress' ) . '</a></div>';
?>
</div>

View File

@@ -217,7 +217,7 @@ if ( $pad != 0 && $pad != 7 )
$calendar_output .= "\n\t</tr>\n\t</tbody>\n\t</table>\n\t</div>";
if ( $id && $show_all_events_link )
$calendar_output .= '<a class="sp-calendar-link sp-view-all-link" href="' . get_permalink( $id ) . '">' . __( 'View all events', 'sportspress' ) . '</a>';
$calendar_output .= '<div class="sp-calendar-link sp-view-all-link"><a href="' . get_permalink( $id ) . '">' . __( 'View all events', 'sportspress' ) . '</a></div>';
?>
<div class="sp-template sp-template-event-calendar">
<?php echo $calendar_output; ?>

View File

@@ -11,6 +11,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
$defaults = array(
'id' => null,
'title' => false,
'status' => 'default',
'date' => 'default',
'date_from' => 'default',
@@ -55,9 +56,11 @@ if ( isset( $columns ) ):
$usecolumns = explode( ',', $columns );
endif;
if ( $show_title && $id ) {
echo '<h4 class="sp-table-caption">' . get_the_title( $id ) . '</h4>';
}
if ( $show_title && false === $title && $id )
$title = get_the_title( $id );
if ( $title )
echo '<h4 class="sp-table-caption">' . $title . '</h4>';
?>
<div class="sp-template sp-template-event-list">
<div class="sp-table-wrapper">
@@ -359,6 +362,6 @@ if ( $show_title && $id ) {
</div>
<?php
if ( $id && $show_all_events_link )
echo '<a class="sp-calendar-link sp-view-all-link" href="' . get_permalink( $id ) . '">' . __( 'View all events', 'sportspress' ) . '</a>';
echo '<div class="sp-calendar-link sp-view-all-link"><a href="' . get_permalink( $id ) . '">' . __( 'View all events', 'sportspress' ) . '</a></div>';
?>
</div>

View File

@@ -10,24 +10,57 @@
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
if ( get_option( 'sportspress_event_show_logos', 'yes' ) === 'no' ) return;
$show_team_names = get_option( 'sportspress_event_logos_show_team_names', 'no' ) === 'yes' ? true : false;
$show_results = get_option( 'sportspress_event_logos_show_results', 'no' ) === 'yes' ? true : false;
if ( ! isset( $id ) )
$id = get_the_ID();
if ( $show_results ) {
$results = sp_get_main_results( $id );
if ( empty( $results ) ) {
$show_results = false;
}
}
$teams = get_post_meta( $id, 'sp_team' );
$teams = array_filter( $teams, 'sp_filter_positive' );
if ( $teams ):
$team_logos = array();
$i = 0;
foreach ( $teams as $team ):
if ( ! has_post_thumbnail( $team ) ) continue;
$logo = get_the_post_thumbnail( $team, 'sportspress-fit-icon' );
// Add team name
if ( $show_team_names ) {
if ( $i % 2 ) {
$logo .= ' <strong class="sp-team-name">' . get_the_title( $team ) . '</strong>';
} else {
$logo = '<strong class="sp-team-name">' . get_the_title( $team ) . '</strong> ' . $logo;
}
}
// Add link
if ( get_option( 'sportspress_link_teams', 'no' ) == 'yes' ) $logo = '<a href="' . get_post_permalink( $team ) . '">' . $logo . '</a>';
$team_logos[] = $logo;
// Add result
if ( $show_results ) {
if ( $i % 2 ) {
$logo = '<strong class="sp-team-result">' . array_shift( $results ) . '</strong> ' . $logo;
} else {
$logo .= ' <strong class="sp-team-result">' . array_shift( $results ) . '</strong>';
}
}
$team_logos[] = '<span class="sp-team-logo">' . $logo . '</span>';
$i++;
endforeach;
$team_logos = array_filter( $team_logos );
if ( ! empty( $team_logos ) ):
echo '<div class="sp-template sp-template-event-logos sp-event-logos">';
echo '<div class="sp-template sp-template-event-logos"><div class="sp-event-logos">';
$delimiter = get_option( 'sportspress_event_teams_delimiter', 'vs' );
echo implode( ' ' . $delimiter . ' ', $team_logos );
echo '</div>';
echo '</div></div>';
endif;
endif;

View File

@@ -28,6 +28,9 @@ if ( ! isset( $id ) )
$teams = get_post_meta( $id, 'sp_team', false );
if ( is_array( $teams ) ):
?>
<div class="sp-event-performance-tables sp-event-performance-<?php echo $split_positions ? 'positions' : 'teams'; ?>">
<?php
$event = new SP_Event( $id );
$performance = $event->performance();
@@ -140,7 +143,7 @@ if ( is_array( $teams ) ):
}
sp_get_template( 'event-performance-table.php', array(
'position' => $position->name,
'position' => sp_get_position_caption( $position->term_id ),
'scrollable' => $scrollable,
'sortable' => $sortable,
'show_players' => $show_team_players,
@@ -221,7 +224,7 @@ if ( is_array( $teams ) ):
'show_numbers' => $show_numbers,
'show_extras' => $show_extras,
'show_total' => $show_total,
'caption' => $position->name,
'caption' => sp_get_position_caption( $position->term_id ),
'labels' => $labels,
'mode' => $mode,
'data' => $subdata,
@@ -251,4 +254,9 @@ if ( is_array( $teams ) ):
) );
}
}
do_action( 'sportspress_event_performance' );
?>
</div><!-- .sp-event-performance-tables -->
<?php
endif;

View File

@@ -47,8 +47,8 @@ foreach( $venues as $venue ):
<td<?php if ( $address != null ) { ?> colspan="2"<?php } ?>><?php sp_get_template( 'venue-map.php', array( 'meta' => $meta ) ); ?></td>
</tr>
<?php if ( $address != null ) { ?>
<tr>
<td class="sp-event-venue-address-row"><?php echo $address; ?></td>
<tr class="sp-event-venue-address-row">
<td><?php echo $address; ?></td>
</tr>
<?php } ?>
</tbody>

View File

@@ -15,6 +15,8 @@ $defaults = array(
'columns' => null,
'highlight' => null,
'show_full_table_link' => false,
'title' => false,
'show_title' => get_option( 'sportspress_table_show_title', 'yes' ) == 'yes' ? true : false,
'show_team_logo' => get_option( 'sportspress_table_show_logos', 'yes' ) == 'yes' ? true : false,
'link_posts' => get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false,
'sortable' => get_option( 'sportspress_enable_sortable_tables', 'yes' ) == 'yes' ? true : false,
@@ -29,7 +31,13 @@ if ( ! isset( $highlight ) ) $highlight = get_post_meta( $id, 'sp_highlight', tr
$table = new SP_League_Table( $id );
$output = '<h4 class="sp-table-caption">' . get_the_title( $id ) . '</h4>';
if ( $show_title && false === $title && $id )
$title = get_the_title( $id );
$output = '';
if ( $title )
$output .= '<h4 class="sp-table-caption">' . $title . '</h4>';
$output .= '<div class="sp-table-wrapper">';
@@ -149,7 +157,7 @@ $output .= '</tbody>' . '</table>';
$output .= '</div>';
if ( $show_full_table_link )
$output .= '<a class="sp-league-table-link sp-view-all-link" href="' . get_permalink( $id ) . '">' . __( 'View full table', 'sportspress' ) . '</a>';
$output .= '<div class="sp-league-table-link sp-view-all-link"><a href="' . get_permalink( $id ) . '">' . __( 'View full table', 'sportspress' ) . '</a></div>';
?>
<div class="sp-template sp-template-league-table">

View File

@@ -12,6 +12,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
$html5 = current_theme_supports( 'html5', 'gallery' );
$defaults = array(
'id' => get_the_ID(),
'title' => false,
'number' => -1,
'grouping' => null,
'orderby' => 'default',
@@ -71,6 +72,9 @@ else:
uasort( $data, array( $list, 'sort' ) );
endif;
if ( $title )
echo '<h4 class="sp-table-caption">' . $title . '</h4>';
$gallery_style = $gallery_div = '';
if ( apply_filters( 'use_default_gallery_style', ! $html5 ) )
$gallery_style = "
@@ -156,7 +160,7 @@ echo apply_filters( 'gallery_style', $gallery_style . "\n\t\t" );
}
if ( $show_all_players_link ) {
echo '<a class="sp-player-list-link sp-view-all-link" href="' . get_permalink( $id ) . '">' . __( 'View all players', 'sportspress' ) . '</a>';
echo '<div class="sp-player-list-link sp-view-all-link"><a href="' . get_permalink( $id ) . '">' . __( 'View all players', 'sportspress' ) . '</a></div>';
}
echo "</div>\n";

View File

@@ -11,6 +11,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
$defaults = array(
'id' => get_the_ID(),
'title' => false,
'number' => -1,
'grouptag' => 'h4',
'columns' => null,
@@ -18,6 +19,7 @@ $defaults = array(
'orderby' => 'default',
'order' => 'ASC',
'show_all_players_link' => false,
'show_title' => get_option( 'sportspress_list_show_title', 'yes' ) == 'yes' ? true : false,
'show_player_photo' => get_option( 'sportspress_list_show_photos', 'yes' ) == 'yes' ? true : false,
'link_posts' => get_option( 'sportspress_link_players', 'yes' ) == 'yes' ? true : false,
'link_teams' => get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false,
@@ -66,9 +68,15 @@ else:
uasort( $data, array( $list, 'sort' ) );
endif;
$output = '';
if ( $grouping === 'position' ):
$groups = get_terms( 'sp_position', array( 'orderby' => 'slug' ) );
else:
if ( $show_title && false === $title && $id )
get_the_title( $id );
if ( $title )
$output .= '<' . $grouptag . ' class="sp-table-caption">' . $title . '</' . $grouptag . '>';
$group = new stdClass();
$group->term_id = null;
$group->name = null;
@@ -76,9 +84,10 @@ else:
$groups = array( $group );
endif;
$output = '';
foreach ( $groups as $group ):
$output .= '<div class="sp-template sp-template-player-list">';
if ( ! empty( $group->name ) ):
$output .= '<a name="group-' . $group->slug . '" id="group-' . $group->slug . '"></a>';
$output .= '<' . $grouptag . ' class="sp-table-caption player-group-name player-list-group-name">' . $group->name . '</' . $grouptag . '>';
@@ -165,11 +174,12 @@ foreach ( $groups as $group ):
endif; endforeach;
$output .= '</tbody>' . '</table>' . '</div>';
endforeach;
if ( $show_all_players_link )
$output .= '<a class="sp-player-list-link sp-view-all-link" href="' . get_permalink( $id ) . '">' . __( 'View all players', 'sportspress' ) . '</a>';
if ( $show_all_players_link ):
$output .= '<div class="sp-player-list-link sp-view-all-link"><a href="' . get_permalink( $id ) . '">' . __( 'View all players', 'sportspress' ) . '</a></div>';
endif;
$output .= '</div>';
endforeach;
?>
<div class="sp-template sp-template-player-list">
<?php echo $output; ?>
</div>
<?php echo $output; ?>