fieke
9/23/2013 - 12:10 PM

Override the value of the h1_title with the commercial title on taxonomy pages (for old sites)

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']);
    }    
  }
}