From cacbd3c27e23cfa7441d6867b37a3f6bb92228ec Mon Sep 17 00:00:00 2001
From: Brian Miyaji
Date: Wed, 12 Feb 2014 04:30:16 +1100
Subject: [PATCH] Add player list widget and add league table widget columns
selector
---
admin/hooks/gettext.php | 2 +-
admin/hooks/the-content.php | 17 ++++-
admin/post-types/player.php | 2 +-
admin/templates/league-table.php | 52 ++++----------
admin/templates/player-list.php | 46 +++++++++++--
admin/widgets/league-table.php | 27 +++++++-
admin/widgets/player-list.php | 112 +++++++++++++++++++++++++++++++
assets/css/admin.css | 26 +++++++
functions.php | 41 +++++++++--
readme.txt | 33 +++++++--
sportspress.php | 5 +-
11 files changed, 300 insertions(+), 63 deletions(-)
create mode 100644 admin/widgets/player-list.php
diff --git a/admin/hooks/gettext.php b/admin/hooks/gettext.php
index 2263f5e5..fc1b54c3 100644
--- a/admin/hooks/gettext.php
+++ b/admin/hooks/gettext.php
@@ -21,7 +21,7 @@ function sportspress_gettext( $translated_text, $untranslated_text, $domain ) {
elseif ( in_array( $typenow, array( 'sp_event', 'sp_player', 'sp_staff' ) ) ):
switch ( $untranslated_text ):
case 'Enter title here':
- $translated_text = __( 'Name', 'sportspress' );
+ $translated_text = __( '(Auto)', 'sportspress' );
break;
case 'Set featured image':
$translated_text = sprintf( __( 'Select %s', 'sportspress' ), __( 'Photo', 'sportspress' ) );
diff --git a/admin/hooks/the-content.php b/admin/hooks/the-content.php
index abc42dc0..1e807908 100644
--- a/admin/hooks/the-content.php
+++ b/admin/hooks/the-content.php
@@ -33,9 +33,24 @@ add_filter( 'the_content', 'sportspress_default_team_content' );
function sportspress_default_table_content( $content ) {
if ( is_singular( 'sp_table' ) && in_the_loop() ):
+ $id = get_the_ID();
+ $leagues = get_the_terms( $id, 'sp_league' );
+ $seasons = get_the_terms( $id, 'sp_season' );
+ $terms = array();
+ if ( $leagues ):
+ $league = reset( $leagues );
+ $terms[] = $league->name;
+ endif;
+ if ( $seasons ):
+ $season = reset( $seasons );
+ $terms[] = $season->name;
+ endif;
+ $title = '';
+ if ( sizeof( $terms ) )
+ $title = '' . implode( ' — ', $terms ) . '
';
$table = sportspress_league_table();
$excerpt = has_excerpt() ? wpautop( get_the_excerpt() ) : '';
- $content = $table . $content . $excerpt;
+ $content = $title . $table . $content . $excerpt;
endif;
return $content;
}
diff --git a/admin/post-types/player.php b/admin/post-types/player.php
index 9865e157..8e8daa2a 100644
--- a/admin/post-types/player.php
+++ b/admin/post-types/player.php
@@ -81,8 +81,8 @@ function sportspress_player_details_meta( $post ) {