Customizing the Team Rosters Plugin

In version 4.0 the ability to customize the plugin’s displays – roster tables, player galleries, and player profiles – has been greatly expanded. The four ways to customize the plugin are described below. Examples of their use are available on the MSTW Development site. A video tutorial is available to Gold Support members on the Tutorials page.

  • Admin Settings Screen. The 4.0 Admin Settings screen has been re-organized into four tabbed sections. The advantage of these settings is that colors can be customized without have write CSS selectors and rules, or edit page templates. The disadvantages are that the customization is much more limited than what can be done via custom CSS, and the the settings APPLY TO ALL DISPLAYS on the site. This is generally fine for a site supporting a single team or school, but it doesn’t work well for a site with multiple teams with different colors. See the Settings man page for more information.
  • Use Team Colors. One cool new display setting is the “Use Team Colors” checkbox on the Roster Table Colors tab. If a team in Team Rosters is linked to the MSTW Schedules & Scoreboards Team DB, and the team colors are specified there, then when this box is checked, the the the plugin uses the linked team’s colors. Note: Checking this box will override any other settings on the admin Settings screen AND any custom CSS.
  • Custom Stylesheets (CSS). The default stylesheet (/css/mstw-tr-styles.css) provides neutral blue tones. Nice, but probably not representative of your team’s colors. In version 4.0 there are a couple of options for customizing this stylesheet. First, it is still possible to edit the plugin’s stylesheet. This works, but the danger here is that when the plugin is upgraded, the modified file must be moved, or it will be overwritten. In version 4.0, there is the option to create a customized stylesheet in the theme’s (or child theme’s) main directory. This file MUST be named mstw-tr-custom-styles.css. The plugin first attempts to load its stylesheet, /css/mstw-tr-styles.css, then attempts to load the custom stylesheet, mstw-tr-custom-styles.css, from the theme’s (or child theme’s) main directory. It will load both in that order if both exist. So there are a number of options in controlling the ‘cascade’. It is recommended that the plugin’s stylesheet be left in place unchanged, and all customizations be contained in a new mstw-tr-custom-styles.css stylesheet. This allows one to fall back to the original file if necessary, and the customized file will not be over-written when a new version of the plugin is installed. If you are using a child theme (and unless you wrote your own you should be) the customizations will not be overwritten if the theme is updated either. However, it is possible to copy the plugin’s entire stylesheet to the theme’s directory, make all customizations in that file, and delete the default stylesheet from the plugins /css directory. Code snippets for the stylesheet customizations on the MSTW Dev site are available to Gold Support members.
  • Player Profile and Player Gallery Page Templates. The plugin’s two custom page templates – single-player.php and taxonomy-team.php – are located in the plugin’s /theme-templates directory. The plugin was developed and tested on the Twenty Eleven and Twenty Twelve themes. It is not unlikely that CSS modifications and perhaps code changes to these page templates will be required to make them “fit nicely” and “look pretty” in other themes. In version 4.0, there are two ways to customize these templates. The plugin first attempts to load these templates from the theme/chid theme directory. If not found, the plugin will load the templates from its /theme-templates directory. So it is recommended that one copy the template(s) from /theme-templates to the theme’s (or the child theme’s) main directory and make the desired customizations there. This will allow one to fall back to the original file(s) if necessary, and the customized files will not be over-written if a new version of the plugin is installed. If you are using a child theme, and you probably should be, the customizations will not be overwritten if the theme is updated either.
  • Player Photos. The shortcodes and page templates use the following logic to display player photos:
    • Uses the player’s Featured Image, if present.
    • Uses the logo for the team in the MSTW Schedules & Scoreboards database, if team is linked and logo is present.
    • Uses default-logo-[team-slug].png in the plugin’s images/default-images, if present.
    • Uses default-photo.png in the plugin’s images/default-images, which is loaded with the plugin, but can/(should?) be replaced.
  • Team Logos. The shortcodes and page templates use the following logic to display team photos:
    • Uses the logo for the team in the MSTW Schedules & Scoreboards database, if team is linked and logo is present.
    • Uses default-logo-[team-slug].png in the plugin’s images/default-images, if present.
    • Uses default-logo.png in the plugin’s images/default-images, which is loaded with the plugin, but can/(should?) be replaced.