How To’s

Learn More

Getting started with Sports Bench can seem a bit overwhelming, and that’s okay. Below are a number of how to’s I’ve written to help you get started. They range from basic setup steps to more complicated integrations. If you still need help, feel free to use the contact form at the bottom to ask me any question you have.

To read tutorials on more complicated things, please view the Tutorials page.

Installation

So you’ve bought Sports Bench? Cool. Here’s how to install it and get on your way to creating a cool sports website.

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.
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 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.
Show How To

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.

Show How To

Creating a Team

Once you’ve got the divisions created, you’re ready to start creating teams. Here’s how:

  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.
Show How To

Creating a Player

Once you’ve got the teams created, you’re ready to start adding players. Here’s how:

  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.
Show How To

Creating a Game

Now that the teams and players have been added, you can start creating games. Here’s how:

  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.
Show How To

Creating a Playoff Bracket

So your league’s regular season has come to an end and now you’re ready for a postseason tournament to crown a champion. Here’s how to create an awesome bracket and show it for all to see:

  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!
Show How To

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.
Show How To

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.
Show How To

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.
Show How To

Setting Up the Team 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.
Show How To

Setting Up the Player 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.
Show How To

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.
Show How To

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.
Show How To

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.

Show How To

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.
Show How To