Question: How can I implement a hook in my template file that will change the label of a field for the "group" content type from "author" to "created by"? 

![screenshot of author field](https://i.stack.imgur.com/jDhMv.png)

Answer: 
To rename the label of a field add the preprocess function [template\_preprocess\_node](http://api.drupal.org/api/drupal/modules--node--node.module/function/template_preprocess_node/7) to your *template.php* file:

```
function *YOUR THEME*_preprocess_node(&$vars){
  //Supposing that your content type name is "group"
  if($vars['type'] == 'group'){
    //Supposing that your field name is "field_txt_group"
    $vars['content']['field_txt_author']['#title'] = 'created by';
  }
}

```
You can also change the label from a field preprocess

```
function THEMENAME_preprocess_field(&$variables, $hook) { 
  $field_name = $variables['element']['#field_name'];  
  $view_mode = $variables['element']['#view_mode'];

  switch ($field_name) {
    case 'YOUR_FIELD_NAME':
      $variables['label'] = t('FIELD LABEL EVERYWHERE');
      // Possible to restrict by view mode
      if ($view_mode == 'teaser') {
        $variables['label'] = t('TEASER LABEL HERE');
      }
      break;

    // Duplicate for other fields
    case 'OTHER_FIELD_MACHINE_NAMES':
      // ...code
      break;
  }

}

```