Create team instance only once

This commit is contained in:
Brian Miyaji
2014-08-11 23:24:53 +10:00
parent 754b072610
commit 990de93bb2

View File

@@ -4,7 +4,7 @@
* *
* @author ThemeBoy * @author ThemeBoy
* @package SportsPress/Templates * @package SportsPress/Templates
* @version 1.1 * @version 1.3
*/ */
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -17,12 +17,13 @@ $leagues = get_the_terms( $id, 'sp_league' );
if ( ! $leagues ) if ( ! $leagues )
return false; return false;
$team = new SP_Team( $id );
$output = ''; $output = '';
// Loop through data for each league // Loop through data for each league
foreach ( $leagues as $league ): foreach ( $leagues as $league ):
$team = new SP_Team( $id );
$data = $team->columns( $league->term_id ); $data = $team->columns( $league->term_id );
if ( sizeof( $data ) <= 1 ) if ( sizeof( $data ) <= 1 )