Shortcodes


Sports API Hub includes 13 shortcodes for embedding sports data anywhere on your site. Use the built-in Shortcode Builder to configure options and preview output — no coding required.

🎯 Shortcode Builder

Go to Settings & Tools > Shortcodes to open the builder.

  1. Select a shortcode from the dropdown
  2. Fill in the fields — sport, season, team, display options
  3. The generated shortcode updates in real time at the top
  4. Check the Preview panel to see how it looks
  5. Copy the shortcode and paste it into any post or page

The preview renders your shortcode exactly as visitors will see it. Use the width toggles (400px / 700px / Full) to check how it looks at different screen sizes.

Shortcode Builder with form fields on the left and live preview on the right

Tip

Fields marked with * are required. Some fields depend on others — for example, choosing a sport resets the season and team selectors to match that sport.

Game Shortcodes

[anwphub-games] — Game List

Displays games as cards in a responsive grid. Filter by sport, season, league, team, status, or date range.

Games shortcode displaying a grid of game cards with scores, teams, and dates
AttributeDefaultDescription
sport_idallFilter by sport (1=Basketball, 2=Baseball, etc.)
season_idSeason ID(s). Supports multiple (comma-separated)
league_idLeague ID(s). Supports multiple
team_idTeam ID(s). Supports multiple
statusallfinished or fixture
date_fromStart date (YYYY-MM-DD)
date_toEnd date (YYYY-MM-DD)
days_offsetDays back from today (e.g. -3). Overrides date_from
days_offset_toDays forward from today (e.g. 3). Overrides date_to
sortascasc (oldest first) or desc (newest first)
limit10Number of games to show
group_byGroup games by day or league
layoutlistlist or grid
team_displayglobalTeam display mode: auto, auto-outlined, logo, logo_code, badge-filled, badge-outlined
show_load_morenoShow “Load More” button for pagination

Examples:

[anwphub-games sport_id="1" status="finished" limit="5" sort="desc"]

[anwphub-games team_id="3419" status="fixture" sort="asc" limit="10"]

[anwphub-games sport_id="1" date_from="2026-01-01" date_to="2026-01-31" group_by="day"]

[anwphub-game] — Single Game

Embeds specific game sections into any page — like a mini game page. Choose which sections to show (header, box scores, timeline, etc.).

Single game shortcode showing header, leaders, and box scores sections
AttributeDefaultDescription
sport_id *Sport ID (required)
game_idSpecific game to display
team_lastShow team’s last finished game (fallback if no game_id)
team_nextShow team’s next upcoming game (fallback if no game_id)
sectionsComma-separated section keys (see below)
section_headeryesShow section headers

3 resolution modes: Use game_id for a specific game, team_last for a team’s most recent result, or team_next for a team’s next fixture.

Available sections (21): header, box_scores, batting, pitching, team_stats, four_factors, leaders, timeline, flow, timeline_flow, odds, highlights, venue, info, stats_comparison, key_players, recent_form, matchup_history, form_comparison, rankings_comparison, standings_context

[anwphub-game sport_id="1" team_last="3419" sections="header,leaders,box_scores"]

[anwphub-game sport_id="1" game_id="12345" sections="header,timeline,flow"]

[anwphub-calendar] — Game Calendar

Interactive day-by-day game browser with status filter pills (Live / Finished / Upcoming) and date navigation arrows. Games are grouped by league in a responsive card grid.

Calendar shortcode showing game cards grouped by league with status filter pills and date navigation
AttributeDefaultDescription
sport_idallFilter by sport. Omit for multi-sport calendar
league_idLeague ID(s). Supports multiple
datetodayStarting date (YYYY-MM-DD)
team_displayglobalTeam display mode: auto, auto-outlined, logo, logo_code, badge-filled, badge-outlined
show_live_filteryesShow Live / Finished / Upcoming filter pills
show_flagyesShow country flag next to league name
[anwphub-calendar sport_id="1"]

[anwphub-calendar sport_id="2" team_display="logo_code" date="2026-03-15"]

[anwphub-scoreboard] — Scoreboard Slider

Horizontal carousel of mini game cards powered by Swiper.js. ESPN-style design with game status at top, team logos, and scores. Shows betting spread for upcoming games when odds are available.

Scoreboard slider showing mini game cards in a horizontal carousel with navigation arrows
AttributeDefaultDescription
sport_idallFilter by sport
season_idSeason ID
league_idLeague ID
team_idTeam ID(s). Supports multiple
statusallfinished or fixture
days_offsetDays back from today (e.g. -7)
days_offset_toDays forward from today (e.g. 3)
limit20Max games to include
today_focusyesAuto-scroll carousel to today’s games on load
autoplaynoAuto-scroll the carousel
loopnoLoop back to start when reaching the end
[anwphub-scoreboard sport_id="1" season_id="58962" status="finished" limit="30"]

[anwphub-scoreboard sport_id="1" autoplay="1" loop="1"]

[anwphub-highlights] — Video Highlights

Grid of YouTube video highlight cards with league filter pills and “Load More” pagination. Each card shows the video thumbnail, team logos, score, and date.

Highlights grid showing YouTube video cards with team logos, scores, and play button overlays
AttributeDefaultDescription
sport_id *Sport ID (required)
season_idSeason ID
league_idLeague ID(s). Supports multiple
team_idTeam ID
limit12Videos per page
show_league_filteryesShow league filter pills above the grid
[anwphub-highlights sport_id="1" season_id="58962" limit="8"]

[anwphub-highlights sport_id="1" team_id="3419"]

Standings & Stats Shortcodes

[anwphub-standings] — Standings (Compact)

Compact standings table ideal for sidebars and narrow layouts. Shows one group at a time with sport-specific columns. Use the team_id attribute to automatically select the group containing that team.

Compact standings table showing team ranks, W-L records, and percentage
AttributeDefaultDescription
sport_id *Sport ID (required)
season_idcurrentSeason ID
league_idLeague ID
team_idAuto-selects the group containing this team
exclude_idsTeam IDs to hide from the table
groupGroup index (0-based). Overrides team_id auto-detect
limitallMax rows to display
columnscompactcompact, standard, or full
columns_customComma-separated column keys for custom layout
show_logonoShow team logos
show_group_namenoShow group name as header
show_zonesyesShow playoff/relegation zone colors
show_legendnoShow column abbreviation legend
link_urlURL for a “View Full Standings” footer link
link_textText for the footer link

Column presets vary by sport. For basketball: compact = W, L, PCT, GB. standard adds PPG, OPP, DIFF. full adds streak. Use columns_custom to pick exactly which columns to show.

[anwphub-standings sport_id="1" season_id="58962" team_id="3419" columns="compact" show_logo="1"]

[anwphub-standings sport_id="1" season_id="58962" group="0" limit="8" link_url="/standings" link_text="Full Standings"]

[anwphub-standings-full] — Standings (Full Width)

Full-width standings showing all groups at once. Includes Home/Away toggle pills and Division/Conference/League level pills for sports with multiple tiers.

Full-width standings with all conference groups, Home/Away pills, and zone colors
AttributeDefaultDescription
sport_id *Sport ID (required)
season_idcurrentSeason ID
league_idLeague ID
team_idHighlight this team’s row
exclude_idsTeam IDs to hide
show_home_awayyesShow Home / Away toggle pills
show_group_nameyesShow group headers (Eastern Conference, etc.)
show_level_pillsyesShow Division / Conference / League level pills
show_legendyesShow column legend
show_zonesyesShow zone colors
columns_customComma-separated column keys (empty = all columns)
[anwphub-standings-full sport_id="1" season_id="58962"]

[anwphub-standings-full sport_id="1" team_id="3419" show_home_away="0"]

[anwphub-leaders] — Stat Leaders

League-wide statistical leaders computed from your imported game data. Basketball shows hero cards for top scorers, rebounders, and assisters. Baseball shows batting and pitching leader sections.

Stat leaders shortcode showing hero cards for top scorers, rebounders, and assisters
AttributeDefaultDescription
sport_id *Sport ID (required)
season_idcurrentSeason ID
league_idLeague ID
limit5Number of leaders per category
[anwphub-leaders sport_id="1" season_id="58962" limit="10"]

Note

Leaders are calculated from imported per-game player statistics. You need to have game details imported (with lineups/box scores enabled) for this shortcode to show data.

[anwphub-team-stats] — Team Stats Comparison

Full league-wide team stats comparison table. Shows all teams in a sortable Tabulator table with W-L records and all statistical categories for the sport.

Team stats comparison table with all teams, W-L records, and statistical categories
AttributeDefaultDescription
sport_id *Sport ID (required)
season_idcurrentSeason ID
league_idLeague ID
[anwphub-team-stats sport_id="1" season_id="58962"]

[anwphub-roster] — Team Roster

Team roster displayed as a card grid grouped by position (Guards, Forwards, Centers for basketball; Pitchers, Catchers, Infielders, Outfielders for baseball).

Team roster card grid grouped by position with player photos and jersey numbers
AttributeDefaultDescription
sport_id *Sport ID (required)
team_id *Team ID (required)
[anwphub-roster sport_id="1" team_id="3419"]

Structure & Directory Shortcodes

[anwphub-bracket] — Playoff Bracket

Playoff/cup tree bracket visualization. Automatically detects whether to use a mirror layout (2-conference sports like NBA) or linear layout. Features CSS Grid connector lines, team path highlighting, champion badge, and mobile-friendly round pills.

Playoff bracket with mirror layout showing two conference trees converging to finals
AttributeDefaultDescription
sport_id *Sport ID (required)
season_id *Season ID (required)
league_idLeague ID
team_idHighlight this team’s path through the bracket
show_pillsyesShow season pills for switching between seasons
[anwphub-bracket sport_id="1" season_id="58962"]

[anwphub-bracket sport_id="1" season_id="58962" team_id="3419"]

[anwphub-leagues] — League Directory

Country-grouped league directory with flags and links to season pages. Leagues are sorted by rank (top leagues first). Supports collapsible country groups for large league lists.

League directory grouped by country with flags, league logos, and season links
AttributeDefaultDescription
sport_id *Sport ID (required)
group_bycountrycountry (open), country_collapsed (click to expand), or none
min_rankMinimum league rank to show (use 1 to hide exhibition leagues)
show_logoyesShow league logos
show_flagbigFlag size: big (32px), medium (24px), small (16px), or empty to hide
show_seasonnoShow current season year next to league name
item_paddingLeft padding for league items (0-50px)
limitallMax leagues to display
[anwphub-leagues sport_id="1" min_rank="1" group_by="country_collapsed"]

[anwphub-leagues sport_id="1" show_flag="medium" show_season="1" limit="20"]

[anwphub-entity-posts] — Linked Blog Posts

Displays blog posts that have been linked to a specific entity (team, player, game, or season) via the Entity Links feature. Available in grid (image cards) or simple (text list) layout.

AttributeDefaultDescription
entity_typeteam, player, game, season, venue, or manager
entity_post_idWordPress post ID of the entity
limit10Number of posts to show
layoutgridgrid (image cards) or simple (text list)

When used as a block in the Layout Builder, the entity_post_id is automatically set to the current entity — you only need to choose the entity type and layout. For manual shortcode usage, find the entity’s post ID in the URL when editing it under Hub Data. See Entity Links for setup instructions.

[anwphub-entity-posts entity_type="team" entity_post_id="142" layout="grid" limit="6"]

🚀 Using Shortcodes in WordPress

Block Editor (Gutenberg)

  1. Add a Shortcode block (in the Widgets category)
  2. Paste the shortcode text into the block
  3. Preview the page to see the rendered output
Adding a Shortcode block in the WordPress block editor
Shortcode text pasted into the Shortcode block in the editor

Classic Editor

Paste the shortcode directly into the editor content area. It renders on the frontend, not in the editor.

Page Builders & Widgets

Shortcodes work anywhere WordPress supports them — Elementor text widgets, Divi text modules, sidebar widgets, and theme template files via do_shortcode().

Common Attributes

These attributes are available on most shortcodes:

AttributeDescription
show_headerShow/hide the section header above the output
header_textCustom header text (overrides default)
no_data_textMessage shown when no data matches the filters
classAdditional CSS class added to the shortcode wrapper

Sport IDs

IDSport
1Basketball
2Baseball
3Cricket
4Rugby
5Ice Hockey
6American Football
7Handball
8Volleyball

📚 Related

  • Layout Builder — Drag-drop page layouts that can include shortcode blocks
  • Entity Links — Link blog posts to entities for [anwphub-entity-posts]
  • Game Pages — Full game page with all available blocks
  • Team Pages — Full team page with all available blocks