Every section the plugin prints on your site – the league table, a schedule row, a heat card, the rider header – comes from a PHP template. Copy one into your child theme, change the copy, and the plugin uses your file from then on. This page covers where templates live, what they work with, what the plugin’s scripts rely on, and how to spot a copy that has fallen behind.
Once your theme replaces at least one template, Speedway Leagues > Settings, Display tab, gets a Theme overrides card listing every copy and whether it’s up to date.

🎯 Before you copy: CSS may be enough
A template copy is yours to maintain: when an update changes the plugin’s file, your copy doesn’t get the change. For other colours, spacing, fonts or a hidden line, write CSS instead – Styling with CSS below has the class names and colour variables. Copy a template when you need different markup: a new column, sections in another order, a field moved.
How overrides work
The plugin’s templates are in its templates folder. Your copies go in a folder called anwp-speedway-leagues inside your theme, with the same subfolders:
Plugin: wp-content/plugins/anwp-speedway-leagues/templates/match/heat.php
Theme: wp-content/themes/your-child-theme/anwp-speedway-leagues/match/heat.php
Each time the plugin draws a template, it takes the first file it finds, in this order:
- Your child theme:
{child theme}/anwp-speedway-leagues/{name}.php - The parent theme:
{parent theme}/anwp-speedway-leagues/{name}.php - The plugin:
anwp-speedway-leagues/templates/{name}.php
Classic and block themes work the same way. Three rules follow from this:
- You can replace a template, not add one. The plugin only looks for names it ships itself, so a new file such as
anwp-speedway-leagues/content/venue.phpis never used. - One copy changes every place the template is used.
general/schedule-match.phpdraws the rows on the competition page, the team page, the Fixtures and results block and the next / last match cards. There’s no shortcode attribute that picks a different template. - Live updates use your copy too. When a match page refreshes a heat, the new HTML comes from the same lookup, so your
match/heat.phpis what visitors see after every heat.
Use a child theme
A theme update replaces the theme’s whole folder. Copies placed straight in a theme you get updates for are gone after its next update. Put them in a child theme, which updates never touch.
🚀 Override a template
- Find the template in the list below. Pick the smallest one that holds your change – it’s the easiest to keep up to date.
- In your child theme, create the
anwp-speedway-leaguesfolder and the subfolder, for exampleanwp-speedway-leagues/general/. - Copy the plugin’s file into it under the same name. Never edit the plugin’s own file – an update overwrites it.
- Edit your copy and reload the page. Your change shows straight away.
- Open Speedway Leagues > Settings, Display tab. Your copy is on the Theme overrides card, marked Up to date.
To go back to the plugin’s version, delete your copy (or rename it so it no longer ends in .php).
Example: the track name in schedule rows
Schedule rows print the venue’s city, and the track name only when the venue has no city. To print the track name first, copy general/schedule-match.php and swap city and name in these two lines:
// In the plugin's file
$anwpsw_venue = (string) ( $anwpsw_match['venue']['city'] ?? '' );
$anwpsw_venue = '' !== $anwpsw_venue ? $anwpsw_venue : (string) ( $anwpsw_match['venue']['name'] ?? '' );
// In your copy
$anwpsw_venue = (string) ( $anwpsw_match['venue']['name'] ?? '' );
$anwpsw_venue = '' !== $anwpsw_venue ? $anwpsw_venue : (string) ( $anwpsw_match['venue']['city'] ?? '' );
Every schedule row on the site now reads Riverside Stadium instead of Riverside.
The templates
The plugin ships 36 templates in 7 folders. The four in content/ are whole page bodies: your theme prints the page title, header, sidebar and footer, and the plugin fills the content area from one of them. Those bodies are built from the smaller templates in the other folders. Names below are without the .php.
content/ – page bodies
| Template | What it draws |
|---|---|
content/competition | The competition page: season switcher, league table, classification, play-off ties, matches and rider averages, in that order |
content/team | The team page: header, season switcher, table tiles, heat-score balance, squad and the season’s matches |
content/rider | The rider page: header, teams this season, career and match log |
content/match | The match page: header, heat cards, rider tables and abandoned attempts. Also the [anwpsw-match] shortcode and the Match protocol block |
competition/ – season sections
| Template | What it draws |
|---|---|
competition/seasons | The season chips and the season’s match count |
competition/standings | The league table, one per group, with zone badges and their legend, tie-break notes, deduction footnotes and the tie-break order – and the Overall / Home / Away tabs |
competition/standings-venue | A home or away table, behind its tab or on its own (table="home" / "away") |
competition/standings-compact | The short sidebar table (Pos, team, M, Total) of the League table block or [anwpsw-standings compact="1"] |
competition/classification | The final classification |
competition/ties | The two-legged tie cards, one section per play-off phase |
competition/averages | The rider averages table with its sortable columns |
general/ – shared pieces
| Template | What it draws |
|---|---|
general/schedule | Matches by round behind the round strip, the From earlier rounds block and the team chips. On the team page, one list by date |
general/schedule-match | One schedule row – also the next match and last result cards |
general/team-mark | A team’s logo, or its letter badge, wherever a team name appears |
general/flag | A country flag |
general/socials | The link icons on team and rider headers – each network’s logo on its brand colour |
match/, team/, rider/ – page sections
| Template | What it draws |
|---|---|
match/header | Competition line and status pill, both teams and the score, the heat strip, the match facts and the Unofficial line |
match/heat | One heat card – the piece a live match page swaps after each heat |
match/riders | The rider score tables and their legend |
match/abandoned | The closed archive of abandoned attempts (its heats use match/heat) |
team/header | A band in the team’s colour: logo or letters, city and flag, then Founded, Colours, Coach, President and Home track on one line, and links |
team/standing | Three tiles: the team’s place in the table, its points, its last 5 results |
team/heat-scores | The heat-score balance: 5:1 to 1:5 tiles, other scores, heats won / drawn / lost |
team/squad | The squad with badges and season averages |
rider/header | Photo, flag and nationality, Born, Licence, Nickname, links |
rider/squads | The Teams this season chips |
rider/career | The career table, one row per season and competition |
rider/log | One season’s match log |
shortcode/ – shortcode and block wrappers
Each shortcode and its block share one template, so a copy changes both.
| Template | What it draws |
|---|---|
shortcode/standings | [anwpsw-standings] and the League table block – full or compact, the table only |
shortcode/classification | [anwpsw-classification] and the Final classification block |
shortcode/ties | [anwpsw-ties] and the Play-off ties block |
shortcode/schedule | [anwpsw-schedule] and the Fixtures and results block |
shortcode/averages | [anwpsw-averages] and the Rider averages block |
shortcode/squad | [anwpsw-squad] and the Team squad block |
shortcode/heat-scores | [anwpsw-heat-scores] and the Heat scores block |
shortcode/match-card | [anwpsw-match-next], [anwpsw-match-last] and the Next match and Last result blocks |
The shortcodes, their attributes and the blocks are covered on the Shortcodes & Blocks page.
What a template works with
A template gets one variable, the array $data – nothing else is in scope. The comment block at the top of every template lists its $data keys (the @var array $data part), so start there.
$data holds raw values – ids, numbers, codes, dates – and the template turns them into words and markup. To see everything a template receives, print it once on a staging site and remove the line afterwards:
<pre><?php echo esc_html( print_r( $data, true ) ); ?></pre>
A few habits keep a copy in line with the plugin:
- Read keys with a fallback (
$data['team']['title'] ?? ''), the way the plugin’s templates do. A key can be missing – a team without a logo, a match not ridden yet. - Escape where you print:
esc_html()for text,esc_attr()for attributes,esc_url()for links. - Keep the plugin’s helper calls. Templates call the plugin for labels and formats –
AnwpSW_Text::get()for every rewordable label,AnwpSW_Labelsfor status and gate letters,AnwpSW_Public_Formatfor dates, team order and the Your club class. Replace aAnwpSW_Text::get()call with plain text and the Texts tab in Settings no longer changes that spot.
Partials
Bigger templates draw smaller ones – partials – through the same loader:
echo anwp_sw()->template->render( 'match/header', $anwpsw_parts );
render() returns the HTML as a string, and it looks for a theme copy of the partial first. So you can override match/heat.php alone and leave content/match.php as the plugin ships it – the smaller the file you copy, the less you have to compare after an update. Pass a partial everything it needs in its array: partials read $data only, because the live match page renders some of them on their own.
Keep these in your copy
The plugin’s scripts find their way around the page through data-anwpsw-* attributes and a few class names. A copy without them still renders, but loses what they drive.
| Template | Keep | Without it |
|---|---|---|
content/match | The outer element’s data-anwpsw-page="match", data-anwpsw-live, -now, -period, -poll-from, -match-status and -revision | The match page no longer updates during a meeting. Without -poll-from, a page opened before the start never picks up the start |
content/match, match/heat | data-anwpsw-heats and data-anwpsw-revs on the heats box, data-anwpsw-heat on each card, data-anwpsw-header, data-anwpsw-riders, data-anwpsw-abandoned | The page still updates, but by redrawing the whole protocol instead of swapping in the one heat that changed |
general/schedule-match | The row’s data-anwpsw-match, -status and -kickoff; the anwp-sw-sch__when cell with the anwp-sw-sch__date span inside; data-anwpsw-status-line; each side’s data-anwpsw-side and -team; data-anwpsw-points | Live rows stop following a meeting. A row without data-anwpsw-kickoff is never watched |
competition/averages | data-anwpsw-sort-table on the table, role="row" rows, data-anwpsw-sort on sortable headers, data-anwpsw-value on their cells, data-anwpsw-rank on the rank cell | The columns can’t be sorted. Keep the header cells and the row cells in the same column order – sorting matches them by position |
competition/standings, competition/averages | data-anwpsw-scroll on the grid | On a phone the grid still scrolls sideways, but without the shadow and fade that show there are more columns |
competition/standings | The tab strip’s role="tablist" and data-anwpsw-tabs, each tab button’s data-anwpsw-tab, each panel’s data-anwpsw-tab-panel, the data-anwpsw-tab-aside lines | The Overall / Home / Away tabs don’t switch – only the overall table shows |
general/schedule | The strip’s data-anwpsw-rounds, each tab’s data-anwpsw-round, the arrows’ data-anwpsw-round-step, each panel’s data-anwpsw-round-panel, and the scroll-ignore class on team chips, round tabs and arrows | The round tabs still work as links, but each one reloads the page. Without scroll-ignore, Kadence can turn a click on a chip or tab into a scroll instead |
The live scripts also switch the anwp-sw-sch__row--live, anwp-sw-sch__side--won, anwp-sw-sch__side--lead and anwp-sw-pill classes on schedule rows – keep those names.
Other data-anwpsw-* attributes carry the raw value behind a printed number (a cell showing 12 has data-anwpsw-value="12"). Nothing breaks without them, but they cost nothing to keep, and your own scripts can read them instead of parsing text.
team/standing:data-anwpsw-positionon the place tile,data-anwpsw-pointsanddata-anwpsw-playedon the points tile. The class namesanwp-sw-standing__where,__posand__formare the same as before 0.3.0.team/heat-scores:data-anwpsw-heatsanddata-anwpsw-meetingson the section,data-anwpsw-score(5:1) anddata-anwpsw-value(the count) on each tile and chip,data-anwpsw-result(won,drawn,lost) anddata-anwpsw-valueon the won / drawn / lost totals.competition/standings:data-anwpsw-zoneon each row (empty when the place has no zone) and on each legend item.
Your club. Rows of the club picked under Your club on the Display tab, and of its child teams, carry the class anwp-sw-ours – highlighted in league tables, schedule rows and rider averages, unstyled on heat and rider-table rows. Keep the AnwpSW_Public_Format::ours_class() call that prints it, or your copy loses the highlight.
Table settings. competition/standings.php, competition/standings-venue.php and competition/averages.php build their columns from the season’s rules, then hand them to the plugin: AnwpSW_Table_Columns::customs() adds your custom columns, AnwpSW_Table_Columns::apply() orders them and drops the hidden ones, and AnwpSW_Table_Columns::style_attrs() puts each column’s background and border on its cells. A copy without these calls still renders, but the Tables tab in Settings no longer changes it.
Copies made before 0.3.0
Version 0.3.0 changed these templates enough that an older copy misses whole features. Start again from a fresh copy and re-apply your edits:
competition/standings– an older copy has no zones and no Overall / Home / Away tabs, and ignores the Tables tab and thetableattribute.shortcode/standings– an older copy still prints the final classification and the play-off ties under the League table block, and ignorestable.competition/averages– an older copy lacks the new columns and ignores the Tables tab.content/team– an older copy has no heat-score balance.team/standing,general/socials– the stylesheet now draws the new tiles and brand icons, so an older copy still works but looks out of place. An olderteam/headerkeeps the header look from before 0.3.0.
Keep an override up to date
Every template carries a version in its top comment – @version 0.1.2 – and an update that changes a template raises it. Your copy keeps the number it was copied with.
The Theme overrides card on the Display tab of Speedway Leagues > Settings lists each copy your theme has, with:
- the template name (
general/schedule-match) and the copy’s path in your themes folder - both versions – Theme 0.1.2, plugin 0.1.3
- Outdated when your copy’s version is lower than the plugin’s, or when the copy has no
@versionline at all (No version line in the theme’s copy, plugin 0.1.3); otherwise Up to date
The card only shows when your theme overrides something. With copies in both a child and a parent theme, it lists the child’s – the one in use.
After a plugin update, check the card. For each Outdated copy:
- Compare your copy with the plugin’s new file (any diff tool will do) and find what the plugin changed.
- Carry those changes into your copy, keeping your own edits. Or start again from a fresh copy and re-apply your edits – often quicker for a small change.
- Set the
@versionline in your copy to the plugin’s version. The card shows Up to date again.
The version is a reminder, not a check
The card compares numbers only. Raising the @version in your copy without merging the changes clears the badge but not the problem. And if a future update stops shipping a template, a theme copy of it is simply no longer used – the card doesn’t list it.
🎨 Styling with CSS
Everything the plugin prints sits inside an element with the class anwp-sw, and every class inside starts with anwp-sw- (anwp-sw-heat, anwp-sw-heat__row, anwp-sw-sch__venue). Page bodies add anwp-sw-page--competition, --team, --rider or --match, and shortcodes and blocks add anwp-sw-block--standings, --classification, --ties, --schedule, --averages, --squad, --heat-scores, --match-next or --match-last. A block also takes whatever you type under Advanced > Additional CSS class(es) on that same element.
Colours come from CSS variables set on .anwp-sw. On Kadence they follow your Global Palette; on other themes they’re worked out from the theme’s text colour.
| Variable | Used for | On Kadence |
|---|---|---|
--anwp-sw-text | Main text | Palette 3 |
--anwp-sw-muted | Secondary text: notes, dates, column heads | Palette 5 |
--anwp-sw-border | Edges of cards, tiles and chips | Gray 400 (--global-gray-400) |
--anwp-sw-rule | Lines between rows inside tables and cards | Palette 7 |
--anwp-sw-surface | Light backgrounds | Palette 8 |
--anwp-sw-accent | The Your club tint and left edge | Palette 1 |
--anwp-sw-live | Live pills and the newest heat’s border while live (red, #c8102e) | – |
--anwp-sw-radius | Corner radius of cards and tiles; chips take half of it (--anwp-sw-radius-s). Set by Corners on the Display tab, 6 px by default | – |
Helmet and team badge colours have their own settings – set them under Helmet colours and Team circles on the Display tab, and on each team.
Put your rules in the child theme’s stylesheet or your site’s Additional CSS. On a page that only holds a shortcode or block, the plugin’s stylesheet can load after yours, so give each selector one more level than the plugin’s – start with body .anwp-sw:
/* Hide the venue line in schedule rows */
body .anwp-sw .anwp-sw-sch__venue {
display: none;
}
/* Your club in the theme's red, a little stronger */
body .anwp-sw {
--anwp-sw-accent: #b3001b;
--anwp-sw-ours-tint: rgba(179, 0, 27, 0.12);
}
/* Show Your club on heat rows too */
body .anwp-sw .anwp-sw-heat__row.anwp-sw-ours {
background: var(--anwp-sw-ours-tint);
}
/* Narrow boxes only (see below) */
@container anwp-sw (max-width: 560px) {
body .anwp-sw .anwp-sw-sch__name {
font-size: 14px;
}
}
The layout adapts to the width of its own box, not the screen: .anwp-sw is a named container, and most narrow layouts switch on at 560 px and 420 px. A league table in a 300 px sidebar uses the phone layout on a desktop. Use @container anwp-sw queries, as in the last example, to match it.
For developers
Four hooks sit around the template loader:
| Hook | Type | What it does |
|---|---|---|
anwpsw/template/paths | Filter | The folders searched, as priority => path (child theme 1, parent theme 5, plugin 10). Add a folder – from a site plugin, say – with a priority below 10. |
anwpsw/template/loading_check | Filter | The checks that decide whether the plugin fills the content area (its post type, single page, main query, in the loop, no password). Any false leaves the post content as it is. |
anwpsw/template/load_default_template | Filter | Return false to skip the plugin’s page body for a post type (arguments: post type, post)… |
anwpsw/template/load_alt_template | Action | …and print your own body here instead. Whatever it echoes becomes the content area. |
The page body is added on the_content at priority 20, after WordPress’s own formatting, so your theme’s single template has to call the_content() for the plugin’s pages to show anything.
🆘 Troubleshooting
| You see | What to do |
|---|---|
| My copy has no effect | Check the folder: anwp-speedway-leagues in the active theme (not templates, not anwp-speedway-leagues/templates), the same subfolder as the plugin’s and the exact file name. A new file name the plugin doesn’t ship is never used. If a page cache is on, clear it. The Theme overrides card stays hidden until the plugin finds a copy. |
| A copy is marked Outdated | The plugin’s file changed since you copied it, or your copy has no @version line. Compare and merge, then set the version (see Keep an override up to date). |
| The match page no longer updates during a meeting | Your content/match.php copy lost data-anwpsw-live or data-anwpsw-page="match" on its outer element. Compare it with the plugin’s file. |
| The whole match protocol redraws during a meeting, not just the new heat | Your copy lost the heat hooks (data-anwpsw-heats, data-anwpsw-heat and the rest), so the page falls back to a full redraw. |
| Schedule rows don’t follow a live meeting | Your general/schedule-match.php copy lost data-anwpsw-kickoff, data-anwpsw-match or data-anwpsw-status. |
| The Overall / Home / Away tabs don’t switch | Your competition/standings.php copy lost the tab hooks (data-anwpsw-tabs, data-anwpsw-tab, data-anwpsw-tab-panel), or it’s older than 0.3.0 and has no tabs at all. |
| A League table block still shows the classification and the play-off ties | Your theme has a shortcode/standings.php copy from before 0.3.0. Start again from the plugin’s file. |
| Column changes on the Tables tab don’t show | Your copy of competition/standings.php or competition/averages.php has no AnwpSW_Table_Columns::apply() call. Compare it with the plugin’s file. |
| A label I changed on the Texts tab doesn’t change | Your copy prints that label as plain text. Put the AnwpSW_Text::get() call back from the plugin’s file. |
| My CSS works on team pages but not on a page with a block | The plugin’s stylesheet loads later there. Start the selector with body .anwp-sw. |
| A page shows a blank area or an error after editing a copy | A PHP error in your copy. Check your PHP error log, or rename the copy to fall back to the plugin’s file while you fix it. |
📚 Related
- Public Pages – what each page and section shows, and how the live protocol works.
- Shortcodes & Blocks – the 10 shortcodes and blocks the
shortcode/templates draw. - Display Settings – helmet colours, team circles, corners, Your club and the Theme overrides card.
- Teams & Venues – logos and badge colours.