Player Statistics
Player Statistics are calculated values that aggregate a player's performance data across multiple events — for example, Total Goals, Goals per Game, or Minutes per Goal. Each statistic is a WordPress post of type sp_statistic.
Statistics differ from Player Performance items: performance items are entered per-event (how many goals did this player score in this match?), while statistics are calculated across all events (how many goals has this player scored in total, or on average?).
Navigate to SportsPress > Configure to see the list, or use the View All link in the Player Statistics section.
Fields
Each statistic has the following fields:
Label — The column header shown in player lists (for example: GP, G, A, Pts, MIN).
Icon — An optional thumbnail image displayed as a small icon in the column header.
Key — The internal slug used to identify this statistic in sort priority references. Set in the Details meta box.
Equation — The formula used to calculate the statistic value from performance and event data. Built using the drag-and-drop equation builder.
Decimal Places — The number of decimal places shown in the column. Defaults to 0. Set in the Details meta box.
Category — Groups this statistic within player lists. The available options are:
All — Shown in all views.
Offense — Shown in the offense grouping.
Defense — Shown in the defense grouping.
Format — Controls how the value is rendered. The available formats are:
Number — A plain numeric value (default).
Time — A time value.
Type — Controls how the equation result is aggregated across events. The available types are:
Total — Sums the equation result across all events the player appeared in.
Average — Averages the equation result across all events.
Visible — Whether this column appears in player lists by default. Shown only when Player Columns in SportsPress > Settings > Players is set to Automatic. Options are Yes and No. The tooltip reads "Display in player profile?"
Description — Internal notes displayed only in the admin dashboard.
The Configure screen summary table shows Label, Icon, Equation, Decimal Places, Category, Visible (when applicable), and Description.
The Equation Builder
The Equation meta box presents a drag-and-drop palette accepting tokens from the following groups:
Events —
Attended($eventsattended),Played($eventsplayed),Started($eventsstarted),Substituted($eventssubbed),Minutes($eventminutes).Outcomes — Every defined Event Outcome (for example:
$win,$draw,$loss).Results — Every defined Event Result in
forandagainstvariants.Performance — Every defined Player Performance item whose format is not Text or Equation (for example:
$goals,$assists).Metrics — Every defined Player Metric (for example:
$height,$weight).Operators —
+,-,×,÷,(,). When the Conditional Equations module is active, comparison operators>,<,≡,≠,≥,≤are also available.Constants — Integers 0 through 10, and 100.
The Type Field
The Type field determines whether the equation is summed (Total) or averaged (Average) across all events for a given player.
For a Goals statistic, use Total — the result is the sum of goals scored in all events. For a Goals per Game statistic, the equation would be $goals / $eventsplayed which divides within each event, so the aggregation type matters less; however, setting it to Total with an equation like $goals and a separate Average stat is also a valid approach.
Adding a Statistic
Go to SportsPress > Configure.
In the Player Statistics section, click Add New.
Enter the Label (title) in the post title field.
Optionally set a featured image to serve as the Icon.
In the Details meta box, set Key, Decimal Places, Category, Format, Type, and Visible.
In the Equation meta box, build the formula by clicking tokens or typing a custom equation.
Optionally add a description in the Excerpt field.
Set the display Order in the Attributes box.
Click Publish.
