🎯 Need Help?

Get Premium Support

Priority assistance from the developer

More from ANWP

Football Leagues Premium

Complete football/soccer league management for WordPress

Learn more →

Data Filtering


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

EntityDescriptionExample
LeagueTop-level competition spanning multiple seasonsPremier League, NBA, La Liga
SeasonTime period for competition2024/2025, 2025
TournamentSpecific competition instancePremier League 2024/25
StageSub-division of tournament (optional)Group Stage, Knockout Round
TeamClub/franchise persisting across seasonsBarcelona, Lakers
GameIndividual match between two teamsHas date, venue, score
Player/StaffIndividuals assigned to teams per seasonCan transfer between teams

Finding IDs

Most filters require entity IDs. Here’s how to find them:

Method 1: Edit Page URL

  1. Go to Sports Leagues > [Entity Type]
  2. Click Edit on the item
  3. Look at URL: .../post.php?post=42&action=edit
  4. The number after post= is the ID (42 in this example)

Method 2: Hover in Admin List

  1. Go to Sports Leagues > [Entity Type]
  2. Hover over item name
  3. 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)

  1. Stage ID — Specific tournament phase
  2. Tournament ID — Specific competition
  3. 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:

FilterResult
team_id="42" onlyEvery 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

ValueShows
yesFinished games only
noUpcoming games only
(empty)All games

Days Offset Filter

Flexible date range based on today’s date.

Format: [past]:[future] (days from today)

ValueDescription
-7Last 7 days
7Next 7 days
-7:714-day window around today
-30:0Past month only
0:30Next 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

  1. Verify data exists in Sports Leagues admin
  2. Check filter IDs are correct (case-sensitive numbers)
  3. Simplify filters — remove all, add back one at a time
  4. Check assignments — players assigned to correct team/season?
  5. Widen date range — try -365:365

Wrong Data Showing

  1. Add missing filters — season_id for rosters, team_id for team-specific
  2. Verify filter values — correct IDs for intended entities
  3. Check CSV format5,6,7 not 5, 6, 7

Filters Not Working

  1. Clear cache — site cache, browser cache
  2. Check filter hierarchy — remove competing filters
  3. Verify data relationships — games belong to tournament, players assigned to team

Related Documentation