Css Customization


Sports API Hub uses CSS custom properties (design tokens) and a consistent BEM naming convention across all frontend blocks. You can adjust global design tokens for broad changes, or target specific BEM classes for precise overrides — no need to edit plugin files or PHP templates.

🎨 CSS Design Tokens

The plugin outputs three CSS custom properties on :root that control the overall visual style of all blocks:

VariableDefaultPurposeHow to Change
--ahub-border-radius0pxCorner rounding on all blocksSettings & Tools > Settings > Display > Border Radius
--ahub-border-color#cdcfd1Structural borders on all blocksCustom CSS override
--ahub-bg-alt#f8f9faZebra striping, header backgrounds, surface tintsCustom CSS override

Border Radius

The border radius setting in Plugin Settings provides preset values: 0, 4, 6, 8, or 12 pixels. This affects all plugin blocks globally — game cards, headers, team rosters, player stats, and more.

Overriding Design Tokens

To change the border color or alternate background globally, add custom CSS:

:root {
    --ahub-border-color: #e2e8f0;
    --ahub-bg-alt: #f1f5f9;
}

Color Palette Variables

The plugin outputs nine color palette CSS variables used throughout blocks:

VariableSlotDefault Role
--global-palette11Primary accent
--global-palette22Secondary accent
--global-palette33Primary text
--global-palette44Secondary text
--global-palette55Tertiary text
--global-palette66Quaternary text
--global-palette77Base background
--global-palette88Secondary background
--global-palette99Tertiary background

These are configured in Color Palette settings. If you use the Kadence theme, the plugin automatically uses Kadence’s palette and skips outputting its own variables.

BEM Block Reference

All frontend elements follow BEM (Block Element Modifier) naming: ahub-{block}__element--modifier. Use your browser’s developer tools (F12) to inspect any element and find its exact class.

Game Blocks

Block ClassDescription
ahub-game-cardGame cards in lists and grids (scores, teams, status)
ahub-game-headerSingle game page header (scoreboard, teams, periods)
ahub-game-leadersTop performers per category (PTS/REB/AST or H/HR/RBI)
ahub-game-peekHover card popup on game references
ahub-game-gridCard grid container for game listings
ahub-game-miniMini game cards in scoreboard slider
ahub-game-oddsBetting odds table with format switcher
ahub-venueVenue information card
ahub-game-infoGame metadata grid (referee, attendance)
ahub-team-statsTeam statistics comparison bars
ahub-box-scoresPlayer box score tables (Tabulator)
ahub-timelinePlay-by-play timeline
ahub-game-flowScore line and lead tracker charts (ECharts)
ahub-game-comparisonStats comparison radar chart + bars
ahub-game-ranksSide-by-side league rank badges
ahub-game-recent-formLast N games per team
ahub-game-form-chartDual W-L differential chart
ahub-game-matchupHead-to-head history table

Team Blocks

Block ClassDescription
ahub-team-headerTeam page header (logo, info, calendar)
ahub-team-infoTeam metadata grid
ahub-team-recordSeason W-L record with ratio bars
ahub-team-resultsRecent results with form dots and game cards
ahub-team-scheduleMonth-based game schedule navigator
ahub-team-standingsGroup standings table
ahub-team-staffCoach/manager card
ahub-team-rosterPlayer roster card grid
ahub-team-formCumulative W-L area chart (ECharts)
ahub-team-calendarInteractive calendar with game results
ahub-team-historyMulti-season W-L record table
ahub-team-descriptionTeam description text

Player Blocks

Block ClassDescription
ahub-player-headerPlayer page header (photo, hero stats, form)
ahub-player-infoPlayer metadata grid
ahub-player-game-logPer-game stats table with season switcher
ahub-player-careerCareer stats table (season-by-season)
ahub-player-splitsHome/Away, Monthly, Wins/Losses splits
ahub-player-highlightSVG ring charts with stat ranks
ahub-player-opponentsPer-opponent stats table
ahub-player-descriptionPlayer description text

Season & Other Blocks

Block ClassDescription
ahub-season-headerSeason page header with dropdown navigation
ahub-season-standingsSeason standings with level/H-A pills
ahub-season-teamsSeason team card grid
ahub-scoreboardSeason scoreboard with date navigation
ahub-sb-sliderSwiper scoreboard carousel
ahub-bracketPlayoff bracket (mirror/linear layout)
ahub-calendarDay-by-day game calendar
ahub-highlightsVideo highlight card grid
ahub-highlight-cardYouTube video card with play overlay
ahub-league-listCountry-grouped league directory
ahub-tabsTab container (underline/pills styles)
ahub-block-navSticky scroll navigation
ahub-agg-pillsSeason/filter pill switcher

Responsive Design

The plugin uses CSS container queries (not media queries) for responsive layouts. Each block adapts based on its own container width, not the viewport width. This means blocks respond correctly whether placed in a full-width layout, a sidebar, or a narrow column.

Container query breakpoints vary by block but typically include:

  • Wide (default) — full layout with all elements visible
  • Medium (~640px container) — compact spacing, smaller elements
  • Narrow (~480px container) — stacked layout, abbreviated labels
  • Minimal (~360px container) — essential content only

Because container queries are used, you do not need to write media queries when embedding blocks in different layout contexts.

🛠️ Adding Custom CSS

Option 1: WordPress Additional CSS

Navigate to Appearance > Customize > Additional CSS and add your overrides:

/* Change game card border color */
.ahub-game-card {
    border-color: #3b82f6;
}

/* Increase team name font size in game headers */
.ahub-game-header__team-name {
    font-size: 22px;
}

Option 2: Theme Stylesheet

Add CSS rules to your child theme’s style.css file. This is preferred for extensive customizations.

Option 3: Custom CSS Plugin

Use any CSS plugin (such as Simple Custom CSS, WPCode, or similar) to add rules without editing theme files.

Example Overrides

Change Game Card Background

.ahub-game-card {
    background-color: #fafbfc;
}

Style the Winner Score

.ahub-game-card .ahub-game-card__team-row--winner .ahub-game-card__score {
    color: #16a34a;
    font-weight: 700;
}

Adjust Team Header Layout

.ahub-team-header {
    padding: 24px;
    border-radius: 12px;
}

Hide a Specific Block

/* Hide venue info on game pages */
.ahub-venue {
    display: none;
}

Customize Box Scores Table

/* Tabulator header styling */
.ahub-box-scores .tabulator .tabulator-header {
    background-color: #f1f5f9;
}

💡 Tips

  • Inspect elements using your browser’s developer tools (F12) to find the exact BEM class for any element.
  • Use specific selectors. BEM classes are descriptive enough that you rarely need to chain multiple selectors.
  • Avoid !important when possible. The plugin’s CSS specificity is intentionally low to make overrides easy.
  • Design tokens first. Before writing block-specific CSS, check if a design token can achieve what you need globally.
  • Container queries. If you need responsive overrides, target the block’s container width rather than the viewport.

📚 Related