🎯 Need Help?

Get Premium Support

Priority assistance from the developer

⬆️ Upgrade

Unlock all features

More from ANWP

Sports Leagues Premium

Multi-sport league management with advanced statistics

Learn more →

AnWP SL Theme Kit

Starter themes & block patterns for Sports Leagues

Learn more →

Matches H2H Shortcode

Pro Feature

Display head-to-head match history between two specific clubs. Shows all previous encounters with results, dates, and competition information. Perfect for pre-match analysis or rivalry pages.

Premium Feature

This shortcode requires the Football Leagues Premium plugin.

Basic Usage

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

This displays all historical matches between club 8 and club 12.

All Parameters

Club Selection

Parameter Default Description
club_a * (required) First club ID
club_b * (required) Second club ID

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
show_secondary 1 Include secondary stages (multistage competitions). Use 0 to disable
type (all) Match type: result or fixture
limit 0 Maximum matches (0 = all)
date_before (empty) Only matches before date (YYYY-MM-DD)
date_from (empty) Only matches on or after date (YYYY-MM-DD)

Note

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

Display Parameters

Parameter Default Description
show_club_logos 1 Show club logos. Use 0 to hide
show_match_datetime 1 Show match date/time. Use 0 to hide
league_name (site setting) Show the league name on each match row. 1 to show, 0 to hide, empty follows the site setting
no_data_text (empty) Text when no matches found

Sorting

Parameter Default Description
sort_by_date desc Sort order: asc (oldest first) or desc (newest first)

* Required parameters

Examples

Example 1: Complete H2H History

When to use: Full rivalry page between two clubs.

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

Result: All matches between the clubs, newest first.

Example 2: Recent Encounters

When to use: Pre-match preview showing last 5 meetings.

[anwpfl-matches-h2h club_a="8" club_b="12" limit="5" type="result"]

Result: Last 5 completed matches between the clubs.

Example 3: Competition-Specific H2H

When to use: Show league matches only (exclude cup games).

[anwpfl-matches-h2h club_a="8" club_b="12" competition_id="25"]

Result: Only Premier League matches between the clubs.

Example 4: Pre-Match Context

When to use: Show H2H before an upcoming match (exclude the upcoming game).

[anwpfl-matches-h2h club_a="8" club_b="12" date_before="2024-03-15" limit="10"]

Result: Last 10 matches before March 15, 2024.

Example 5: Date Range Filter

When to use: Show H2H matches within a specific date range.

[anwpfl-matches-h2h club_a="8" club_b="12" date_from="2020-01-01" date_before="2024-01-01"]

Result: All matches between the clubs from 2020 to 2023.

Example 7: Historical Timeline

When to use: Show encounters chronologically from first to latest.

[anwpfl-matches-h2h club_a="8" club_b="12" sort_by_date="asc"]

Result: All matches from oldest to newest.

Example 8: With Custom No-Data Message

When to use: When clubs may not have played each other yet.

[anwpfl-matches-h2h club_a="8" club_b="99" no_data_text="These teams have never met before."]

Result: Custom message if no matches exist.

Tip

For match preview pages, combine this shortcode with [anwpfl-stats-h2h] to show both the match history and statistical comparison between the two clubs.

Troubleshooting

No matches showing?

  • Verify both club IDs are correct
  • Check if the clubs have played each other in your data
  • Try removing filters to see all matches first

Missing recent matches?

  • Check if type="result" is filtering out fixtures
  • Verify the match has been published

Related