function display_player_stats_on_match_shortcode($atts) { // Shortcode attributes with default values $atts = shortcode_atts(['match_id' => ''], $atts, 'player_stats_on_venue'); // Validate match ID if (empty($atts['match_id'])) { return '

Error: Match ID is required.

'; } $match_id = sanitize_text_field($atts['match_id']); $match_info_url = API_CALL_BASE_URL . "v4/matches/$match_id/advance?token=" . GENERATE_DRAFT_TOKEN; // Fetch match info $match_response = wp_remote_get($match_info_url); if (is_wp_error($match_response)) { // Debug API request error return '

Error: Unable to fetch match info. Debug: ' . $match_response->get_error_message() . '

'; } $match_response_code = wp_remote_retrieve_response_code($match_response); if ($match_response_code !== 200) { // Debug non-200 response return '

Error: Unable to fetch match info. API returned an error code: ' . $match_response_code . '

'; } $match_data = json_decode(wp_remote_retrieve_body($match_response), true); // Debug: Show the full match data array live on the page $debug_output = '

Debug: Full API Response

'; $debug_output .= '
' . print_r($match_data, true) . '
'; // Extract venue and team data $venue_name = $match_data['response']['items']['info']['venue']['name'] ?? 'Unknown Venue'; $team1_name = $match_data['response']['items']['info']['teama']['name'] ?? 'Team 1'; $team2_name = $match_data['response']['items']['info']['teamb']['name'] ?? 'Team 2'; // Extract player stats $batting_stats_team1 = $match_data['response']['items']['player_batting_stats_on_venue']['team1'] ?? []; $bowling_stats_team1 = $match_data['response']['items']['player_bowling_stats_on_venue']['team1'] ?? []; $batting_stats_team2 = $match_data['response']['items']['player_batting_stats_on_venue']['team2'] ?? []; $bowling_stats_team2 = $match_data['response']['items']['player_bowling_stats_on_venue']['team2'] ?? []; // Debug: Show extracted data live on the page $debug_output .= '

Debug: Extracted Data

'; $debug_output .= '
Batting Stats - Team 1
'; $debug_output .= '
' . print_r($batting_stats_team1, true) . '
'; $debug_output .= '
Bowling Stats - Team 1
'; $debug_output .= '
' . print_r($bowling_stats_team1, true) . '
'; $debug_output .= '
Batting Stats - Team 2
'; $debug_output .= '
' . print_r($batting_stats_team2, true) . '
'; $debug_output .= '
Bowling Stats - Team 2
'; $debug_output .= '
' . print_r($bowling_stats_team2, true) . '
'; // Build the HTML output $html = "

Player Stats for Venue: $venue_name

"; // Display stats for Team 1 $html .= "

Batting Stats - $team1_name

"; $html .= generate_batting_table($batting_stats_team1); $html .= "

Bowling Stats - $team1_name

"; $html .= generate_bowling_table($bowling_stats_team1); // Display stats for Team 2 $html .= "

Batting Stats - $team2_name

"; $html .= generate_batting_table($batting_stats_team2); $html .= "

Bowling Stats - $team2_name

"; $html .= generate_bowling_table($bowling_stats_team2); // Append debug output to the end $html .= $debug_output; return $html; } // Helper function to generate batting stats table function generate_batting_table($batting_stats) { if (empty($batting_stats)) { return '

No batting stats available.

'; } $html = ""; foreach ($batting_stats as $player) { $html .= ""; } $html .= "
Player Innings Runs 50s 100s Average Strike Rate
{$player['batsman_title']} {$player['innings']} {$player['runs']} {$player['run50']} {$player['run100']} {$player['average']} {$player['strike']}
"; return $html; } // Helper function to generate bowling stats table function generate_bowling_table($bowling_stats) { if (empty($bowling_stats)) { return '

No bowling stats available.

'; } $html = ""; foreach ($bowling_stats as $player) { $html .= ""; } $html .= "
Player Innings Balls Runs Wickets Economy Average Strike Rate
{$player['bowler_title']} {$player['innings']} {$player['balls']} {$player['runs']} {$player['wickets']} {$player['econ']} {$player['average']} {$player['strike']}
"; return $html; } // Register the shortcode add_shortcode('player_stats_on_venue', 'display_player_stats_on_match_shortcode'); MUS vs BAR Live Score, Match 11, ECS Bulgaria T10 Live Score and Commentary | Medical University Sofia vs Barbarian CC Full Scorecard 2021

Medical University Sofia vs Barbarian CC Live Cricket Score, Match 11, ECS Bulgaria T10, 2021

ECS Bulgaria T10
Finished
, July 07, 2021
Medical University Sofia
MUS
27/2 (2.2)
Barbarian CC
BAR
25/10 (8.1)
MUS won by 8 wickets
Match Details
Date
2021-07-07 15:30 PM
Venue
National Sports Academy Vasil Levski, Sofia
Toss
Barbarian CC elected to bat
Umpires
    Tv Umpires
      Match Referee
        MyFinal11 Pro Fantasy Guide
        Sticky Footer Ad
        WhatsApp Telegram

        Get Fantasy Tips