You can use drupal_set_title()
with implementing hook_preprocess_page()
.
/**
* Implements hook_preprocess_page().
*/
function mymodule_preprocess_page(&$variables) {
$langcode = $variables['language']->language;
$term = menu_get_object('taxonomy_term', 2, $langcode);
if (!empty($term)) {
drupal_set_title($term->custom_field[$langcode][0]['value']);
}
}
menu_get_object()
may not work because some module may override the menu entry taxonomy/term/%
as mentioned by mxh.
If you want more robust way to retrieve the term object. Please use below snippet.
if (arg(0) == 'taxonomy' && arg(1) == 'term' && arg(2)) {
$term = taxonomy_term_load(arg(2));
}
if (isset($term) && !empty($term)) {
// code.
}