Sports Bench comes in two parts — a plugin and a theme. Both the plugin and theme work on their own; however, it’s suggested that you use both to get the most out of both products.

Plugin

Creating and keeping up with sports league stats on the internet can be a hassle. Fortunately, the Sports Bench plugin takes all of the hard work away from you. After a simple five-minute (or less) setup, you’re ready to start entering teams, players, games and even division and then watch the plugin do all of the other stuff for you. Sports Bench takes care of accumulating the stats you enter as well as the standings and schedules.

The plugin has the ability to display the standings, a scoreboard of all game for the current season and statistical leaderboards. Show off game stats next to a recap of a game. Easily create pages for teams and players. And shortcodes allow you to show game, player or team information in any post. And if you use the theme, all of this comes with minimal front-end coding work for you. You have enough to worry about with managing your sports league; let us take care of the hard part.

Theme

The Sports Bench theme is the perfect way to use the Sports Bench plugin out of the box with no need to add any code to make the core functionality work. The Sports Bench theme includes page templates for the standings, scoreboard, stats leaderboards, teams and players. It also includes the scoreboard bar, a featured post slideshow, infinite scrolling posts on the homepage and implements the longform post feature included in the Sports Bench plugin.

Sports Supported:

  • Baseball
  • Basketball
  • Football
  • Hockey
  • Soccer

Details

Requires at least: 4.7
Tested up to: 4.8.1
Stable tag: 1.2.3

Features

Team Page

Plugin

Sports Bench makes it easy for you to have a centralized location for each team in the league with team pages. If you’re using the Sports Bench theme, this requires no setup. But even if you’re not, our functions and guides will have you setup with a team page template that will match your theme in no time.

Player Page

Plugin

This plugin also makes it easy for you to have a centralized location for each player in the league with player pages. If you’re using the Sports Bench theme, this requires no setup. But even if you’re not, our functions and guides will have you setup with a player page template that will match your theme in no time.

Playoffs

Plugin

You can now easily create playoff brackets to show who your league’s champion is. Create a 2, 4, 6, 8, 12, 16, 32 or 64 team single elimination bracket or a four-team double elimination bracket. And the front end display is easy. Just select the playoff shortcode, select the bracket and watch it do its work. The display is written to work with any size screen, so all of your readers will be able to see who the true champion is.

Divisions

Plugin

Sports Bench makes it easy to organize teams via conferences and/or divisions. Simply add the division or conference and then sort the teams into them.

Standings

Plugin

Show where teams are in the standings with ease. The plugin keeps track of the standings with minimal need for user input. You can show league, conference or division standings, whichever works for you.

Scoreboard

Plugin

Display upcoming, current or completed games with an easy-to-use scoreboard. You can create a separate scoreboard page with only the need to call one function, or you can add a scoreboard bar to the top of your header.

Stats Leaderboard

Plugin

Show who’s the best in different statistical categories with Sports Bench’s stats leaderboard. Simply select which stats you wish to show and they’ll show up on the page. The stats show the top ten players, but users can load more for each stat with a simple click.

Game Recaps

Plugin

Show off stats from a game in a nice sidebar area to go along with a post. It’s perfect for a game recap, where the text or even video recap can be in the main area with the stats off to the side. The recap stats are made to be used with any sidebar to match the theme you are using.

Widgets

Plugin

Sports Bench comes with three ready-to-go widgets to display in the sidebar. You can display standings, the scoreboard and the leaderboard for a stat in the sidebar. The widgets are also created to blend with you sidebar to match the theme.

Shortcodes

Plugin

The plugin also comes with three different shortcodes that you can use to display information in a post. In the post editor, click the ‘SB’ logo to open up a modal where you can select between a game, team or player shortcode to display information to add to your posts.

WP REST API Integration

Plugin

JavaScript frameworks and the WP REST API are the hot thing in web development. If you’re creating a site that uses the REST API and any of the popular frameworks, Sports Bench has the tools to help you.

Sports Bench Plugin Integration

Theme

The Sports Bench theme is designed and coded with the Sports Bench plugin in mind. While the theme works on its own like any other WordPress theme, it works best with the plugin. This is perfect for users with no coding experience as everything has already been taken care of. Simply activate the theme and plugin, setup the plugin options and you’re on your way.

Homepage Slider

Theme

Show off your best or most important stories with the featured post slider on the homepage. Simply select a category in the theme options and add posts to that category to see them displayed in the full-width slider. You can control how many posts are shown on the slider. The preferred image ratio is 2.56:1, with a relatively large image so that it stretches across the page.

Customizable Homepage

Theme

Readers won’t have to go very far to find your stories when they come to your website. In addition to showing your latest posts, you can also add tabs for selected categories so readers can peruse them without leaving the homepage.

Infinite Scroll

Theme

Your readers won’t have to worry about the hassle of navigating through pages of posts to find their favorite stories thanks to infinite scroll. Readers will just have to keep scrolling down in order to load more posts rather than wait for a new page to load, saving them time and frustration. This works on the home and archive pages.

Custom Header

Theme

Add your personal branding to the website with a custom logo. The logo displays on the left side of the top menu. The suggested size for the header is 200px by 40px.

Site Logo

Theme

In addition to the site header, you can also add branding with a custom site logo. The logo will appear down in the footer and can also be added into templates wherever you need it. WordPress advises that the site logo be 512px by 512px.

Social Media Links

Theme

Show off links to your social media sites in the header with ease. Simply enter the URL for the desired social media platform in the theme options and the image and links will automatically appear in the header.

Longform Template

Theme

Have a special story that you want to tell in a special way? Sports Bench makes that easy with the longform feature. Select the longform post template in the “Post Attributes” section of the post editor to see your story displayed in a unique way.

How To's

Installation

Plugin

Via WordPress Dashboard
  1. If you purchased the plugin/theme package, unzip the “sports-bench” directory that comes with the download. If you purchased the plugin only, ignore this step.
  2. In the WordPress admin area, go to Plugins->Add New. Then hit “Upload Plugin” at the top of the subsequent page.
  3. Select the zipped plugin directory (i.e. sports-bench-1.0.zip) and hit “Install Now”.
  4. After the plugin is installed, click “Activate” to start using the theme.
  5. Go to the “Setup” section of this ReadMe file to get the plugin rolling for your use.
VIia FTP Upload
  1. If you purchased the plugin/theme package, unzip the “sports-bench” directory that comes with the download. If you purchased the plugin only, ignore this step.
  2. Unzip the zipped plugin directory (i.e. sports-bench-1.0.zip).
  3. Upload the sports-bench directory inside the now-unzipped directory to the plugin directory on your site (located inside of the wp-content directory).
  4. In the WordPress admin area, go to the Plugins page and hit “Activate” underneath the Sports Bench listing on the page to begin using the theme.
  5. Go to the “Setup” section of this ReadMe file to get the plugin rolling for your use.

Theme

Via WordPress Dashboard
  1. If you purchased the plugin/theme package, unzip the “sports-bench” directory that comes with the download. If you purchased the theme only, ignore this step.
  2. In the WordPress admin area, go to Appearance->Themes. Click the “Add New” button at the top of the page and then hit “Upload Theme” at the top of the subsequent page.
  3. Select the zipped theme directory (i.e. sports-bench-1.0.zip) and hit Install now.
  4. After the theme is installed, click “Activate” to start using the theme.
Via FTP Upload
  1. If you purchased the plugin/theme package, unzip the “sports-bench” directory that comes with the download. If you purchased the theme only, ignore this step.
  2. Unzip the zipped theme directory (i.e. sports-bench-1.0.zip).
  3. Upload the sports-bench directory inside the now-unzipped directory to the themes directory on your site (located inside of the wp-content directory).
  4. In the WordPress admin area, go to Appearance->Theme and hit “Activate” underneath the Sports Bench listing on the page to begin using the theme.

Creating a Division

Before creating teams or players, it’s highly suggested that you create your conferences and divisions first to sort your teams into. Here’s how:

  1. Navigate to the division page in the WordPress admin. To reach the page, hover over “Teams” in the left menu and select “Divisions”.
  2. Fill out the form on the left half of the page.
  3. The second item in the form asks you whether the item you are adding is a conference or division. It’s highly suggested that you create conferences first before divisions, if you have any.
  4. If the item is a conference, the last item asks you to pick a color for the conference. This color is typically the bottom border for the conference and its divisions in the standings area.
  5. If the item is a division, the last item asks you to select a parent conference to place the division.

Now you’re ready to start adding teams.

Creating a Team

  1. Navigate to the ‘Add Team’ page. To reach the page, hover over “Teams” in the left menu and select “Add New”.
  2. Enter the full team name at the top as you would a post or page title.
  3. The first form item asks you to enter in the team location. This is not necessarily the city and state the team plays in. This is the first part of the team name (i.e. Texas Rangers, New York Yankees). If the team has no formal nickname (i.e. FC Dallas, Real Salt Lake), re-enter the full team name here and skip the nickname.
  4. The next seven form items are simply what the label says they are.
  5. When you get to the division item, simply select the division or conference the team is in.
  6. The next two items ask you to enter in the team’s primary and secondary colors. Clicking on “Select Color” will open up a color picker to help you select the necessary color.
  7. The logo item is where you can upload a team’s logo.
  8. The photo item is where you can upload a team’s photo. This is not the same as the team logo. The team photo is mainly used on the team page and is bigger. It’s highly suggested that this photo is a team photo with all of the players if you wish.
  9. Hit save in the upper right side of the page and you’ve created a team.

Creating a Player

  1. Navigate to the ‘Add Player’ page. To reach the page, hover over “Players” in the left menu and select “Add New”.
  2. Fill out the items on the form as their labels indicate.
  3. For birthday, do not worry about the time element of the field.
  4. For position, if the sport is soccer and you’re entering a keeper, enter ‘Goalkeeper’. If it’s hockey and you’re entering in a goalie, enter ‘Goalie’.
  5. For height, enter feet and inches as XX’ XX”.
  6. The photo item is where you can upload a photo of the player, preferably a head shot.
  7. Hit save in the upper right side of the page and you’ve created a player.

Creating a Game

  1. Navigate to the ‘Add Game’ page. To reach the page, hover over “Games” in the left menu and select “Add New”.
  2. Enter in the basic game information.
    • If your games are not sorted by week, leave this field blank.
    • Make sure you format the season field how you’ve formatted it in the plugin options.
    • Both an away and home team must be set in order to save the game.
    • Pick whether the game is scheduled, in progress or completed. This determines how the game is displayed on the front end, and if “in progress” is picked, a section to show where the progress of the game will appear below.
  3. If you are adding a scheduled game, hit save to save the game. You can come back during the game to update it live or after the game is over to add in the other stats. Otherwise, continue with the next steps.
  4. If the sport used in baseball, enter in the final score, number of hits, errors and men left on base for each team in the next section. Otherwise, enter in the scoring by half, period or quarter for each team. The final score will automatically be calculated.
  5. If the sport being used is not basketball, enter in the scoring plays and/or disciplinary actions here. Click “Add Event” to add a new event and “Remove Event” to remove one.
  6. Enter in the team stats. If the sport used is baseball, the “doubles”, “triples” and “home runs” fields are text field to enter the players who hit them.
  7. Enter in the individual stats for the away team. “Add Player” will add a player while “Remove Player” will remove a player.
  8. Enter in the individual stats for the home team. “Add Player” will add a player while “Remove Player” will remove a player.
  9. Hit save in the upper right side of the page to save the game with the stats.

Creating a Playoff Bracket

  1. Navigate to the ‘Add Playoff Bracket’ page. To reach the page, hover over “Playoffs” in the left menu and select “Add New”.
  2. Add a title for the bracket and select the number of teams, the format for the backet and the season. Then hit “Create Bracket”.
    • You can create a 2, 4, 6, 8, 12, 16, 32 or 64 team single elimination bracket or a four team double elimination bracket.
  3. Fill in the teams as much as you want. Playoff series without teams will remain in their spot no matter what.
  4. For each series, select the format of the series. It can be a single game, two games (like in soccer), best of three, best of five or best of seven.
  5. For each game of the series, select the corresponding game in the database, if there is one, via the dropdown.
  6. Once you’re done, hit save.
  7. To show the playoff bracket on the front end, add or edit a post or a page. Once there, hit the “SB” in the TinyMCE editor, select “Playoff Bracket” and then select the bracket you want. Then hit update or publish. That’s it!

Setting Up the Standings Page Template

Sports Bench features an easy way to show the standings. The theme requires no code work from you to setup. If you are using the Sports Bench theme, skip to item three. Otherwise, the first two steps show you how to create the standings page.

  1. In your theme directory, create a new page template. The easy way to do this is to copy either an existing custom page template from the theme or the theme’s page template. Make sure the <?php //* Template Name: Standings ?> is at the top of the file.
  2. Replace where the_content() is displayed with: <?php if ( function_exists( 'standings_page_template' ) ) { echo standings_page_template(); ) } ?>
    • This protects the page from errors if the Sports Bench plugin is ever deactivated or removed.
  3. In the WordPress admin, add a new page.
  4. In the page editor, select the “Standings” page template in the bottom right.
  5. The normal WYSIWYG editor will be replaced a with a few options.
  6. You can first select what type of standings can be shown: the entire league, conferences or divisions.
  7. Below that, you can select what type of items you want shown for each team, such as home and away records, division records, conference records, points/runs/goals scored or given up and point/run/goal differential.
  8. Hit “Publish” in the upper right and then view the page to view the standings.

Setting Up the Scoreboard Page Template

Sports Bench features an easy way to show the scoreboard. The theme requires no code work from you to setup. If you are using the Sports Bench theme, skip to item three. Otherwise, the first two steps show you how to create the scoreboard page.

  1. In your theme directory, create a new page template. The easy way to do this is to copy either an existing custom page template from the theme or the theme’s page template. Make sure the <?php //* Template Name: Scoreboard ?> is at the top of the file.
  2. Replace where the_content() is displayed with: <?php if ( function_exists( 'scoreboard_page_template' ) ) { echo scoreboard_page_template(); } ?>
    • This protects the page from errors if the Sports Bench plugin is ever deactivated or removed.
  3. In the WordPress admin, add a new page.
  4. In the page editor, select the “Scoreboard” page template in the bottom right.
  5. Hit “Publish” in the upper right and then view the page to view the scoreboard.

Setting Up the Stats Page Template

Sports Bench features an easy way to show the stats. The theme requires no code work from you to setup. If you are using the Sports Bench theme, skip to item three. Otherwise, the first two steps show you how to create the stats page.

  1. In your theme directory, create a new page template. The easy way to do this is to copy either an existing custom page template from the theme or the theme’s page template. Make sure the <?php //* Template Name: Stats ?> is at the top of the file.
  2. Replace where the_content() is displayed with: <?php if ( function_exists( 'stats_page_template' ) ) { echo stats_page_template(); } ?>
    • This protects the page from errors if the Sports Bench plugin is ever deactivated or removed.
  3. In the WordPress admin, add a new page.
  4. In the page editor, select the “Stats” page template in the bottom right.
  5. The normal WYSIWYG editor will be replaced a section to add and remove stats that you wish to show on the stats page.
  6. Hit “Publish” in the upper right and then view the page to view the stats page.

Setting Up the Teams Page Template

Sports Bench features an easy way to show the teams. The theme requires no code work from you to setup. If you are using the Sports Bench theme, skip to item seven. Otherwise, the first six steps show you how to create the teams page.

The teams page requires a little bit more work to get going. It’s advised that only people who know what they are doing try to create the team page. This is why it’s recommended to use the Sports Bench theme.

  1. In your theme directory, create a new page template. The easy way to do this is to copy either an existing custom page template from the theme or the theme’s page template. Make sure the <?php //* Template Name: Teams ?> is at the top of the file.
  2. Remove the the_content() function from page template.
  3. Add the following PHP information below the template name.
    • <?php if ( get_query_var( 'team_slug' ) ) {
      $team = new Team( get_query_var( 'team_slug' ) );
      } ?>
    • This grabs the team slug and creates a new instance of the team class with the information of that team. This will be needed to grab the team logo, name, id and other information.
  4. Where the content function was, add in the following code:
    • <?php if ( function_exists( 'get_teams' ) ) {
      //* Place code to show team stuff here
      } else {
      echo '<p>' . __( 'Please install and/or activate the Sports Bench plugin to use the teams page template', 'sports-bench' ) . '</p>';
      } ?>
    • This protects the page if the plugin is ever deactivated or removed.
  5. Inside the first if statement in the code above, place the following code:
    • <?php if ( isset( $team ) ) {
      //* Place team display functions here
      } else {
      echo show_team_listing();
      }?>
    • This checks to see if the team variable is set. If it’s not, it will display the teams with links to their team pages. If it is, the team will be displayed.
  6. You can place all of the functions to show team information
    • Here are the available functions you can use to display team information. More details on what these functions do can be found in the codex section.
      • get_players_stats_table( get_players_stats( $team_id, $season ) )
      • show_roster( $team_id )
      • show_team_schedule( $team_id )
      • team_division_standings( $division_id )
        • This function requires the following SQL query in order to work
          • <?php global $wpdb;
            $table = $wpdb->prefix . 'divisions';
            $querystr = "SELECT * FROM $table WHERE division_id = $team->team_division;";
            $division = $wpdb->get_results($querystr);
            $division_title = $division[ 0 ]->division_name . ' ' . __( 'Standings', 'sports-bench' ); ?>
      • show_team_info( $team_id )
  7. In the WordPress admin, add a new page.
  8. In the page editor, select the “Team” page template in the bottom right.
  9. Hit “Publish” in the upper right and then view the page to view the team.

Setting Up the Players Page Template

Sports Bench features an easy way to show the teams. The theme requires no code work from you to setup. If you are using the Sports Bench theme, skip to item seven. Otherwise, the first six steps show you how to create the players page.

The players page requires a little bit more work to get going. It’s advised that only people who know what they are doing try to create the team page. This is why it’s recommended to use the Sports Bench theme.

  1. In your theme directory, create a new page template. The easy way to do this is to copy either an existing custom page template from the theme or the theme’s page template. Make sure the <?php //* Template Name: Player ?> is at the top of the file.
  2. Remove the the_content() function from page template.
  3. Add the following PHP information below the template name.
    • <?phpif ( get_query_var( 'player_slug' ) ) {
      $player = new Player(get_query_var('player_slug'));
      $team = new Team((int)$player->team_id);
      }?>

      • This grabs the player slug and creates a new instance of the player class with the information of that player. This will be needed to grab the player name, id and other information.
  4. Where the content function was, add in the following code:
    • <php if ( class_exists( 'player' ) ) {
      //* Place code to show player stuff here
      } else {
      echo '<p>' . __( 'Please install and/or activate the Sports Bench plugin to use the player page template', 'sports-bench' ) . '</p>';
      }?>

      • This protects the page if the plugin is ever deactivated or removed.
  5. Inside the first if statement in the code above, place the following code:
    • <?php if ( isset( get_query_var( 'player_slug' ) ) ) {
      //* Place player display functions here
      } else {
      echo show_team_player_select();
      } ?>

      • This checks to see if the player variable is set. If it’s not, it will display the players with links to their team pages. If it is, the player will be displayed.
  6. You can place all of the functions to show player information
    • Here are the available functions you can use to display player information. More details on what these functions do can be found in the codex section.
      • show_player_info( $player_id )
      • get_season_stats( $player_id )
  7. In the WordPress admin, add a new page.
  8. In the page editor, select the “Player” page template in the bottom right.
  9. Hit “Publish” in the upper right and then view the page to view the player.

Adding Game Recaps and Previews

Sports Bench features an easy way to show game stats/recaps and previews. The theme requires no code work from you to setup. If you are using the Sports Bench theme, skip to item seven. Otherwise, the first six steps show you how to create the recap/preview area.

The game recaps and previews feature requires a little bit more work to get going. It’s advised that only people who know what they are doing try to add in the game recaps and preview. This is why it’s recommended to use the Sports Bench theme.

  1. The game preview works best if it’s within the sidebar, so for this one you’ll want to add this inside the sidebar wrapper for your theme. It will likely be inside the sidebar.php file.
  2. Place the following code for the preview inside the sidebar wrapper:
    • <?php if ( function_exists( 'show_game_preview_info' ) and get_post_meta( get_the_ID(), 'sports_bench_game_preview_recap', true ) == 'preview' and get_post_meta( get_the_ID(), 'sports_bench_game', true ) ) {
      echo show_game_preview_info();
      } ?>
  3. The game recap works best if it replaces the sidebar on the single post. In the single.php file, replace `get_sidebar()` with the following:
    • <?php if ( function_exists( 'show_game_stats_info' ) and get_post_meta( get_the_ID(), 'sports_bench_game_preview_recap', true ) == 'recap' and get_post_meta( get_the_ID(), 'sports_bench_game', true ) ) {
                              echo '<div id="{{sidebar_id}}" class="{{sidebar_classes}}" role="complementary">';
                                  echo show_game_stats_info(); ?>
                              echo '</div>';
                          } else {
                              get_sidebar(); ?>
                          } ?>
      • Replace the {{sidebar_id}} and {{sidebar_classes}} with the actual sidebar id and classes.
  4. To add a game recap or preview to a post, edit any post and go to the “Sports Bench Information” section.
  5. Select whether this is a preview or recap and select a game. Then hit save.

Customizations

It is possible to make customization, both in the code in style. The recommended way is to make your own customization plugin so that your changes aren’t overwritten by an update. Here’s how to do that:

  1. Find the plugins directory on your web hosting and create a new directory inside of it. Call the new file ‘sports-bench-customizations’.
  2. Inside of the new directory, create a php file name sports-bench-customizations.php.
  3. Inside of the file, paste the following at the top:
    • <?php
                         /*
                         Plugin Name: Sports Bench Customizations
                         Plugin URI:
                         Description: A place to put customizations for the Sports Bench plugin
                         Version:     1.0
                         Author:
                         Author URI:
                         License:     GPL3
                         License URI: https://www.gnu.org/licenses/gpl-3.0.html
                         */
                         ?>
  4. Inside of this directory, you can include JavaScript, CSS, and other items and then call them from the php file. You can also create custom functions as well.
  5. Make sure to activate the plugin as you would any other plugin.

Setting Up the Homepage

Setting up the homepage to run as it should is a fairly quick process.

  1. Navigate to the “Customize” page in the admin. Then click “Theme Settings”.
  2. Determine if you want to hide sticky posts in the slider and home page.
  3. Determine the category to show in the slider. The suggested practice is to create a “top story” category and use that.
  4. Determine the categories to show below the slider. Each category will show up as a tab, as well as a tab with all of the latest posts.

That’s it. The theme is all set up to run as you like.

Creating a Longform Post

Creating a longform story is simple with WordPress 4.7 and the Sports Bench theme; however, for this to work, you must be using WordPress 4.7.

  • Create a post like you normally would. Typically, longform stories are over 1,000 words long, but any length will do for you.
  • Before hitting publish, scroll down to the “Post Attributes” box in the right sidebar of the page and select “Longform”.
  • Make sure you upload a large featured image as it will display across the top of the page.

Codex

Already have the plugin? Want to know how to do cool and different stuff with it? Click the button below to explore the Codex section to customize your copy of the plugin.

Classes

Sports Bench comes with three classes that do the heavy lifting: games, players and teams. Below you’ll find all of the attributes and functions each class comes with.

Games

Class Attributes

  • game_id – int, public, the id of the game
  • game_week – int, public, the week of the game
  • game_season – string, public, the season the game is in
  • game_day – string, public, the date of the game
  • game_home_id – int, public, the id of home team
  • game_home_final – int, public, the final score for the home team
  • game_away_id – int, public, the id of the away team
  • game_away_final – int, public, the final score for the away team
  • game_attendance – int, public, the attendance of the game
  • game_preview_link – string, public, the link to the preview of the game
  • game_recap_link – string, public, the link to the recap of the game
  • game_status – string, public, the current status of the game
  • game_current_time – string, public, the current time in the game
  • game_current_period – string, public, the current period/quarter/inning the game is currently in
  • game_current_home_score – string, public, the current score for the home team
  • game_current_away_score – string, public, the current score for the away team

Constructor – Sports_Bench_Game( $game_id )

  • Takes the id of the game you give it and populates the attributes based on that game’s information.

Players

Class Attributes

  • player_id** – int, public, the id of the player
  • player_first_name** – string, public, the player’s first name
  • player_last_name** – string, public, the player’s last name
  • player_photo** – string, public, the url to the player’s photo
  • player_position** – string, public, the position the player plays
  • player_home_city** – string, public, the player’s hometown
  • player_home_state** – string, public, the player’s home state
  • player_date_of_birth** – string, public, the player’s date of birth
  • team_id** – int, public, the team id for the team the player currently plays for
  • player_weight** – int, public, the weight of the player
  • player_height** – string, public, the height of the player
  • player_slug** – string, public, the slug for the player for url purposes

Constructor – Sports_Bench_Player( $player_id )

  • Takes the id or slug of the player you give it and populates the attributes based on that player’s information.

Function – get_age()

  • Public
  • Returns the current age of the player as an integer

Function get_teams_played_for()

  • Public
  • Returns an array of ids of teams that the player has played for

Function get_seasons_played()

  • Public
  • Returns the number of seasons the player has played as an integer

Function get_permalink()

  • Public
  • Returns the URL to the player’s page as a string
  • The returned string does not include the a tag
  • Place the call to this function inside the href attribute of the a tag

Function get_player_photo()

  • Public
  • Returns the img tag with source to the player’s photo for display

Teams

Class Attributes

  • team_id** – int, public, the id of the team
  • team_name** – string, public, the team’s name
  • team_location** – string, public, the location of the team
    • This is not necessarily the city the team plays in, but the state or city at the start of the team name (i.e. **Texas** Rangers, **Chicago** Cubs).
    • If the team does not have a formal nickname, like FC Dallas or Real Salt Lake, put the entire team name here as well.
  • team_nickname** – string, public, the team’s nickname
  • team_abbreviation** – string, public, the team’s abbreviation
  • team_city** – string, public, the city the team plays in
  • team_state** – string, public, the state the team plays in
  • team_stadium** – string, public, the stadium the team plays in
  • team_stadium_capacity** – int, public, the capacity of the team’s stadium
  • team_head_coach** – string, public, the current head coach of the team
  • team_logo** – string, public, the url for the team’s logo
  • team_photo** – string, public, the url for the team’s photo
  • team_division** – int, public, the id of the division or conference the team plays in
  • team_primary_color** – string, public, the hexadecimal color value for the team’s primary color
  • team_secondary_color** – string, public, the hexadecimal color value for the team’s secondary color
  • team_slug** – string, public, the slug for the team for url purposes

Constructor – Sports_Bench_Team( $team_id )

  • Takes the id or slug of the team you give it and populates the attributes based on that team’s information.

Function get_games_played( $season )

  • Public
  • Accepts a string parameter which is the season to which to grab the games played from
  • Returns the number of games played for a team for a season
  • Make sure the season passed to this function is a string, as the SQL will not work without the season being a string

Function get_wins( $season )

  • Public
  • Accepts a string parameter which is the season to which to grab the wins from
  • Returns the number of wins for a team for a season
  • Make sure the season passed to this function is a string, as the SQL will not work without the season being a string

Function get_losses( $season )

  • Public
  • Accepts a string parameter which is the season to which to grab the losses from
  • Returns the number of losses for a team for a season
  • Make sure the season passed to this function is a string, as the SQL will not work without the season being a string

Function get_draws( $season )

  • Public
  • Accepts a string parameter which is the season to which to grab the draws from
  • Returns the number of draws for a team for a season
  • Make sure the season passed to this function is a string, as the SQL will not work without the season being a string

Function get_record( $season )

  • Public
  • Accepts a string parameter which is the season to which to grab the record from
  • Returns an array of wins, losses and draws for a team for a season
  • The returned array will have the wins as the first item, losses as the second item and draws as the third item
  • Make sure the season passed to this function is a string, as the SQL will not work without the season being a string

Function get_win_percentage( $season )

  • Public
  • Accepts a string parameter which is the season to which to grab the win percentage from
  • Returns the winning percentage for a team for a given season as a float value with three digits after the decimal point
  • Make sure the season passed to this function is a string, as the SQL will not work without the season being a string

Function get_home_record( $season )

  • Public
  • Accepts a string parameter which is the season to which to grab the home record from
  • Returns an array of the home wins, home losses and home draws for a team for a season
  • The returned array will have the wins as the first item, losses as the second item and draws as the third item
  • Make sure the season passed to this function is a string, as the SQL will not work without the season being a string

Function get_away_record( $season )

  • Public
  • Accepts a string parameter which is the season to which to grab the away record from
  • Returns an array of the away wins, away losses and away draws for a team for a season
  • The returned array will have the wins as the first item, losses as the second item and draws as the third item
  • Make sure the season passed to this function is a string, as the SQL will not work without the season being a string

Function get_points_for( $season )

  • Public
  • Accepts a string parameter which is the season you want to grab the points/runs/goals scored from
  • Returns the number of points/runs/goals the team has scored for a season as an integer
  • Make sure the season passed to this function is a string, as the SQL will not work without the season being a string

Function get_points_against( $season )

  • Public
  • Accepts a string parameter which is the season you want to grab the points/runs/goals given up from
  • Returns the number of points/runs/goals the team has given up for a season as an integer
  • Make sure the season passed to this function is a string, as the SQL will not work without the season being a string

Function get_point_differential( $season )

  • Public
  • Accepts a string parameter which is the season you want to grab the points/runs/goals differential from
  • Returns the number of points/runs/goals differential for a team for a season as an integer
  • Make sure the season passed to this function is a string, as the SQL will not work without the season being a string

Function get_division_wins( $season )

  • Public
  • Accepts a string parameter which is the season to which to grab the divisional wins from
  • Returns the number of divisional wins for a team for a season
  • Make sure the season passed to this function is a string, as the SQL will not work without the season being a string

Function get_division_losses( $season )

  • Public
  • Accepts a string parameter which is the season to which to grab the divisional losses from
  • Returns the number of divisional losses for a team for a season
  • Make sure the season passed to this function is a string, as the SQL will not work without the season being a string

Function get_division_draws( $season )

  • Public
  • Accepts a string parameter which is the season to which to grab the divisional draws from
  • Returns the number of divisional draws for a team for a season
  • Make sure the season passed to this function is a string, as the SQL will not work without the season being a string

Function get_division_record( $season )

  • Public
  • Accepts a string parameter which is the season to which to grab the divisional record from
  • Returns an array of divisional wins, divisional losses and divisional draws for a team for a season
  • The returned array will have the wins as the first item, losses as the second item and draws as the third item
  • Make sure the season passed to this function is a string, as the SQL will not work without the season being a string

Function get_conference_wins( $season )

  • Public
  • Accepts a string parameter which is the season to which to grab the conference wins from
  • Returns the number of conference wins for a team for a season
  • Make sure the season passed to this function is a string, as the SQL will not work without the season being a string

Function get_conference_losses( $season )

  • Public
  • Accepts a string parameter which is the season to which to grab the conference losses from
  • Returns the number of conference losses for a team for a season
  • Make sure the season passed to this function is a string, as the SQL will not work without the season being a string

Function get_conference_draws( $season )

  • Public
  • Accepts a string parameter which is the season to which to grab the conference draws from
  • Returns the number of conference draws for a team for a season
  • Make sure the season passed to this function is a string, as the SQL will not work without the season being a string

Function get_conference_record( $season )

  • Public
  • Accepts a string parameter which is the season to which to grab the conference record from
  • Returns an array of conference wins, conference losses and conference draws for a team for a season
  • The returned array will have the wins as the first item, losses as the second item and draws as the third item
  • Make sure the season passed to this function is a string, as the SQL will not work without the season being a string

Function get_season( $season )

  • Public
  • Accepts a string parameter which is the season to which to grab the schedule from
  • Returns an array of games, which has its own array of information
  • Indexes available for each game: date, week, opponent, location, result, team_score, opponent_score, recap
  • Make sure the season passed to this function is a string, as the SQL will not work without the season being a string

Function get_recent_result( $limit = 5, $season )

  • Public
  • Accepts an optional integer parameter that is the number of games to grab
  • Accepts a string parameter which is the season to which to grab the schedule from
  • Returns an array of the most recent games that have been completed, which has its own array of information
  • Indexes available for each game: date, week, opponent, location, result, team_score, opponent_score, recap
  • Make sure the season passed to this function is a string, as the SQL will not work without the season being a string

Function get_upcoming_schedule ( $limit = 5, $season )

  • Public
  • Accepts an optional integer parameter that is the number of games to grab
  • Accepts a string parameter which is the season to which to grab the schedule from
  • Returns an array of a number of upcoming games that are scheduled, which has its own array of information
  • Indexes available for each game: date, week, opponent, location, result, recap
  • Make sure the season passed to this function is a string, as the SQL will not work without the season being a string

Function get_alltime_wins()

  • Public
  • Returns the number of all-time wins a team has

Function get_alltime_losses()

  • Public
  • Returns the number of all-time losses a team has

Function get_alltime_draws()

  • Public
  • Returns the number of all-time draws a team has

Function get_alltime_record()

  • Public
  • Returns an array of all-time wins, all-time losses and all-time draws for a team for a season
  • The returned array will have the wins as the first item, losses as the second item and draws as the third item

Function get_roster()

  • Public
  • Returns an array of players, which has its own array of information for that player
  • Indexes available for each player: first_name, last_name, player_page, position, age, home_city, home_state, height, weight, photo

Function get_team_photo( $image )

  • Public
  • Accepts a string parameter, either team-logo or team-photo, which indicates which image to return
  • If the parameter is team-logo, the team’s logo will be returned
  • If the parameter is team-photo, the team’s photo will be returned
  • If the parameter is not team-logo or team-photo, null will be returned
  • The returned string includes the img tag with the url in the src attribute

Function get_average_attendance( $season )

  • Public
  • Accepts a string parameter which is the season to which to grab the average attendance from
  • Returns the average attendance for a given season as an float
  • Make sure the season passed to this function is a string, as the SQL will not work without the season being a string

Function get_permalink()

  • Public
  • Returns the URL to the team’s page as a string
  • The returned string does not include the a tag
  • Place the call to this function inside the href attribute of the a tag

Function get_division_name()

  • Public
  • Returns the name of the division the team is in as a string

Brackets

Class Attributes

  • bracket_id – string, public, the id of the bracket
  • num_teams – string, public, the number of teams in the bracket
  • bracket_format – string, public, the format of the bracket
  • bracket_title – string, public, the title of the bracket
  • bracket_season – string, public, the season of the bracket

Constructor – Sports_Bench_Bracket( $bracket_id )

  • Takes the id of the bracket you give it and populates the attributes based on that bracket’s information.

Function get_round( $round )

  • Public
  • Accepts a string parameter which is the round to grab the series
  • Acceptable round names: first, second, third, fourth, fifth, sixth
  • Returns an array of series ids of series in that round

Series

Class Attributes

  • series_id – string, public, the id of the series
  • bracket_id – string, public, the id of the bracket the series is associated with
  • series_format – string, public, the format of the series
  • playoff_round – string, public, the round the series is in
  • team_one_id – string, public, the id of the first team
  • team_one_seed – string, public, the seed for the first team
  • team_two_id – string, public, the id of the second team
  • team_two_seed – string, public, the seed of the second team
  • game_ids – string, public, list of game ids for the series

Constructor – Sports_Bench_Series( $series_id )

  • Takes the id of the series you give it and populates the attributes based on that series’s information.

Function get_series_score()

  • Public
  • Returns the score of the series or false if there is no score

Function get_series_winner()

  • Public
  • Returns the winner of the series or false if there is no winner

Function get_team_score( $team )

  • Public
  • Accepts a string parameter which is the team to grab the score from
  • Acceptable strings: team-one, team-two
  • Returns the score for the entered team

Display Functions

These functions control how things are displayed. For example, you’ll find functions that show the color or colors of a team in the border top of a div. Or, you’ll see a function that display’s a label head for a story.

Function sports_bench_border_top_colors( $team_one_id, $team_two_id = null, $div = null )

  • Accepts a required integer parameter, an id of a team
  • Accepts a second, optional integer parameter, an id of another team
  • Accepts an optional string parameter, the id of the div the style affects
  • Returns the border color(s) as either inline styles or embedded style tags for a div based on team ids passed to the function
  • If only one team id is passed to the function, the function will return a style attribute with a 2px solid border-top with the team’s primary color to be added in the div tag
  • If only one team id and the div parameter are passed to the function, the function will return a 2px solid border-top with the team’s primary color in an embedded style tag to be used before the div tag
  • If all three parameters are passed, the function will return an embedded style tag that will make the selected div have a 2px border that’s half the first team’s primary color and half the second team’s primary color

Function sports_bench_division_color( $division_id )

  • Accepts a required integer parameter, an id of a division
  • If the division is listed as a conference, it will return the its color as a hexidecimal value including the # at the beginning
  • If the division is listed as a division, it will return the color of the conference it’s listed under as a hexidecimal value including the # at the beginning

Function sports_bench_team_horizontal_gradient( $team_color )

  • Accepts a required string parameter, the hexidecimal value of a team’s primary or secondary color
  • Returns a string that adds in a background gradient from the color passed to the function to black
  • Place this inside of a style attribute of the div you want to affect

Function sports_bench_show_longform_header()

  • Use if using the longform feature included with the plugin
  • Returns a special header for a longform story
  • Featured image will go full width with the title, author photo and info and date will be in the middle of the image

Function sports_bench_show_team_border_colors()

  • Use only when dealing with a post
  • Returns the border colors in a similar fashion to the border_top_colors based on teams involved in the post
  • If the post is a game preview or recap, the function will return an embedded style tag that will make the selected div have a 2px border that’s half the home team’s primary color and half the away team’s primary color
  • If the post tags one team, the function will return a style attribute with a 2px solid border-top with the team’s primary color to be added in the div tag

Function sports_bench_show_label_head()

  • Use only when dealing with a post
  • If the post is a game preview, the function returns a string as “Away team at Home team”
  • If the post is a game recap, the function returns a string as “Winner score, Loser score”
  • If the post is not a game preview or recap, the function returns the category name as a string

Function sports_bench_show_slider_game_info()

  • Use only when dealing with a post
  • Returns a div section to show game information with the teams’ logos and background gradients
  • Used in the homepage slider in the Sports Bench theme

Game Preview Functions

These functions control how the game preview section looks on a post that’s marked as a preview for a game.

Function sports_bench_show_game_preview_info()

  • Use only when dealing with a post
  • Returns an aside for a post that is a game preview, displaying the teams, their logos and their records
  • Once the game is finished, the section with display the final score and a link to the recap if there is one
  • Works best if used in a widget area

Game Recap Functions

These functions control how the game recap section looks on a post that’s marked as a recap for a game.

Function sports_bench_show_game_stats_info()

  • Use only when dealing with a post
  • Returns html that outputs the line score, scoring summary (if applicable), team stats (if applicable), home and away individual stats
  • Works best if used in a sidebar

Function sports_bench_show_game_info( $game_id )

  • Accepts a required integer parameter, the id of the game
  • Returns the attendance, time and date and location (stadium, city, state) for the game
  • Each item is wrapped in an h3 tag

Playoff Functions

Function sports_bench_show_playoff_bracket( $bracket_id )

  • Accepts a required integer parameter, the id of the bracket
  • Returns the html to show the bracket anywhere

Standings Functions

These functions deal with the standings and how they are displayed. You’ll find the ability to show the league standings all together or standings for a specific conference or division.

Function sports_bench_team_division_standings( $division_id )

  • Accepts a required integer parameter, the id of the division
  • Grabs the standings for a division with the basic information (games played, record, points (if applicable))
  • Typically, this is best used if you are creating a team page template

Function sports_bench_all_team_standings()

  • Returns the league standings with no divisions or conference
  • Also shows the details (like home and away records, points/runs/goals scored, etc.) chosen in the custom fields for the standings page template

Function conference_division_standings( $division_id )

  • Accepts a required integer parameter, the id of the division
  • Returns the standings for a division or conference
  • Also shows the details (like home and away records, points/runs/goals scored, etc.) chosen in the custom fields for the standings page template

Function sports_bench_widget_standings( $division_id = null )

  • Accepts an optional integer parameter, the id of the division
  • Returns standings, either league, conference or division, with just the basic information (games played, record, points (if applicable))
  • If no division id is given, the league standings will be shown, otherwise, the given division will be shown

Function sports_bench_standings_page_template()

  • Returns the necessary html to display the standings in a page template
  • Makes creating a standings page template for a custom theme easier

Scoreboard Functions

These functions deal with how the scoreboard and scoreboard bar (if you want to use one) look on the page.

Function sports_bench_scoreboard_bar( $class = null )

  • Accepts an optional string parameter, a class to add to the scoreboard bar
  • Returns the scoreboard bar to be placed anywhere on the site
  • Works best if placed in the header for every page

Function sports_bench_scoreboard_page_template()

  • Returns the necessary html to display the scoreboard in a page template
  • Makes creating a scoreboard page template for a custom theme easier

Stats Functions

These functions deal with how stats leaders are found and displayed on the page.

Function sports_bench_get_stats_leaders( $stat, $season )

  • Accepts a required string parameter, a stat to grab
  • Accepts a required string parameter, the season to grab the stats leaders from
  • Returns the top ten leaders for the given stat, as well as a button to load more
  • A list of available stats is located in the get_stat_title function
  • Make sure the season passed to this function is a string, as the SQL will not work without the season being a string

Function sports_bench_get_more_stats_leaders( $stat, $season, $offset = 0 )

  • Accepts a required string parameter, a stat to grab
  • Accepts a required string parameter, the season to grab the stats leaders from
  • Accepts an optional integer parameter, the number of players to skip
  • Returns the next ten leaders after the number requested to skip for the given stat
  • A list of available stats is located in the get_stat_title function
  • Make sure the season passed to this function is a string, as the SQL will not work without the season being a string

Function sports_bench_get_stat_title( $stat )

  • Accepts a required string parameter, a stat to get it’s name
  • Returns the name of a stat based off of its slug
  • A list of available stats is located in this function

Function sports_bench_stats_page_template()

  • Returns the necessary html to display the stats in a page template
  • Makes creating a stats page template for a custom theme easier

Player Functions

These functions deal with how player information is grabbed and displayed on the page.

Function sports_bench_show_team_player_select()

  • Returns a select menu of teams to pick from
  • Used in the player template to select a player to view
  • Works best when trying to set up a way for users to switch teams easily

Function sports_bench_show_player_info( $player_id )

  • Accepts a required integer parameter, the id of a player
  • Returns the photo, information and stats for a player
  • Used in the player template
  • Makes creating a player page template for a custom theme easier

Team Functions

These functions deal with how teams and their information are grabbed and displayed on the page.

Function sports_bench_get_teams( $alphabetical = false )

  • Accepts an optional boolean parameter, whether or not the list is alphabetical
  • Returns an array of the teams in the order desired
  • For each team, the team_id is the key in the array and the team name is the value

Function sports_bench_show_roster( $team_id )

  • Accepts a required integer parameter, the id of the team
  • Returns the html to show a team’s roster

Function sports_bench_show_team_schedule( $team_id )

  • Accepts a required integer parameter, the id of the team
  • Returns the html to display a team’s schedule
  • Works best in a sidebar area on a team page template

Function sports_bench_show_team_listing()

  • Returns the html to show the teams with team name, logo, location, head coach and division for each team
  • Works best on the team page template

Function sports_bench_show_team_info( $team_id )

  • Accepts a required integer parameter, the id of the team
  • Returns an aside of basic information for a team as well as the team’s logo
  • Works best in a sidebar on a team page

Sport-Specific Functions

There are a number of functions inside the plugin that are create for a specific sport or sports. These are functions that get a pitcher’s ERA, a batter’s batting average or a player’s shooting percentage. Each function lists what sport or sports it’s used for.

Function sports_bench_get_linescore( $game_id )

  • Accepts a required integer parameter, the id of a game
  • Returns an array of the line score for a baseball game
  • Used with baseball only

Function sports_bench_get_linescore_display( $game_id )

  • Accepts a required integer parameter, the id of a game
  • Returns the line score for a game
  • Used with baseball, basketball, football, hockey and soccer

Function sports_bench_get_game_stat( $game, $home_away, $stat )

  • Accepts a required integer parameter, the id of a game
  • Accepts a required string parameter, whether it’s a home or away stat
  • Accepts a required string parameter, the team stat to grab
  • Returns a the team stat requested
  • Used with baseball

Function sports_bench_get_score_info( $game_id )

  • Accepts a required integer parameter, the id of a game
  • Returns the scoring summary for a game
  • Used with baseball, football, hockey and soccer

Function sports_bench_get_team_stats_info( $game_id )

  • Accepts a required integer parameter, the id of a game
  • Returns the team stats for a game
  • Used with basketball, football, hockey and soccer

Function sports_bench_get_away_individual_stats( $game_id )

  • Accepts a required integer parameter, the id of a game
  • Returns the individual stats for the away team for a game
  • Used with baseball, basketball, football, hockey and soccer

Function sports_bench_get_home_individual_stats( $game_id )

  • Accepts a required integer parameter, the id of a game
  • Returns the individual stats for the home team for a game
  • Used with baseball, basketball, football, hockey and soccer

Function sports_bench_get_ERA( $earned_runs, $innings_pitched, $innings_per_game )

  • Accepts a required integer parameter, the earned runs given up
  • Accepts a required integer parameter, the innings pitched
  • Accepts a required integer parameter, the number of innings per game
  • Returns the ERA for a pitcher as a float value
  • Used with baseball only

Function sports_bench_get_batting_average( $at_bats, $hits )

  • Accepts a required integer parameter, the at bats taken
  • Accepts a required integer parameter, the hits for a batter
  • Returns the batting average for a batter as a float value
  • Used by baseball only

Function sports_bench_stat_exists( $player, $stat )

  • Accepts a required array parameter, an array of a player’s stats
  • Accepts a required integer parameter, a stat to look for
  • Returns whether or not a player has a specific stat
  • Used by baseball and football

Function sports_bench_get_season_stats( $player )

  • Accepts a required stdClass parameter, an instance of the player class
  • Returns the html for the stats by season for a specific player
  • Used by baseball, basketball, football, hockey, soccer

Function sports_bench_get_pitcher_wins( $player_id, $season )

  • Accepts a required integer parameter, the id of the player
  • Accepts a required string parameter, the season to pull the wins from
  • Returns the number of wins for a pitcher as an integer
  • Make sure the season passed to this function is a string, as the SQL will not work without the season being a string
  • Used by baseball only

Function sports_bench_get_pitcher_losses( $player_id, $season )

  • Accepts a required integer parameter, the id of the player
  • Accepts a required string parameter, the season to pull the wins from
  • Returns the number of losses for a pitcher as an integer
  • Make sure the season passed to this function is a string, as the SQL will not work without the season being a string
  • Used by baseball only

Function sports_bench_get_pitcher_record( $player_id, $season )

  • Accepts a required integer parameter, the id of the player
  • Accepts a required string parameter, the season to pull the record from
  • Returns an array of the record for a pitcher for a season
  • Access wins with the ‘wins’ key
  • Access losses with the ‘losses’ key
  • Make sure the season passed to this function is a string, as the SQL will not work without the season being a string
  • Used by baseball only

Function sports_bench_get_pitcher_saves( $player_id, $season )

  • Accepts a required integer parameter, the id of the player
  • Accepts a required string parameter, the season to pull the saves from
  • Returns the number of saves for a pitcher as an integer
  • Make sure the season passed to this function is a string, as the SQL will not work without the season being a string
  • Used by baseball only

Function sports_bench_get_players_stats( $team_id, $season )

  • Accepts a required integer parameter, the id of the team
  • Accepts a required string parameter, the season to pull the stats from
  • Returns an array of stats for players from a team for the given season
  • Make sure the season passed to this function is a string, as the SQL will not work without the season being a string
  • Used by baseball, basketball, football, hockey, soccer

Function sports_bench_get_players_stats_table( $player_stats_array )

  • Accepts a required array parameter, the array of player stats
  • Returns the html to show the player stats for a team for a season
  • Used by baseball, basketball, football, hockey, soccer

Function sports_bench_get_points_average( $points, $games )

  • Accepts a required integer parameter, the points scored
  • Accepts a required integer parameter, the games played
  • Returns the points per game for a player as a float value
  • Used by basketball only

Function sports_bench_get_shooting_average( $made, $attempts )

  • Accepts a required integer parameter, the number of made shots
  • Accepts a required integer parameter, the number of attempted shots
  • Returns the shooting average for a player as a float value
  • Used by basketball only

Function sports_bench_get_goals_against_average( $goals_allowed, $games_played )

  • Accepts a required integer parameter, the number of goals allowed
  • Accepts a required integer parameter, the number of games played
  • Returns the goals against average for a player as a float value
  • Used by hockey and soccer

Function sports_bench_get_points( $team_id )

  • Accepts a required integer parameter, the id of the team
  • Returns the number of points the team has accumulated in the current season
  • Used by hockey and soccer

WP REST API Integration

JavaScript frameworks and the WP REST API are the hot thing in web development. If you’re creating a site that uses the REST API and any of the popular frameworks, Sports Bench has the tools to help you. Below you’ll find the available endpoints you can use to access players, teams and games hook up the plugin to your website.

Brackets

URL: /sportsbench/brackets
Accepted Parameters: bracket_id, num_teams, bracket_format, bracket_title, bracket_season
Outputs: JSON array of all of the brackets that match the parameters with all of the columns in the brackets table (see “Available Columns” section below)

Divisions

URL: /sportsbench/divisions
Accepted Parameters: division_id, division_name, division_conference, division_conference_id, division_color
Outputs: JSON array of all of the divisions that match the parameters with all of the columns in the divisions table (see “Available Columns” section below)

Games

URL: /sportsbench/games
Accepted Parameters: game_id, game_week, game_season, game_day, game_home_id, game_away_id, game_attendance, game_status
Outputs: JSON array of all of the games that match the parameters with all of the columns in the game table depending on the sport (see “Available Columns” section below)

Game Info

URL: /sportsbench/game_info
Accepted Paramenters: game_info_id, game_id, game_info_inning (if baseball), game_info_quarter (if football), game_info_period (if hockey)
Outputs: JSON array of all of the game info rows that match the parameters with all of the columns in the game_info table depending on the sport (see “Available Columns” section below)

Game Stats

URL: /sportsbench/game_stats
Accepted Parameters: game_stats_player_id, game_id, game_team_id, game_player_id, group (true or false), season
Outputs: JSON array of all of the game stats rows that match the parameters with all of the columns in the game_stats table depending on the sport (see “Available Columns” section below)

  • To get team or player stats for a season or all time, add '&group=true' to the end of the url and make sure a game_team_id or game_player_id is present in the url as well.

Players

URL: /sportsbench/players
Accepted Parameters: player_id, player_first_name, player_last_name, player_position, player_home_city, player_home_state, player_date_of_birth, team_id, player_weight, player_height, player_slug
Outputs: JSON array of all of the players that match the parameters with all of the columns in the players table (see “Available Columns” section below)

Series

URL: /sportsbench/series
Accepted Parameters: series_id, bracket_id, series_format, playoff_round, team_one_id, team_one_seed, team_two_id, team_two_seed, game_ids
Outputs: JSON array of all of the playoff series that match the parameters with all of the columns in the series table (see “Available Columns” section below)

Teams

URL: /sportsbench/teams
Accepted Parameters: team_id, team_name, team_location, team_nickname, team_abbreviation, team_city, team_state, team_stadium, team_stadium_capacity, team_head_coach, team_division, team_name, team_primary_color, team_secondary_color, team_slug
Outputs: JSON array of all of the teams that match the parameters with all of the columns in the teams table (see “Available Columns” section below)

Available Columns

Sometimes, the best solution to accomplish what you’re trying to do is to just call the table columns themselves directly. Below are the names of the tables used, the table column names and their data type.

Team Columns

  • team_id, integer
  • team_name, text
  • team_location, text
  • team_nickname, text
  • team_abbreviation
  • team_city, text
  • team_state, text
  • team_stadium, text
  • team_stadium_capacity, integer
  • team_head_coach, text
  • team_division, integer
  • team_primary_color, text
  • team_secondary_color, text
  • team_logo, text
  • team_photo, text
  • team_slug, text

Player Columns

  • player_id, integer
  • player_first_name, text
  • player_last_name, text
  • player_birth_day, text
  • player_photo, text
  • player_position, text
  • player_home_city, text
  • player_home_state, text
  • team_id, integer
  • player_weight, integer
  • player_height, text
  • player_slug, text

Division Columns

  • division_id, integer
  • division_name, text
  • division_conference, text
  • division_conference_id, integer
  • division_color, text

Bracket Columns

  • bracket_id, integer
  • num_teams, integer
  • bracket_format, text
  • bracket_title, text
  • bracket_season, text

Series Columns

  • series_id, integer
  • bracket_id, integer
  • series_format, text
  • playoff_round, text
  • team_one_id, integer
  • team_one_seed, integer
  • team_two_id, integer
  • team_two_seed, integer
  • game_ids, text

Basic Game Columns

  • game_id, integer
  • game_week, integer
  • game_day, datetime
  • game_season, text
  • game_home_id, integer
  • game_away_id, integer
  • game_home_final, integer
  • game_away_final, integer
  • game_attendance, integer
  • game_status, text
  • game_current_period, text
  • game_current_time, text
  • game_current_home_score, integer
  • game_current_away_score, integer
  • game_recap, text
  • game_preview, text

Basic Game Info Columns

  • game_info_id, integer
  • game_id, integer

Basic Game Player Stats Columns

  • game_stats_player_id, integer
  • game_id, integer
  • game_team_id, integer
  • game_player_id, integer

Baseball Game Columns

  • game_home_doubles, text
  • game_home_triples, text
  • game_home_homeruns, text
  • game_home_hits, integer
  • game_home_errors, integer
  • game_home_lob, integer
  • game_away_doubles, text
  • game_away_triples, text
  • game_away_homeruns, text
  • game_away_hits, integer, integer
  • game_away_errors, integer, integer
  • game_away_lob, integer, integer

Baseball Game Info Columns

  • game_info_inning, text
  • game_info_top_bottom, text
  • game_info_home_score, integer
  • game_info_away_score, integer
  • game_info_runs_scored, integer
  • game_info_score_play, text

Baseball Game Stats Columns

  • game_player_at_bats, integer
  • game_player_hits, integer
  • game_player_runs, integer
  • game_player_rbis, integer
  • game_player_doubles, integer
  • game_player_triples, integer
  • game_player_homeruns, integer
  • game_player_strikeouts, integer
  • game_player_walks, integer
  • game_player_hit_by_pitch, integer
  • game_player_fielders_choice, integer
  • game_player_position, text
  • game_player_innings_pitched, float
  • game_player_pitcher_strikeouts, integer
  • game_player_pitcher_walks, integer
  • game_player_hit_batters, integer
  • game_player_runs_allowed, integer
  • game_player_earned_runs, integer
  • game_player_hits_allowed, integer
  • game_player_homeruns_allowed, integer
  • game_player_pitch_count, integer
  • game_player_decision, text

Basketball Game Columns

  • game_home_first_quarter, integer
  • game_home_second_quarter, integer
  • game_home_third_quarter, integer
  • game_home_fourth_quarter, integer
  • game_home_overtime, integer
  • game_home_fgm, integer
  • game_home_fga, integer
  • game_home_3pm, integer
  • game_home_3pa, integer
  • game_home_ftm, integer
  • game_home_fta, integer
  • game_home_off_rebound, integer
  • game_home_def_rebound, integer
  • game_home_assists, integer
  • game_home_steals, integer
  • game_home_blocks, integer
  • game_home_pip, integer
  • game_home_to, integer
  • game_home_pot, integer
  • game_home_fast_break, integer
  • game_home_fouls, integer
  • game_away_first_quarter, integer
  • game_away_second_quarter, integer
  • game_away_third_quarter, integer
  • game_away_fourth_quarter, integer
  • game_away_overtime, integer
  • game_away_fgm, integer
  • game_away_fga, integer
  • game_away_3pm, integer
  • game_away_3pa, integer
  • game_away_ftm, integer
  • game_away_fta, integer
  • game_away_off_rebound, integer
  • game_away_def_rebound, integer
  • game_away_assists, integer
  • game_away_steals, integer
  • game_away_blocks, integer
  • game_away_pip, integer
  • game_away_to, integer
  • game_away_pot, integer
  • game_away_fast_break, integer
  • game_away_fouls, integer

Basketball Game Info Columns

  • game_info_referees, text
  • game_info_techs, text

Basketball Game Stats Columns

  • game_player_started, text
  • game_player_minutes, integer
  • game_player_fgm, time
  • game_player_fga, integer
  • game_player_3pm, integer
  • game_player_3pa, integer
  • game_player_ftm, integer
  • game_player_fta, integer
  • game_player_points, integer
  • game_player_off_rebound, integer
  • game_player_def_rebound, integer
  • game_player_assists, integer
  • game_player_steals, integer
  • game_player_blocks, integer
  • game_player_to, integer
  • game_player_plus_minus, double

Football Game Columns

  • game_home_first_quarter, integer
  • game_home_second_quarter, integer
  • game_home_third_quarter, integer
  • game_home_fourth_quarter, integer
  • game_home_overtime, integer
  • game_home_total, integer
  • game_home_pass, integer
  • game_home_rush, integer
  • game_home_to, integer
  • game_home_ints, integer
  • game_home_fumbles, integer
  • game_home_fumbles_lost, integer
  • game_home_possession, text
  • game_home_kick_returns, integer
  • game_home_kick_return_yards, integer
  • game_home_penalties, integer
  • game_home_penalty_yards, integer
  • game_home_first_downs, integer
  • game_away_first_quarter, integer
  • game_away_second_quarter, integer
  • game_away_third_quarter, integer
  • game_away_fourth_quarter, integer
  • game_away_overtime, integer
  • game_away_total, integer
  • game_away_pass, integer
  • game_away_rush, integer
  • game_away_to, integer
  • game_away_ints, integer
  • game_away_fumbles, integer
  • game_away_fumbles_lost, integer
  • game_away_possession, text
  • game_away_kick_returns, integer
  • game_away_kick_return_yards, integer
  • game_away_penalties, integer
  • game_away_penalty_yards, integer
  • game_away_first_downs, integer

Football Game Info Columns

  • game_info_quarter, integer
  • game_info_time, integer
  • game_info_scoring_team_id, integer
  • game_info_home_score, integer
  • game_info_away_score, integer
  • game_info_play, text

Football Game Stats Columns

  • game_player_completions, integer
  • game_player_attempts, integer
  • game_player_pass_yards, integer
  • game_player_pass_tds, integer
  • game_player_pass_ints, integer
  • game_player_rushes, integer
  • game_player_rush_yards, integer
  • game_player_rush_tds, integer
  • game_player_rush_fumbles, integer
  • game_player_catches, integer
  • game_player_receiving_yards, integer
  • game_player_receiving_tds, integer
  • game_player_receiving_fumbles, integer
  • game_player_tackles, float
  • game_player_tfl, float
  • game_player_sacks, float
  • game_player_pbu, integer
  • game_player_ints, integer
  • game_player_tds, integer
  • game_player_ff, integer
  • game_player_fr, integer
  • game_player_blocked, integer
  • game_player_yards, integer
  • game_player_fga, integer
  • game_player_fgm, integer
  • game_player_xpa, integer
  • game_player_xpm, integer
  • game_player_touchbacks, integer
  • game_player_returns, integer
  • game_player_return_yards, integer
  • game_player_return_tds, integer
  • game_player_return_fumbles, integer

Hockey Game Columns

  • game_home_first_period, integer
  • game_home_first_sog, integer
  • game_home_second_period, integer
  • game_home_second_sog, integer
  • game_home_third_period, integer
  • game_home_third_sog, integer
  • game_home_overtime, integer
  • game_home_overtime_sog, integer
  • game_home_shootout, integer
  • game_home_power_plays, integer
  • game_home_pp_goals, integer
  • game_home_pen_minutes, integer
  • game_away_first_period, integer
  • game_away_first_sog, integer
  • game_away_second_period, integer
  • game_away_second_sog, integer
  • game_away_third_period, integer
  • game_away_third_sog, integer
  • game_away_overtime, integer
  • game_away_overtime_sog, integer
  • game_away_shootout, integer
  • game_away_power_plays, integer
  • game_away_pp_goals, integer
  • game_away_pen_minutes, integer

Hockey Game Info Columns

  • game_info_event, text
  • game_info_period, integer
  • game_info_time, text
  • player_id, integer
  • game_info_assist_one_id, integer
  • game_info_assist_two_id, integer
  • game_info_penalty, text
  • team_id, integer

Hockey Game Stats Columns

  • game_player_goals, integer
  • game_player_assists, integer
  • game_player_plus_minus, integer
  • game_player_penalties, integer
  • game_player_pen_minutes, integer
  • game_player_hits, integer
  • game_player_shifts, integer
  • game_player_time_on_ice, time
  • game_player_faceoffs, integer
  • game_player_faceoff_wins, integer
  • game_player_shots_faced, integer
  • game_player_saves, integer
  • game_player_goals_allowed, integer

Soccer Game Columns

  • game_home_first_half, integer
  • game_home_second_half, integer
  • game_home_extratime, integer
  • game_home_pks, integer
  • game_home_possession, integer
  • game_home_shots, integer
  • game_home_sog, integer
  • game_home_corners, integer
  • game_home_offsides, integer
  • game_home_fouls, integer
  • game_home_saves, integer
  • game_home_yellow, integer
  • game_home_red, integer
  • game_away_first_half, integer
  • game_away_second_half, integer
  • game_away_extratime, integer
  • game_away_pks, integer
  • game_away_possession, integer
  • game_away_shots, integer
  • game_away_sog, integer
  • game_away_corners, integer
  • game_away_offsides, integer
  • game_away_fouls, integer
  • game_away_saves, integer
  • game_away_yellow, integer
  • game_away_red, integer

Soccer Game Info Columns

  • team_id, integer
  • game_info_home_score, integer
  • game_info_away_score, integer
  • game_info_event, text
  • game_info_time, integer
  • player_id, integer
  • game_player_name, text
  • game_info_assists, text

Soccer Game Stats Columns

  • game_player_minutes, integer
  • game_player_goals, integer
  • game_player_assists, integer
  • game_player_shots, integer
  • game_player_sog, integer
  • game_player_fouls, integer
  • game_player_fouls_suffered, integer
  • game_player_shots_faced, integer
  • game_player_shots_saved, integer
  • game_player_goals_allowed, integer
View Codex

See Sports Bench in Action

Want to see Sports Bench in action before deciding whether to purchase it or not? Click the link below to see the demo, where you can see all of the features the plugin and theme combo has to offer.

View Demo

Pricing Information

Plugin Only

  • Ability to integrate the plugin into a theme you’re already using.
  • Complete codex to customize usage of the plugin with the theme you already use.
  • Ability to add more functions and other customizations to the plugin.
$25.00

Plugin and Theme

  • Full integration between the theme and plugin with no extra work needed.
  • Comes with page templates for standings, scoreboards, stats, teams and players already created.
  • Complete codex to customize the theme and plugin to your liking.
  • Ability to add more functions and other customizations to the plugin.
$35.00

Theme Only

  • Nice, clean and modern WordPress theme.
  • Full-width featured post slider on the home page.
  • Tabbed post home page.
  • Social media options.
$10.00
Purchase

Other Documentation

Changelog

1.2.3 – August 3, 2017

Plugin
  • Fixed issue with date picker not showing up on add/edit player page.

1.2.2 – August 3, 2017

Plugin
  • Fixed issue with players not saving.
  • Fixed issue with games not saving because of difference in initial sport in ‘Add Game’ and the database.

1.2.1 – June 21, 2017

Plugin
  • Added better functionality for WP REST API routes, including the ability to group stats by players.
  • Fixed strip slashes issue with player’s height.

1.2 – June 7, 2017

Plugin
  • Fixed error that shows up in the standings widget and standings dashboard widget when there are no teams in the database.
  • Fixed issue with keepers not showing up in the right spot in the game recaps.
  • Changed the style of the teams adn players admin listing and edit pages to match the style of the games admin pages.
  • Added the ability to create playoff brackets.
  • Added an active/inactive option for teams.
  • Made “Free Agent” a team choice for players.
  • Redesigned the games dashboard widget to match the style of the games listing page.
  • Added shortcodes to show the scoreboard, standings or stats.
  • Fixed other minor issues with the plugin.
  • Tested to work with WordPress 4.8.
Theme
  • Fixed issue slider arrows not showing up and centered them vertically.
  • Fixed issue with header covering up top part of post title in the slider.
  • Centered the post title, details and excerpt vertically inside the slider.
  • Tested to work with WordPress 4.8.

1.1- January 7, 2017

Plugin
  • Added custom routes to the WP REST API for all tables.
  • Added standings and games dashboard widgets.
  • Changed the style of the game list page and add/edit game page to make adding game stats much easier.
Theme
  • Vertically centered the post title and information on the longform template.

1.0

  • Initial release to the world.

Licenses

GNU General Public License

http://www.gnu.org/licenses/gpl.html

Photo License

Except where otherwise noted, all photos in the screenshot are also licensed under the GNU General Public License. Copyright 2015 Jacob Martella

Social Media Icons License

All of the social media icons are licensed under the GNU General Public License (http://www.gnu.org/licenses/gpl.html).

Scripts License

All of the scripts used in this theme are licensed under the GNU General Public License (http://www.gnu.org/licenses/gpl.html).

Fonts License

PlayfairDisplay-Regular.ttf: Copyright (c) 2010-2012 by Claus Eggers Sørensen (es@forthehearts.net), with Reserved Font Name ‘Playfair’

PlayfairDisplay-Italic.ttf: Copyright (c) 2010-2012 by Claus Eggers Sørensen (es@forthehearts.net), with Reserved Font Name ‘Playfair’

PlayfairDisplay-Bold.ttf: Copyright (c) 2010-2012 by Claus Eggers Sørensen (es@forthehearts.net), with Reserved Font Name ‘Playfair’

Roboto-Light.ttf: Copyright 2011 Google Inc. All Rights Reserved.

Roboto-LightItalic.ttf: Copyright 2011 Google Inc. All Rights Reserved.

Roboto-Regular.ttf: Copyright 2011 Google Inc. All Rights Reserved.

Roboto-Italic.ttf: Copyright 2011 Google Inc. All Rights Reserved.

Roboto-Bold.ttf: Copyright 2011 Google Inc. All Rights Reserved.

Oswald-Regular.ttf: Copyright (c) 2011-2012, Vernon Adams (vern@newtypography.co.uk), with Reserved Font Names ‘Oswald’

Oswald-Bold.ttf: Copyright (c) 2011-2012, Vernon Adams (vern@newtypography.co.uk), with Reserved Font Names ‘Oswald’

Foundation License

Foundation is licensed under the MIT license. http://www.opensource.org/licenses/mit-license.php

JointsWP License

JointsWP is licensed under the GNU General Public License. http://www.gnu.org/licenses/gpl.html

Get In Contact

If you have an issue with the item, a feature you wish to see in a later release or want me to customize your version of the item, use the conact form below to get in touch with me. Please note that customizations will cost extra depending on what you wish to customize.

Sports Bench Blog Posts

View All

Other WordPress Plugins & Themes

View All

Error: Please enter a valid email address

Error: Invalid email

Error: Please enter your first name

Error: Please enter your last name

Error: Please enter a username

Error: Please enter a password

Error: Please confirm your password

Error: Password and password confirmation do not match