Hi,
how can I change the "home" txt in generated breadcrumb ?

Thanks,
Brakkar

Comments

lebachai’s picture

Find the following line in menu.inc:

<?php
$links[] = l(t('Home'), variable_get('site_frontpage', 'node'));
?>

And change 'Home' to whatever:

<?php
$links[] = l(t('Some name here'), variable_get('site_frontpage', 'node'));
?>

Hope this helps.

gwen’s picture

It's a bad idea to modify core files b/c it will make upgrading much messier. 2 alternatives:

1. Use the locale module to create your own "language". See http://drupal.org/node/24593 for instructions.
2. Use theming. If you wanted to do something more complicated like, say, getting rid of the Home link altogether, you could override theme_breadcrumb. For example, you could do something like:

function phptemplate_breadcrumb($breadcrumb) {
  if (strip_tags($breadcrumb[0]) == "Home") {
    array_shift ($breadcrumb);
  }
  if (!empty($breadcrumb)) {
    return '<div class="breadcrumb">'. implode(' › ', $breadcrumb) .'</div>';
  }
}

I heard that drupal 6 might have hook_something_alters for more things, so possibly in drupal 6, there might be a hook_breadcrumb_alter.

VM’s picture

This handbook page may help as well : http://drupal.org/node/72850 which is where gwen's example comes from, i believe.

TimG1’s picture

Hi all,

Sorry, I still can't figure out how to do this in Drupal 6 without modifying the core. I just want to change the text of "Home" to "Library Home".

Can anyone help?

Thanks!
-Tim

VM’s picture

it may be possible with the string overrides.module.

TimG1’s picture

Woot! The String Overrides module totally worked. Many thanks VeryMisunderstood!

-Tim

jeffschuler’s picture

You could override the theme_breadcrumb() function in your theme's template.php file, adding a line to modify the first link in the $breadcrumb array:

<?php
function YOURTHEME_breadcrumb($breadcrumb) {
  if (!empty($breadcrumb)) {
    $breadcrumb[0] = l('Library Home',NULL);
    return '<div class="breadcrumb">'. implode(' » ', $breadcrumb) .'</div>';
  }
}
?>
sh264’s picture

@jeffschuler
thanks for that, worked like a charm at first but then some errors for me:
-white screen of death on login, logout and use of search form
-error: Cannot modify header information - headers already sent ...
-error: session_regenerate_id() ...

solution in this case:
using notepad++ needed to set the template.php format from 'Encode with ANSI' to 'Encode with UTF-8 without BOM' to get rid of the ? in the diamond (visible in ff) and show the >>, though may have avoided this by using ' » ' can't be sure.
'without BOM' is important: http://drupal.org/node/1424

so a long search for a fix, and i needed some help, but this snippet eventually worked well in this case. thanks!

working example

peter2342’s picture

Go to breadcrumbs module and change it . 3 second :) . joomla 1.5x

hollyfox’s picture

I know this is an old thread, but someone might be searching for a way to do this simply. If you do not want to add yet another module and would like to change the home link in breadcrumbs in D7, the following snippet which uses hook_menu_breadcrumb_alter added to one of your modules should do the trick:

function yourmodule_menu_breadcrumb_alter(&$active_trail, $item){
$active_trail[0]['title'] = 'Your Title';
$active_trail[0]['href'] = 'path to your page';
}

Happy Drupaling!

Hollye Merton
Application Software Specialist

trgreen17’s picture

This worked perfectly. Thanks hollyfox!

Aporie’s picture

Thanks, exactly what I was looking for.