From f7742a69cd7885e2c8f8ffeb9865cec120388dbe Mon Sep 17 00:00:00 2001 From: Brian Miyaji Date: Fri, 17 Jul 2015 15:32:29 +1000 Subject: [PATCH] Add table heading option to widgets --- .../widgets/class-sp-widget-countdown.php | 12 ++++-- .../widgets/class-sp-widget-event-blocks.php | 12 ++++-- .../class-sp-widget-event-calendar.php | 2 +- .../widgets/class-sp-widget-event-list.php | 12 ++++-- .../widgets/class-sp-widget-league-table.php | 12 ++++-- .../class-sp-widget-player-gallery.php | 12 ++++-- .../widgets/class-sp-widget-player-list.php | 12 ++++-- includes/widgets/class-sp-widget-staff.php | 4 +- templates/countdown.php | 4 ++ templates/event-blocks.php | 21 +++++----- templates/event-calendar.php | 2 +- templates/event-list.php | 11 ++++-- templates/event-logos.php | 39 +++++++++++++++++-- templates/event-performance.php | 12 +++++- templates/event-venue.php | 4 +- templates/league-table.php | 12 +++++- templates/player-gallery.php | 6 ++- templates/player-list.php | 26 +++++++++---- 18 files changed, 162 insertions(+), 53 deletions(-) diff --git a/includes/widgets/class-sp-widget-countdown.php b/includes/widgets/class-sp-widget-countdown.php index 68541828..8207f288 100644 --- a/includes/widgets/class-sp-widget-countdown.php +++ b/includes/widgets/class-sp-widget-countdown.php @@ -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 {

+

+

+

'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 {

+

+

+

'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); } diff --git a/includes/widgets/class-sp-widget-event-list.php b/includes/widgets/class-sp-widget-event-list.php index 4f530825..63834581 100644 --- a/includes/widgets/class-sp-widget-event-list.php +++ b/includes/widgets/class-sp-widget-event-list.php @@ -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 {

+

+

+

'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 {

+

+

+

'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 {

+

+

+

'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 {

+

+

+

'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 '

' . get_the_title( $id ) . '

'; + sp_get_template( 'staff-photo.php', array( 'id' => $id ) ); sp_get_template( 'staff-details.php', array( 'id' => $id ) ); diff --git a/templates/countdown.php b/templates/countdown.php index 42c84d09..db5912d5 100644 --- a/templates/countdown.php +++ b/templates/countdown.php @@ -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 '

' . $title . '

'; + $title = $post->post_title; if ( $link_events ) $title = '' . $title . ''; ?> diff --git a/templates/event-blocks.php b/templates/event-blocks.php index 5d324090..7e34422e 100644 --- a/templates/event-blocks.php +++ b/templates/event-blocks.php @@ -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 '

' . get_the_title( $id ) . '

'; -} +if ( $title ) + echo '

' . $title . '

'; ?>
@@ -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 = ''; + $logo = ''; 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 ) { - -
- -
- +
-', sp_get_main_results_or_time( $event ) ); ?>
name; ?>
@@ -139,6 +140,6 @@ if ( $show_title && $id ) {
' . __( 'View all events', 'sportspress' ) . ''; + echo ''; ?>
\ No newline at end of file diff --git a/templates/event-calendar.php b/templates/event-calendar.php index 11a1e898..288e0d46 100644 --- a/templates/event-calendar.php +++ b/templates/event-calendar.php @@ -217,7 +217,7 @@ if ( $pad != 0 && $pad != 7 ) $calendar_output .= "\n\t\n\t\n\t\n\t"; if ( $id && $show_all_events_link ) - $calendar_output .= '' . __( 'View all events', 'sportspress' ) . ''; + $calendar_output .= ''; ?>
diff --git a/templates/event-list.php b/templates/event-list.php index d57a0767..d475cdf0 100644 --- a/templates/event-list.php +++ b/templates/event-list.php @@ -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 '

' . get_the_title( $id ) . '

'; -} +if ( $show_title && false === $title && $id ) + $title = get_the_title( $id ); + +if ( $title ) + echo '

' . $title . '

'; ?>
@@ -359,6 +362,6 @@ if ( $show_title && $id ) {
' . __( 'View all events', 'sportspress' ) . ''; + echo ''; ?>
\ No newline at end of file diff --git a/templates/event-logos.php b/templates/event-logos.php index 51a6b9f1..5b795afd 100644 --- a/templates/event-logos.php +++ b/templates/event-logos.php @@ -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 .= ' ' . get_the_title( $team ) . ''; + } else { + $logo = '' . get_the_title( $team ) . ' ' . $logo; + } + } + + // Add link if ( get_option( 'sportspress_link_teams', 'no' ) == 'yes' ) $logo = '' . $logo . ''; - $team_logos[] = $logo; + + // Add result + if ( $show_results ) { + if ( $i % 2 ) { + $logo = '' . array_shift( $results ) . ' ' . $logo; + } else { + $logo .= ' ' . array_shift( $results ) . ''; + } + } + + $team_logos[] = ''; + $i++; endforeach; $team_logos = array_filter( $team_logos ); if ( ! empty( $team_logos ) ): - echo '
'; + echo '
'; $delimiter = get_option( 'sportspress_event_teams_delimiter', 'vs' ); echo implode( ' ' . $delimiter . ' ', $team_logos ); - echo '
'; + echo '
'; endif; endif; \ No newline at end of file diff --git a/templates/event-performance.php b/templates/event-performance.php index d0722da6..52ba7847 100644 --- a/templates/event-performance.php +++ b/templates/event-performance.php @@ -28,6 +28,9 @@ if ( ! isset( $id ) ) $teams = get_post_meta( $id, 'sp_team', false ); if ( is_array( $teams ) ): + ?> +
+ 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' ); + ?> +
+ colspan="2"> $meta ) ); ?> - - + + diff --git a/templates/league-table.php b/templates/league-table.php index 1e646b1b..460c8e4e 100644 --- a/templates/league-table.php +++ b/templates/league-table.php @@ -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 = '

' . get_the_title( $id ) . '

'; +if ( $show_title && false === $title && $id ) + $title = get_the_title( $id ); + +$output = ''; + +if ( $title ) + $output .= '

' . $title . '

'; $output .= '
'; @@ -149,7 +157,7 @@ $output .= '' . ''; $output .= '
'; if ( $show_full_table_link ) - $output .= '' . __( 'View full table', 'sportspress' ) . ''; + $output .= ''; ?>
diff --git a/templates/player-gallery.php b/templates/player-gallery.php index 38d938ea..fdb51da3 100644 --- a/templates/player-gallery.php +++ b/templates/player-gallery.php @@ -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 '

' . $title . '

'; + $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 '' . __( 'View all players', 'sportspress' ) . ''; + echo ''; } echo "
\n"; diff --git a/templates/player-list.php b/templates/player-list.php index d92ddc59..9fda51eb 100644 --- a/templates/player-list.php +++ b/templates/player-list.php @@ -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 . ''; $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 .= '
'; + if ( ! empty( $group->name ) ): $output .= ''; $output .= '<' . $grouptag . ' class="sp-table-caption player-group-name player-list-group-name">' . $group->name . ''; @@ -165,11 +174,12 @@ foreach ( $groups as $group ): endif; endforeach; $output .= '' . '' . '
'; -endforeach; -if ( $show_all_players_link ) - $output .= '' . __( 'View all players', 'sportspress' ) . ''; + if ( $show_all_players_link ): + $output .= ''; + endif; + + $output .= '
'; +endforeach; ?> -
- -
\ No newline at end of file + \ No newline at end of file