Skip to main content

Baseball Sport Features

Beyond terminology, the Baseball plugin adds three baseball-specific behaviours: partial-inning notation conversion, separate Batting and Pitching performance sections, and adjusted squad-number display.

Baseball Sport Features

Beyond terminology, the Baseball plugin adds three baseball-specific behaviours: partial-inning notation conversion, separate Batting and Pitching performance sections, and adjusted squad-number display.
​

Partial innings notation

Innings pitched are typically recorded with a special decimal notation:
​

  • .1 means one out (one-third of an inning)

  • .2 means two outs (two-thirds of an inning)

  • .0 means a complete inning

The plugin converts these on the fly when totalling statistics. So 2.1 + 1.2 = 4.0 (rather than 4.1 from naïve decimal addition). Conversion is applied through:
​

  • sportspress_event_performance_add_value — when summing event totals

  • sportspress_event_performance_table_total_value — when displaying totals in tables

  • sportspress_player_performance_add_value — when summing across a player's career

  • sportspress_player_performance_table_placeholder and sportspress_player_performance_table_placeholders — when rendering placeholder values

To enable partial-innings conversion on a custom performance type:
​

  1. Go to SportsPress → Performance and edit the performance post.

  2. In the meta box, tick the Partial Innings checkbox.

  3. Update.

The sp_partial_innings post meta value is what the filter callbacks check.
​

Batting vs Pitching sections

The performance entry interface is split into two sections corresponding to baseball's offensive (batting) and defensive (pitching) statistics. Each section is configured independently at SportsPress → Configure so you can record batting and pitching stats with their own metric sets.
​

Squad-number display also differs between the sections: the plugin returns different defaults via sportspress_event_performance_default_squad_number and selectively hides batting-order numbers in pitching contexts via sportspress_event_performance_show_numbers (priority 20).
​

Adjusted empty-result string

The plugin filters sportspress_event_empty_result_string so that absence of a result for a player renders consistently with baseball box-score conventions (e.g. blank rather than 0).
​

Customising the partial-innings logic

If your league records partial innings with a different convention (e.g. .3 for one-third), you can override the conversion by registering a higher-priority filter on sportspress_event_performance_add_value and returning your own conversion. The plugin's logic is in the add_value and total_value methods in the main plugin file.
​

Did this answer your question?