How To’s

PLUGIN

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.
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 PREVIEW

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.
ADDING SUPPORT FOR LONGFORM CATEGORY

Sports Bench features an easy way to show special posts in a different way. The theme requires no code work from you to setup. If you are using the Sports Bench theme, skip to item six. Otherwise, the first five steps show you how to create the recap/preview area.

The longform category section requires a lot of work to get going, as it’s probably the toughest thing to implement in another theme. It’s advised that only people who know what they are doing try to implement the longform feature. This is why it’s recommended to use the Sports Bench theme.

  1. Place the following line of code in the outermost div in the single.php file:
    • <?php if ( in_category( get_theme_mod( 'sports-bench-long-form-cat' ) ) ) { ?> class="longform" <?php } ?>
  2. Underneath that div place the following if statement:
    • <?php if ( in_category( get_theme_mod( 'sports-bench-long-form-cat' ) ) ) {
      } else {
      } ?>
  3. Cut everything else inside of the outermost div and place it inside the else statement. Then paste it again in the if statement.
  4. Inside the if part of the statement, cut out the normal post header and the sidebar. Then paste in the following line of code in a spot where it can stretch across the entire page:
    • <?php echo show_longform_header(); ?>
  5. You’ll need to make sure that the post area width is as wide as its parent div. You’ll probably have to go into the theme style.css file and add something like the following.
    • .longform .{{post-area-div}} { width: 100%; }
    • Replace {{post-area-div}} with the div where the_content() is place
  6. To make a post longform, select the category in the Sports Bench Plugin Settings, then add a post to that category.
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.

THEME

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.