Enable linking player lists to teams

This commit is contained in:
Brian Miyaji
2014-06-20 11:42:19 +10:00
parent d49f1c6c13
commit c3d86d3de8
11 changed files with 245 additions and 15 deletions

View File

@@ -4,7 +4,7 @@
*
* @author ThemeBoy
* @package SportsPress/Templates
* @version 0.9.4
* @version 1.1
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -18,6 +18,7 @@ $defaults = array(
'itemtag' => 'dl',
'icontag' => 'dt',
'captiontag' => 'dd',
'grouptag' => 'h4',
'columns' => 3,
'size' => 'thumbnail',
'show_all_players_link' => false,
@@ -110,7 +111,7 @@ foreach ( $groups as $group ):
if ( ! empty( $group->name ) ):
echo '<a name="group-' . $group->slug . '" id="group-' . $group->slug . '"></a>';
echo '<h3 class="player-group-name player-gallery-group-name">' . $group->name . '</h3>';
echo '<' . $grouptag . ' class="player-group-name player-gallery-group-name">' . $group->name . '</' . $grouptag . '>';
endif;
foreach( $data as $player_id => $performance ): if ( empty( $group->term_id ) || has_term( $group->term_id, 'sp_position', $player_id ) ):

View File

@@ -4,7 +4,7 @@
*
* @author ThemeBoy
* @package SportsPress/Templates
* @version 0.8
* @version 1.1
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -12,6 +12,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
$defaults = array(
'id' => get_the_ID(),
'number' => -1,
'grouptag' => 'h4',
'columns' => null,
'grouping' => null,
'orderby' => 'default',
@@ -76,7 +77,7 @@ $output = '';
foreach ( $groups as $group ):
if ( ! empty( $group->name ) ):
$output .= '<a name="group-' . $group->slug . '" id="group-' . $group->slug . '"></a>';
$output .= '<h3 class="sp-table-caption player-group-name player-list-group-name">' . $group->name . '</h3>';
$output .= '<' . $grouptag . ' class="sp-table-caption player-group-name player-list-group-name">' . $group->name . '</' . $grouptag . '>';
endif;
$output .= '<div class="sp-table-wrapper sp-scrollable-table-wrapper">' .

View File

@@ -4,7 +4,7 @@
*
* @author ThemeBoy
* @package SportsPress/Templates
* @version 0.8
* @version 1.1
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -23,7 +23,7 @@ $output = '';
foreach ( $leagues as $league ):
$team = new SP_Team( $id );
$data = $team->data( $league->term_id );
$data = $team->columns( $league->term_id );
if ( sizeof( $data ) <= 1 )
continue;

32
templates/team-lists.php Normal file
View File

@@ -0,0 +1,32 @@
<?php
/**
* Team Player Lists
*
* @author ThemeBoy
* @package SportsPress/Templates
* @version 1.1
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
if ( ! isset( $id ) )
$id = get_the_ID();
$team = new SP_Team( $id );
$lists = $team->lists();
foreach ( $lists as $list ):
$id = $list->ID;
if ( $id && sizeof( $lists ) > 1 ):
?>
<h4 class="sp-table-caption"><?php echo $list->post_title; ?></h4>
<?php
endif;
$format = get_post_meta( $id, 'sp_format', true );
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 ) );
endforeach;