get_default_language(); } $transcript = false; $transcripts = $what_did_they_say->get_transcripts($post->ID); if (!empty($transcripts)) { if (isset($transcripts[$language])) { $transcript = $transcripts[$language]; } } return $transcript; } /** * Show the transcript for the current post in the requested_language. * @param string $language The language code to use. If not specificed, use the default language. */ function the_media_transcript($language = null) { $transcript = apply_filters('the_media_transcript', get_the_media_transcript($language)); echo $transcript; } /** * Get the name of the language specified by the provided language code. * @param string $language The language code to use. If not specificed, use the default language. * @return string The name of the requested language. */ function get_the_language_name($language = null) { global $what_did_they_say; if (is_null($language)) { $language = $what_did_they_say->get_default_language(); } return $what_did_they_say->get_language_name($language); } /** * Show the name of the language specified by the provided language code. * @param string $language The language code to use. If not specificed, use the default language. */ function the_language_name($language = null) { $name = apply_filters('the_language_name', get_the_language_name($language)); echo $name; } /** * Display all transcripts for a post, with a dropdown selector for people to select other languages. * @param string $dropdown_message If set, the text that appears to the left of the language dropdown. * @param string $single_language_message If set, the text that appears when only one transcript exists for this post. */ function transcripts_display($dropdown_message = null, $single_language_message = null) { global $post; if (is_null($dropdown_message)) { $dropdown_message = __('Select a language:', 'what-did-they-say'); } if (is_null($single_language_message)) { $single_language_message = __('%s transcript:', 'what-did-they-say'); } $output = array(); $transcripts = array(); $approved_transcripts = new WDTSApprovedTranscript($post->ID); $post_transcripts = $approved_transcripts->get_transcripts(); if (!empty($post_transcripts)) { foreach ($post_transcripts as $code => $transcript) { if (substr($code, 0, 1) != "_") { $transcript = trim($transcript); if (!empty($transcript)) { $transcripts[$code] = $transcript; } } } if (count($transcripts) > 0) { $default_language = $what_did_they_say->get_default_language(); $output[] = '