Stats H2H Shortcode

Pro Feature

Stats H2H Shortcode

Display head-to-head statistics comparison between two clubs. Shows side-by-side stat comparisons with optional highlighting of the better value. Perfect for match previews, rivalry pages, or pre-match analysis.

Premium Feature

This shortcode requires the Football Leagues Premium plugin.

Basic Usage

[anwpfl-stats-h2h club_a="8" club_b="12"]

This displays head-to-head statistics comparison between clubs 8 and 12.

Available Stats

Stat Description
goals Goals scored
goals_conceded Goals conceded
clean_sheets Clean sheets
cards_y Yellow cards
cards_r Red cards
corners Corners
fouls Fouls committed
offsides Offsides
shots Total shots
shots_on_goal Shots on target

Custom team stats: Any simple, time, or calculated column configured in Football Leagues > Settings & Tools > Statistics > Match >> Club Statistics can also be displayed by referencing its column ID as c__{id} (for example c__18 for Expected Goals). The Shortcode Builder dropdown lists these alongside the built-in slugs. Time stats render as MM:SS; calculated stats resolve per-match then aggregate. Per-match averages divide by matches that actually recorded the stat, not by all matches played – so a metric added mid-season shows a meaningful average instead of a deflated one.

All Parameters

Selection Parameters

Parameter Default Description
club_a * (required) First club ID
club_b * (required) Second club ID
stats (all) Stats to compare (comma-separated)

Query Parameters

Parameter Default Description
competition_id (all) Filter to specific competition
season_id (all) Filter to specific season
league_id (all) Filter to specific league
multistage 1 Include secondary stages (multistage competitions). Use 0 to disable
date_after (empty) Start date (YYYY-MM-DD)
date_before (empty) End date (YYYY-MM-DD)

Note

By default, multistage="1" includes all stages of multistage competitions. The Competition Selector only shows main stages. To get statistics for a specific stage (knockout or playoff), enter the stage ID manually in competition_id and set multistage="0".

Display Parameters

Parameter Default Description
h2h_only 1 Use only H2H match stats. 0 uses all matches
highlight_best 1 Highlight winning values. Use 0 to disable
per_game 1 Show per-game averages. Use 0 to hide
header (empty) Custom header text

* Required parameters

Examples

Example 1: H2H Match Statistics

When to use: Compare teams based on their direct encounters.

[anwpfl-stats-h2h club_a="8" club_b="12" h2h_only="1" stats="goals,goals_conceded,cards_y"]

Result: Stats from matches between the two clubs only.

Example 2: Season Form Comparison

When to use: Compare overall season performance.

[anwpfl-stats-h2h club_a="8" club_b="12" h2h_only="0" season_id="5" stats="goals,clean_sheets,corners"]

Result: Stats from all matches this season (not just H2H).

Example 3: Competition Stats

When to use: Compare in a specific competition.

[anwpfl-stats-h2h club_a="8" club_b="12" competition_id="12" h2h_only="0"]

Result: League stats comparison.

Example 4: Without Highlighting

When to use: Neutral comparison display.

[anwpfl-stats-h2h club_a="8" club_b="12" highlight_best="0" per_game="0"]

Result: Plain comparison without visual emphasis.

Example 5: Match Preview Section

When to use: Complete pre-match analysis.

[anwpfl-stats-h2h club_a="8" club_b="12" header="Season Form Comparison" stats="goals,goals_conceded,shots_on_goal,corners"]
[anwpfl-matches-h2h club_a="8" club_b="12" limit="5"]

Result: Stats comparison followed by recent H2H matches.

Tip

The h2h_only parameter determines the data source. Set to 1 for direct encounters statistics, or 0 to compare overall performance from all matches (filtered by competition/season if specified).

Troubleshooting

No data showing with h2h_only=”1″?

  • Verify the clubs have played each other
  • Try using h2h_only="0" to use all match stats

Highlighting not visible?

  • Check highlight_best="1" is set
  • Values must differ for highlighting to appear

Related

  • [anwpfl-matches-h2h] – Head-to-head match history
  • [anwpfl-stats-club] – Single club statistics
  • [anwpfl-results-matrix] – All H2H results in competition