function sopero_fixtures_shortcode() { $proxy = home_url('/wp-content/themes/sopero/api-proxy.php'); $today = date('Y-m-d'); $leagueId = 78; // Bundesliga $season = date('Y'); $url = $proxy . '?endpoint=' . urlencode("fixtures?league=$leagueId&season=$season&date=$today"); $response = wp_remote_get($url); if (is_wp_error($response)) { return "

خطأ في الاتصال

"; } $body = json_decode(wp_remote_retrieve_body($response), true); if (empty($body['response'])) { return "

لا يوجد مباريات اليوم

"; } $output = '
'; foreach ($body['response'] as $match) { $output .= '
'.$match['teams']['home']['name'].'
'.$match['goals']['home'].' - '.$match['goals']['away'].'
'.$match['teams']['away']['name'].'
'; } $output .= '
'; return $output; } add_shortcode('sopero_fixtures', 'sopero_fixtures_shortcode'); الدوريات الكبرى – sopero

الدوريات الكبرى

الأقسام

اضغط على أي بطاقة للدخول