Skip to content

Instantly share code, notes, and snippets.

@vdchristelle
Created September 23, 2013 12:10
Show Gist options
  • Save vdchristelle/6669607 to your computer and use it in GitHub Desktop.
Save vdchristelle/6669607 to your computer and use it in GitHub Desktop.
Override the value of the h1_title with the commercial title on taxonomy pages (for old sites)
<?php
//change node title to commercial title on taxonomy pages
if (isset($variables['page']['content']['system_main']['term_heading']['term']['#term']->tid)) {
$term_info = taxonomy_term_load($variables['page']['content']['system_main']['term_heading']['term']['#term']->tid);
if (isset($term_info) && !empty($term_info)){
$variables['h1_title'] = $term_info->the_aim_seo_pagetitle['und'][0]['value'];
}
}
//optie 2
function the_aim_theme_preprocess_page(&$variables, $hook) {
if(arg(0) == 'taxonomy' && arg(1) == 'term' && is_numeric(arg(2))) {
$variables['h1_title'] = drupal_get_title();
$term_info = taxonomy_term_load($variables['page']['content']['system_main']['cont']['field_overview_image_large']['#object']->tid);
if (isset($term_info) && !empty($term_info)){
$variables['h1_title'] = $term_info->the_aim_seo_pagetitle['und'][0]['safe_value'];
drupal_set_title($variables['h1_title']);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment