This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $teams = sports_bench_get_teams( true ); $num_teams = count( $teams ); $count = 0; | |
| foreach( $teams as $team_id => $team_name ) { | |
| $current_team = new Sports_Bench_Team( (int)$team_id ); | |
| if ( $count % 2 == 0 ) { ?> | |
| <div class="row"> | |
| <?php } ?> | |
| <div class="large-6 medium-6 small-12 columns"> | |
| <a href="<?php echo $current_team->get_permalink(); ?>"> | |
| <div class="team-info clearfix" style="border-top: 2px solid <?php echo $current_team->team_primary_color; ?>"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div class="team-photo"> | |
| <?php echo $team->get_team_photo( 'team-photo' ); ?> | |
| </div> | |
| <div class="team-name row"> | |
| <div class="large-2 medium-2 small-2 columns"> | |
| <?php echo $team->get_team_photo( 'team-logo' ); ?> | |
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div id="team-stats" class="widget" style="border-top: 2px solid <?php echo $team->team_primary_color; ?>"> | |
| <h4 class="widgettitle"><?php echo get_option( 'sports-bench-season-year' ) . ' ' . __( 'Stats', 'sports-bench' ); ?></h4> | |
| <?php echo sports_bench_get_players_stats_table( sports_bench_get_players_stats( $team->team_id, '"' . get_option( 'sports-bench-season-year' ) . '"' ) ); ?> | |
| </div> | |
| <div id="team-roster" class="widget" style="border-top: 2px solid <?php echo $team->team_primary_color; ?>"> | |
| <h4 class="widgettitle"><?php _e( 'Roster', 'sports-bench' ); ?></h4> | |
| <?php echo sports_bench_show_roster( $team->team_id ); ?> | |
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Template Name: Team | |
| */ | |
| if ( get_query_var( 'team_slug' ) ) { | |
| $team = new Sports_Bench_Team( get_query_var( 'team_slug' ) ); | |
| } | |
| get_header(); ?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public function get_goals( $season = false ) { | |
| if ( $season == false ) { | |
| $where = ''; | |
| } else { | |
| $where = ' AND game_season = "' . $season . '" '; | |
| } | |
| global $wpdb; | |
| $player_table = $wpdb->prefix . 'sb_players'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public function get_stats( $season = false ) { | |
| $stats = array( | |
| 'goals' => $this->get_goals( $season ), | |
| 'assists' => $this->get_assists( $season ), | |
| 'shots_on_goal' => $this->get_sog( $season ), | |
| 'fouls' => $this->get_gouls( $season ), | |
| ); | |
| return $stats; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public function get_red_cards( $team = 'home' ) { | |
| $game_id = $this->game_id; | |
| global $wpdb; | |
| $table = $wpdb->prefix . 'sb_games'; | |
| $querystr = "SELECT * FROM $table WHERE game_id = $game_id"; | |
| $game_info = $wpdb->get_results( $querystr ); | |
| if ( $team == 'away' ) { | |
| return $game_info[0]->game_away_red; | |
| } else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public function get_team_stats() { | |
| $game_id = $this->game_id; | |
| global $wpdb; | |
| $table = $wpdb->prefix . 'sb_games'; | |
| $querystr = "SELECT * FROM $table WHERE game_id = $game_id"; | |
| $game_info = $wpdb->get_results( $querystr ); | |
| $home_stats = array ( | |
| 'shots' => $this->get_shots( 'home' ), | |
| 'sog' => $this->get_sog( 'home' ), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| add_action( 'rest_api_init', 'theme_slug_extend_rest_post_response' ); | |
| function theme_slug_extend_rest_post_response() { | |
| register_rest_field( 'post', | |
| 'comments', | |
| array( | |
| 'get_callback' => 'theme_slug_get_comments', | |
| 'update_callback' => null, | |
| 'schema' => null, | |
| ) ); | |
| } |