Learn how to filter sports data (teams, players, games, seasons) using shortcodes and blocks. Understanding the data hierarchy helps you display exactly what you need.
Data Structure
Sports Leagues uses a hierarchical data structure where competitions are organized by league, season, and tournament:
League (e.g., "Premier League")
└── Season (e.g., "2024/2025")
└── Tournament (e.g., "Premier League 2024/25")
└── Stage (e.g., "Regular Season", "Playoffs")
└── Games (individual matches)
Teams (e.g., "Manchester United")
└── Players (roster per season)
└── Staff (coaches per season)
Key Entities
| Entity | Description | Example |
|---|---|---|
| League | Top-level competition spanning multiple seasons | Premier League, NBA, La Liga |
| Season | Time period for competition | 2024/2025, 2025 |
| Tournament | Specific competition instance | Premier League 2024/25 |
| Stage | Sub-division of tournament (optional) | Group Stage, Knockout Round |
| Team | Club/franchise persisting across seasons | Barcelona, Lakers |
| Game | Individual match between two teams | Has date, venue, score |
| Player/Staff | Individuals assigned to teams per season | Can transfer between teams |
Finding IDs
Most filters require entity IDs. Here’s how to find them:
Method 1: Edit Page URL
- Go to Sports Leagues > [Entity Type]
- Click Edit on the item
- Look at URL:
.../post.php?post=42&action=edit - The number after
post=is the ID (42 in this example)
Method 2: Hover in Admin List
- Go to Sports Leagues > [Entity Type]
- Hover over item name
- Check browser status bar for URL containing the ID
Filter by Season
Filter content to show data from specific season(s). Use this for:
- Player/staff rosters (players change teams between seasons)
- Season-specific statistics
- Historical comparisons
Parameter
season_id="8"
Multiple seasons (CSV):
season_id="7,8"
Example: Current Season Roster
Show 2024/2025 roster for a team:
[sl-roster team_id="42" season_id="8"]
Important
Always combine team filter with season filter for accurate rosters. Without season filter, shows players from ALL seasons.
Filter by League/Tournament/Stage
Filter games and content by competition level. Use the most specific filter for your needs.
Hierarchy (Most to Least Specific)
- Stage ID — Specific tournament phase
- Tournament ID — Specific competition
- League ID — Broader competition (all seasons)
Parameters
league_id="10"
tournament_id="15"
stage_id="20"
Examples
League (all seasons):
[sl-games league_id="10"]
Specific tournament:
[sl-games tournament_id="15"]
Playoff stage only:
[sl-games stage_id="20"]
Filter by Team
Filter content for specific team(s).
Parameters
For games:
filter_by_team="42"
For roster/staff blocks:
team_id="42"
Examples
Team’s games:
[sl-games filter_by_team="42" limit="20"]
Team roster with stats:
[sl-roster team_id="42" season_id="8"]
Team + Season (Important)
Always combine team and season for rosters:
| Filter | Result |
|---|---|
team_id="42" only | Every player who EVER played for team |
team_id="42" season_id="8" | Only current season roster |
Filter by Date
Filter games by date range using two approaches.
Finished Filter
| Value | Shows |
|---|---|
yes | Finished games only |
no | Upcoming games only |
| (empty) | All games |
Days Offset Filter
Flexible date range based on today’s date.
Format: [past]:[future] (days from today)
| Value | Description |
|---|---|
-7 | Last 7 days |
7 | Next 7 days |
-7:7 | 14-day window around today |
-30:0 | Past month only |
0:30 | Next month only |
Examples
Recent games:
[sl-games finished="yes" days_offset="-30" limit="10"]
Upcoming fixtures:
[sl-games finished="no" days_offset="60" limit="15"]
This week:
[sl-games days_offset="-3:4" limit="20"]
Combining Filters
Combine multiple filters for specific results. All filters use AND logic (must match ALL conditions).
Example: Team + Tournament + Date
Show Manchester United’s last 5 Premier League games:
[sl-games
filter_by_team="42"
tournament_id="15"
finished="yes"
days_offset="-90"
limit="5"]
Example: Season + League Stats
Show Barcelona’s Champions League stats for current season:
[sl-roster
team_id="15"
season_id="8"
stat_league_id="5"]
Filter Priority
When combining, more specific filters take precedence:
league_id="10" tournament_id="15" stage_id="20"
Result: Only Stage ID (20) is used. League and Tournament IDs ignored.
Multiple Values (CSV)
Some filters accept comma-separated values:
tournament_id="15,16"
season_id="7,8"
Tip
No spaces between values. Use 5,6,7 not 5, 6, 7.
Troubleshooting
No Results Found
- Verify data exists in Sports Leagues admin
- Check filter IDs are correct (case-sensitive numbers)
- Simplify filters — remove all, add back one at a time
- Check assignments — players assigned to correct team/season?
- Widen date range — try
-365:365
Wrong Data Showing
- Add missing filters — season_id for rosters, team_id for team-specific
- Verify filter values — correct IDs for intended entities
- Check CSV format —
5,6,7not5, 6, 7
Filters Not Working
- Clear cache — site cache, browser cache
- Check filter hierarchy — remove competing filters
- Verify data relationships — games belong to tournament, players assigned to team
Related Documentation
- Seasons and Leagues — Create leagues and seasons for filtering
- Tournaments — Set up tournaments and stages
- Teams — Team data and rosters
- Games — Game data and scheduling