working on template tags
This commit is contained in:
parent
3a0d0572d5
commit
1eb372c158
|
@ -231,6 +231,26 @@ class WhatDidTheySay {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
function get_default_language() {
|
||||
$language = false;
|
||||
$options = get_option('what-did-they-say-options');
|
||||
foreach ($options['languages'] as $code => $info) {
|
||||
if (is_null($language)) { $language = $code; }
|
||||
if ($info['default']) { $language = $code; break; }
|
||||
}
|
||||
return $language;
|
||||
}
|
||||
|
||||
function get_language_name($language) {
|
||||
$options = get_option('what-did-they-say-options');
|
||||
|
||||
if (isset($options['languages'][$language])) {
|
||||
return $options['languages'][$language]['name'];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
|
@ -33,4 +33,34 @@ add_action('init', array(&$what_did_they_say_admin, 'init'));
|
|||
register_activation_hook(__FILE__, array(&$what_did_they_say, 'install'));
|
||||
register_activation_hook(__FILE__, array(&$what_did_they_say_admin, 'install'));
|
||||
|
||||
function get_the_media_transcript($language = null) {
|
||||
global $post, $what_did_they_say;
|
||||
|
||||
if (is_null($language)) { $language = $what_did_they_say->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;
|
||||
}
|
||||
|
||||
function the_media_transcript($language = null) {
|
||||
$transcript = apply_filters('the_media_transcript', get_the_media_transcript());
|
||||
echo $transcript;
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
function the_language_name($language = null) {
|
||||
$name = apply_filters('the_language_name', get_the_language_name($language));
|
||||
echo $name;
|
||||
}
|
||||
|
||||
?>
|
Loading…
Reference in New Issue