// Function to Fetch YouTube Trends function fetch_youtube_trends($regionCode = ‘IN’) { $apiKey = ‘YOUR_NEW_API_KEY’; // Apni nayi API key yahan daalein $apiUrl = “https://www.googleapis.com/youtube/v3/videos?part=snippet,statistics&chart=mostPopular&regionCode={$regionCode}&maxResults=10&key={$apiKey}”; // Fetching Data from YouTube API $response = wp_remote_get($apiUrl); if (is_wp_error($response)) { return ‘Error fetching trends!’; } $data = json_decode(wp_remote_retrieve_body($response), true); if (empty($data[‘items’])) { return ‘No trending videos found!’; } // Creating Output for Display $output = ‘‘; return $output; } // Register Shortcode for YouTube Trends add_shortcode(‘youtube_trends’, function () { return fetch_youtube_trends(); });