Skip to main content

Drupal - changing the calander view to display single letter for day of the week

An article from ComputerMinds - Building with Drupal in the UK since 2005
30th Nov 2007

Mike Dixon

Senior Mind
Hey, you seem to look at this article a lot! Why not Bookmark this article so you can find it easily in the future?

By default the Drupal event module will provide a nice calander block, listing the days of the week accross the top using 3 letter abbreviations (mon, tue etc).

This little theme snippet will override this default behaviour and display the first letter of each day of the week (i.e. M T W) etc.

Pop the following into your template.php file and you should be in business


function phptemplate_event_calendar_month($op, $header, 
$rows, $attributes = array(), $caption = NULL) {
  //run through each item in the old header and just use the first letter 
//instead of the entire word
  foreach ($header as $item){
    $item['data']=substr($item['data'],0,1);
    $new_header[] =$item;
  }
  return theme_event_calendar_month($op, $new_header, $rows, $attributes, $caption);
}

Hi, thanks for reading

ComputerMinds are the UK’s Drupal specialists with offices in Bristol and Coventry. We offer a range of Drupal services including Consultancy, Development, Training and Support. Whatever your Drupal problem, we can help.