🎯 Need Help?

Get Premium Support

Priority assistance from the developer

More from ANWP

Football Leagues Premium

Complete football/soccer league management for WordPress

Learn more →

Shortcode Player Stats Panel


The Player Stats Panel shortcode displays comprehensive player statistics with stat blocks and optional progress bar charts. Perfect for player profile pages, Layout Builder, widgets, page builders, or PHP templates.

🎯 Shortcode

[anwp-g-player-stats-panel player_id="42"]

📸 Screenshot

Player Stats Panel showing stat charts on left and stat blocks on right

✅ When to Use

Use this shortcode when:

  • Building custom player profile pages
  • Displaying player stats in widgets
  • Using page builders (Elementor, Divi, Beaver Builder)
  • Adding stats to PHP templates programmatically
  • Creating dynamic stat displays with custom filtering

Don’t use when:

  • You can use Gutenberg blocks instead (blocks are easier to configure)
  • Displaying team rosters (use Roster (adv) block)
  • Showing games (use Games Slider block)

⚙️ Parameters

Required

ParameterTypeDescription
player_idIntegerPlayer ID to display stats for (required)

Display Options

ParameterDefaultDescription
stat_blocksComma-separated stat IDs to display as numbered blocks
stat_chartsStat IDs with labels for visual charts (see format below)
season_textautoCustom season label (overrides auto-detection)
notesCustom notes/text below statistics
classAdditional CSS classes for styling

Query Filters

ParameterDefaultDescription
tournament_idFilter by tournament ID (supports CSV for multiple)
stage_idFilter by tournament stage ID
season_idFilter by season ID (supports CSV)
league_idFilter by league ID (supports CSV)
filter_by_teamFilter by team ID
date_fromStart date (format: YYYY-MM-DD)
date_toEnd date (format: YYYY-MM-DD)

📊 stat_charts Format

The stat_charts parameter uses a special format to define chart labels:

stat_charts="ID,Label|ID,Label|ID-ID,Label"

Example:

stat_charts="12,Free Throw Percentage|13,2-Point Goal Percentage|14,3-Point Goal Percentage|18-19,Rebounds (Off/Def)"
  • 12,Free Throw Percentage – Stat ID 12 with label “Free Throw Percentage”
  • 18-19,Rebounds (Off/Def) – Combined stats 18 and 19 with label
  • Use | to separate multiple charts

💡 Examples

Basic Usage

[anwp-g-player-stats-panel player_id="42"]

With Stat Blocks

[anwp-g-player-stats-panel player_id="42" stat_blocks="goals,assists,games_played"]

With Charts and Blocks

[anwp-g-player-stats-panel
  player_id="42"
  stat_blocks="goals,assists,games_played,minutes"
  stat_charts="goals,assists"]

Filtered by Season

[anwp-g-player-stats-panel
  player_id="42"
  season_id="8"
  season_text="2024/2025 Season"
  stat_blocks="goals,assists,games_played"]

Career Statistics

[anwp-g-player-stats-panel
  player_id="42"
  season_text="Career Statistics"
  stat_blocks="goals,assists,games_played,minutes,yellow_cards,red_cards"
  stat_charts="goals,assists,games_played"]

Date Range Filter

[anwp-g-player-stats-panel
  player_id="42"
  date_from="2025-01-01"
  date_to="2025-06-30"]

🔧 Layout Builder Integration

Use the shortcode in Layout Builder with dynamic variables to automatically display stats for every player:

  1. Go to Sports Leagues > Layout Builder > Player
  2. Add Global Shortcode block to your layout
  3. Use dynamic variables for player and season IDs
[anwp-g-player-stats-panel player_id="%player_id%" season_id="%season_id%" stat_blocks="2,3,4,6,7,8,9,10,11,15,16,17,20,22,23,24,25" stat_charts="12,Free Throw Percentage|13,2-Point Goal Percentage|14,3-Point Goal Percentage|18-19,Rebounds (Off/Def)"]
Layout Builder with Global Shortcode block containing the player stats panel shortcode

Dynamic variables:

  • %player_id% – Current player’s ID (auto-filled)
  • %season_id% – Current season ID (auto-filled)

Tip

Use stat IDs instead of names when using Layout Builder. Find stat IDs in Sports Leagues > Statistics.

🏗️ Page Builder Integration

Elementor

  1. Add Shortcode widget
  2. Paste shortcode
  3. Style with Elementor’s CSS options

Divi Builder

  1. Add Text module
  2. Paste shortcode in content
  3. Use Divi styling controls

Beaver Builder

  1. Add HTML module
  2. Paste shortcode
  3. Preview and save

👨‍💻 PHP Template Integration

Add stats to custom player profile templates:

<?php
// Get current player ID from query
$player_id = get_the_ID();

// Build shortcode dynamically
echo do_shortcode('[anwp-g-player-stats-panel player_id="' . $player_id . '" stat_blocks="goals,assists,games_played"]');
?>

🔍 Finding IDs

Player ID

Navigate to Sports Leagues > Players > Edit Player. The ID is in the URL:

.../wp-admin/post.php?post=42&action=edit
                            ^^
                         Player ID

Stat IDs

Go to Sports Leagues > Statistics to find stat IDs for your sport configuration.

🆘 Troubleshooting

Shortcode displays as plain text

  • Ensure you’re in “Text” tab (Classic Editor) or using Shortcode block (Gutenberg)
  • Check for extra spaces around shortcode
  • Verify AnWP SL Kit plugin is active

No stats showing

  • Verify player_id is correct
  • Check that player has stats in Sports Leagues plugin
  • Ensure filters aren’t too restrictive (try removing all filters temporarily)

Wrong stats showing

  • Double-check filter IDs (tournament_id, league_id, etc.)
  • Verify date range format is YYYY-MM-DD

📚 Related