Supercharge SportsPress: Add Custom Player Stats

Customizing Player Statistics in SportsPress Using Hooks and Filters

If you’re building a sports website with SportsPress and need more than the default statistics, this guide shows you how to create and display a custom player statistic—Points per Match—using WordPress hooks and filters. Ideal for developers looking to extend SportsPress functionality.


What You’ll Build

A new calculated player stat:

Points per Match = Total Points ÷ Matches Played

This stat will be automatically calculated, included in player tables, and optionally styled to highlight high performers.


Step 1: Register the Custom Statistic

Add this code to your theme’s functions.php file or your custom plugin:


Step 2: Define the Calculation Logic

Use a filter to define how the stat is calculated:

Make sure that 'sp_points' and 'sp_matches' match the actual stat slugs used in your SportsPress configuration.


Step 3: Add the Stat to Player Tables

To display this new stat in frontend tables:

  1. Navigate to SportsPress > Configure > Player Lists
  2. Edit the layout and add the column with key ppm

Optional: Highlight Top Performers with Conditional Formatting

If you’d like to visually emphasize certain values, you can add custom styling:


Conclusion

By using WordPress hooks and filters, you can extend SportsPress far beyond its default settings. Whether you’re building for a local league or a national club, this approach gives you full control over how stats are calculated and displayed.

Crazy about CRO?

15+ ideas for growing your eCommerce store

Join & get tip & tricks for eCommerce Growth

We don’t spam! Read more in our privacy policy

Leave a Reply

Your email address will not be published. Required fields are marked *