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'); TAS vs PK-A Live Score, Match 14, Top End T20 Series Live Score and Commentary | Tasmania vs Pakistan Shaheens Full Scorecard 2024

Tasmania vs Pakistan Shaheens Live Cricket Score, Match 14, Top End T20 Series, 2024

Top End T20 Series
Finished
, August 13, 2024
Tasmania
TAS
124/10 (20)
Pakistan Shaheens
PK-A
125/5 (15.1)
PK-A won by 5 wickets
Match Details
Date
2024-08-13 14:00 PM
Venue
Marrara Cricket Ground (MCG 2), Darwin, Australia, Darwin
Toss
Pakistan Shaheens elected to bowl
Umpires
  • Andrew Crozier
  • Robert Stewart
Tv Umpires
    Match Referee
      MyFinal11 Pro Fantasy Guide
      Sticky Footer Ad
      WhatsApp Telegram

      Get Fantasy Tips