Grab the code below and save it to a file called teams-Compact.php or whatever you want to call it, changing ‘Compact’, but using the format teams-XXX.php. Then save that file to the template folder in the LeagueManager folder on your server. When you want to use it, your shortcode will look like this:
[teams league_id=2 template=Compact]
If you don’t like the space between the right side columns, you can change the width, I set them to 10%, they might be a bit too wide for your taste. The templates give you unlimited possibilities for how you can present your leagues…
<?php
/**
Template page for Team List
The following variables are usable:
$league league object
$teams: all teams of league
You can check the content of a variable when you insert the tag <?php var_dump($variable) ?>
*/
?>
<?php if (isset($_GET['team_id'])) : ?>
<?php leaguemanager_team($_GET['team_id']); ?>
<?php else : ?>
<?php if ( $teams ) : ?>
<table class="leaguemanager teamslist" summary="" title="<?php _e( 'Teams', 'leaguemanager' ) ?>">
<thead>
<tr>
<th width="70%" style="text-align: left;"><?php _e( 'Team', 'leaguemanager' ) ?></th>
<th width="10%" style="text-align: center;"><?php echo _c( 'W|Won', 'leaguemanager' ) ?></th>
<th width="10%" style="text-align: center;"><?php echo _c( 'T|Tie', 'leaguemanager' ) ?></th>
<th width="10%" style="text-align: center;"><?php echo _c( 'L|Lost', 'leaguemanager' ) ?></th>
</tr>
</thead>
<tbody id="the-list">
<?php foreach ( $teams AS $team ) : $class = ('alternate' == $class) ? '' : 'alternate'; ?>
<?php $url = add_query_arg('team_id', $team->id, get_permalink()); ?>
<tr class="<?php echo $class ?>">
<td style="text-align: left;"><a href="<?php echo $url; ?>"><?php echo $team->title ?></a></td>
<td style="text-align: center;"><?php echo $team->won_matches ?></td>
<td style="text-align: center;"><?php echo $team->draw_matches ?></td>
<td style="text-align: center;"><?php echo $team->lost_matches ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php endif; ?>
<?php endif; ?>