i tried to search on this but i couldn't really find what i'm looking for..

Lets say i have "section" page.. Let's call it "About Us"

When you click on that page.. i think it looks kind of dumb to have a breadcrumb that simply says:

Home

Now if you click on a page/node underneath "About Us", lets say "History", the breadcrumb now looks like:

Home > About Us

That's Looks better to me and makes more sense... (although i probably wouldn't mind getting rid of the Home here as well)..

Is there anyway to either:

1) globally remove 'Home" from ALL breadcrumbs
2) specifically remove 'Home' on breadcrumbs of certain pages

And as a side question:

3) Is there any way to include the current page/node being viewed as the last "crumb" in the breadcrumb traill?

I'm no expert on breadcrumbs but it kind of makes sense to me to do it this way.

FWIW.. i'm using category module and category menu. This may have an effect on my breadcrumbs are being displayed and or how they can be configured or themed

thanks in advance

Comments

vm’s picture

look into the advanced_menu.module which allows you to extend the breadcrumbs to be this way Home > About Us

to remove home from the breadcrumb trail may take some theme override.

rickycmiddaugh’s picture

Hi there-

Though I can't help you get rid of home on all the pages, I can at least take it off the main page for you.

Go to your page.tpl.php file, and find the line:

<?php if ($breadcrumb): print $breadcrumb ?><?php endif; ?>

Edit this line to instead be:

<?php if ($breadcrumb && $title != "What you called your home page"): print $breadcrumb ?><?php endif; ?>

Hope that helps.

tonyn’s picture

Edit: You can check out my article at: http://sensiblysecular.com/drupal/hiding_home_link_in_breadcrumb/

If your using PHPTemplate, here is some stuff you can try...

A crack at the breadcrumbs, in-template statement

Inside: page.tpl.php in your theme folder

Find (if exists):

 	if (isset($breadcrumb)) {
			// delete this whole if structure, including its inner statements.
		}	

or Find:
print $breadcrumb

Replace with:

 if ($breadcrumb && (strstr($breadcrumb," &raquo; ") || strstr($breadcrumb," » "))): 
	print $breadcrumb; endif; 

If $breadcrumb on a page returns one of these examples:

home

anything

The $breadcrumb will not print.

If $breadcrumb on a page returns one of these examples:

home »

home » hahaha

anything » moo

»

The $breadcrumb will show. The first and last are likely to occur with phptemplate_breadcrumb($breadcrumb) is overridden or a module interfering with breadcrumbs. Back in real life, drupal setup's often include many modules which may trigger this extraneous result. So we look for a fix.

A cooler way

Inside: template.php in your theme folder
I have made a function override for phptemplate_breadcrumb($breadcrumb). This override grants some flexibility, and best of all you can stick keep your old print $breadcrumb function call in page.tpl.php. Inside your theme's directory find template.php (if it isn't there, create it.) Paste this function in:

/*
	phptemplate_breadcrumb($breadcrumb) override
	File: template.php
	Use: Hide breadcrumb trails with only 1 crumb, regardless of crumb name ("home" is)
		a popular single-crumb that people like to have removed in some templates.
	Through: PHPTemplate function override
	Benefits: Does not involve extra code in separate view. 
*/
function phptemplate_breadcrumb($breadcrumb) {
	$home = variable_get('site_name', 'drupal');
	$sep = ' &raquo; ';
	// Check if breadcrumb has more than 1 element.
	// Options: Change to the number of elements/crumbs a breadcrumb needs to be visible.
	if (count($breadcrumb) > 1) {
		$breadcrumb[0] = l(t($home), '');
		/*
			Optional: Include page title in breadcrumb.
		
			drupal_get_title() !== ''
				Check if title blank, if that is the case, we cannot include trailing page name.
			strstr(end($breadcrumb),drupal_get_title()) == FALSE
				Some modules will make it so path or breadcrumb will involve duplication of 
				title and node name (such as in the Events module) to remove this, simply 
				take out  && strstr(end($breadcrumb),drupal_get_title()) == FALSE 
			
			Use: Simply uncomment the if structure below (3 lines).
			Special Use: If you wish to use this regardless of elements/crumbs in a breadcrumb
				simply cut/paste the statements inside the "if (count($breadcrumb) > 1)" outside
				of the structure, and delete the extranneous structure. 
	
			if ( (drupal_get_title() !== '') && (strstr(end($breadcrumb),drupal_get_title()) ) == FALSE) {
				$breadcrumb[] = t(drupal_get_title(), '');
			}
		*/	
		return implode($sep, $breadcrumb);
	} else {
		// Would only show a single element/crumb (or none), so return nothing.
		// You can remove this statement.
	}
}

Remember, this function override is not meant to be coupled with the first example in page.tpl.php
print $breadcrumb
to call your breadcrumbs.

idcm’s picture

I am rebuilding off-line from 4.6 to 6.6. I plugged this into the Marinelli theme and it seems to work. Thanks for sharing!

eugsadhu’s picture

function phptemplate_breadcrumb($breadcrumb) {
  if (!empty($breadcrumb) && count($breadcrumb)>1) {
    return '<div class="breadcrumb">'. implode(' &#187; ', $breadcrumb) .'</div>';
  }
}
czeky’s picture

is there a way to hide "home" completely on every page?

thanx

lanjingyu’s picture

There is a way for your requirement:

function phptemplate_breadcrumb($breadcrumb) {
array_shift($breadcrumb);
if (!empty($breadcrumb)) {
return '

';
}
}

ecologuy’s picture

I used this in template.php for the site theme, just copied and pasted at the bottom, and it worked for me - after I cleared the site's cache. This turns it off everywhere which is what I wanted.

ipwa’s picture

this worked really good for me, except that now all breadcrumbs have "?" rather than ">>" can anyone help?

Nicolas
-------------------------

globefox’s picture

This often happens when cutting and pasting code via a broswer. Re-type the '>' in a plain text editor or look up the ASCI code for the character you'd like to use. This should fix this for you.

ipwa’s picture

...but better late than never, thanks!

Nicolas
-------------------------

jriddiough@gmail.com’s picture

I used this in the template.php file to remove whatever the "first" item in the breadcrumb is. Hope it helps

/**
 * Return a themed breadcrumb trail.
 *
 * @param $breadcrumb
 *   An array containing the breadcrumb links.
 * @return a string containing the breadcrumb output.
*/ 
function phptemplate_breadcrumb($breadcrumb) {
	unset($breadcrumb[0]);
	array_unshift($breadcrumb, array_shift($breadcrumb) );

	return '<div class="breadcrumb">'. implode(' &raquo; ', $breadcrumb) .'</div>';
}
druvision’s picture

This is what worked for me, on Drupal 5.

/*
 * Only display breadcrumbs for nodes. 
 * Node breadcrumb display is further customized with the custom breadcrumbs module
 * Hide breadcrumbs for 'biz' type nodes.
 * Hide breadcrumbs on views or other non-node pages.
 * Home link is modified to display the site name.
 */
function phptemplate_breadcrumb($breadcrumb) {
  if (arg(0) == 'node' && is_numeric(arg(1)) ) {
    $result = db_query("SELECT nid, type FROM {node} WHERE nid= %s", arg(1));
    if ($result) { // This is a node. 
      $node = db_fetch_object($result);
      if ($node->type != 'biz') {
        /* Replace the first breadcrumb element (ususlly 'home') with the site name */ 
        $home = variable_get('site_name', 'drupal');
        $breadcrumb[0] = l(t($home), '');
        /* Add the breadcrumb returned by the 'custom breadcrumb' module. . */
        return theme_breadcrumb($breadcrumb);
      }
    } else {
      // Don't show breadcrumbs for non-node elements (e.g. for views).
      return '';
    }
  }
}

Amnon

KrisBulman’s picture

have an update for that on drupal 5.9?

vm’s picture

what errors are you getting that don't allow it to work on 5.9 ?

leetamus’s picture

thanks for that, it works perfectly for me ;)

Rob T’s picture

This solution a few posts above works for me in 6.3.

pushdesign’s picture

This solution worked, but on pages like 'About' you would lose the breadcrumb simply because it was first. I only needed the 'Home' to be removed to this is what worked for me.

function phptemplate_breadcrumb($breadcrumb) {
  if (!empty($breadcrumb)) {
    // add the current page title to the breadcrumb
	if (drupal_get_title()!='Home'){
    	$breadcrumb[] = '<span class="active">'. drupal_get_title() .'</span>';
		if ($breadcrumb[0]='Home'){
			unset($breadcrumb[0]);
			array_unshift($breadcrumb, array_shift($breadcrumb) );
			return '<div class="breadcrumb">'. implode(' / ', $breadcrumb) .'</div>';
		}else {
    			return '<div class="breadcrumb">'. implode(' / ', $breadcrumb) .'</div>';
		}
	}
  }
}
d3zign7reak’s picture

The above solution worked for me on a Drupal 6.13 installation.

agileware’s picture

Why not just:?

/**
 * Return a themed breadcrumb trail.
 *
 * @param $breadcrumb
 *   An array containing the breadcrumb links.
 * @return a string containing the breadcrumb output.
 */
function phptemplate_breadcrumb($breadcrumb) {
  array_shift($breadcrumb);
  return '<div class="breadcrumb">'. implode(' &raquo; ', $breadcrumb) .'</div>';
}

Agileware are a team of local Drupal developers in Australia, https://agileware.com.au
Agileware support and host Drupal, CiviCRM and WordPress websites.
Contact Agileware today at https://agileware.com.au/contact

jcipriani’s picture

Thanks, jriddiough. Worked perfectly.

Wolfflow’s picture

Hi @jriddiough this worked fine in Drupal 6.16, Many Thanks!

Contact me for drupal projects in English, German, Italian, Drupal Hosting Support.

teejaydub’s picture

For those finding this by searching, as I did - Note that http://drupal.org/project/menu_breadcrumb does this now with no (extra) code.

Marko B’s picture

no it doesn not do what ppl were asking for, just part of it.

ruess’s picture

Actually this solution above really helped me. Thank you!

Taxoman’s picture

WeRockYourWeb.com’s picture

Hi jriddiough - your solution (removing only the "home" link in the breadcrumb) is just what I was looking for and works like a charm - thanks!

letsnurture’s picture

Hye jriddiough,

I'm newbie to the drupal and I have been playing with the drupal for few couple of week. Before that I worked with Zend-Framework,Oscommerce,Moodle-online course management system.

Today, I created some nodes of type 'page' to taste the drupal CMS and I found that when browser renders those page, it also presents the 'Home'-root of the drupal breadcrumb.And it looks awkward as it appears top of the each page.

So all of sudden, I deleted the $breadcrumb from the page.tpl.page but then I got a question what if some page needs to have breadcrumb.So this is not the good practice ever.

So finally, I reached here and grabbed this place and now everything goes well.

Thanks for leading to the end of the tunnel and to lighten the lamp to eliminate the darkness

dbeall’s picture

I have tried everything i can find on these breadcrumbs.. nothing works to remove the single 'home' link. Is this some kind of bug that needs to be filed someplace? Maybe there is a way to tell custom breadcrumbs to NOT display by content type? I have tried the php visible false thing , and that don't work either... maybe we are just suppose to not use any breadcrumbs at all..........In fact, none of the php code in this tread seems to work either. I don't get it...drupal is suppose to be ahead of it's time, maybe the breadcrumbs are from the past...don't know

MGN’s picture

Is there anyway to either:

1) globally remove 'Home" from ALL breadcrumbs
2) specifically remove 'Home' on breadcrumbs of certain pages

And as a side question:

3) Is there any way to include the current page/node being viewed as the last "crumb" in the breadcrumb trail?

This is now possible in the 6.x-2.x-dev version of custom_breadcrumbs

There is a global configuration for setting the text of the Home breadcrumb, and you can also just eliminate it. To add it back in on some pages, node-types, views, taxonomy-pages, or at specific paths, you'll just add Home (or whatever text you want) as the first title in the breadcrumb.

For the title of the page (node) being viewed, just use the [title] token (provided by the Token module).

This version is still in development, but ready for testing.

vthirteen’s picture

that sounds great but it just doesn't work for me.
see my post in the custom breadrcrumbs issue queue at http://drupal.org/node/407052#comment-1892310

the php function from the above post http://drupal.org/node/103174#comment-1756386 (thank you!) is what i used not to print the "Home" crumb by default.

vthirteen’s picture

MGN's reply here http://drupal.org/node/407052#comment-1893964 actually solved the problem with and within custom breadcrumbs module.

dbeall’s picture

I have switched to the dev version of custom breadcrumbs and it's really great. All my issues with breadcrumbs seem to be solved now, life is good..

zubairahmed_123’s picture

There is one more way of doing this. I suppose u want to hide the Home link from your web-page.
This can be done via CSS. where u can set the display property as None. (display:none).

mattcasey’s picture

This is Drupal 6, but similar issue. Views was insistently tacking on its own breadcrumb to my Custom Breadcrumbs trail (may be because CB is still dev version?), so I added this function to template.php to remove any specific string:

function phptemplate_breadcrumb($breadcrumb) {
  if (!empty($breadcrumb)) {
	  $badString = '<a href="/products/taxonomy/term/all">Our Products</a>'; // Delete the breadcrumb from Views 
	  $badKey = array_search($badString, $breadcrumb);
	  if ($badKey) { unset($breadcrumb[$badKey]); } 
		return '<div class="breadcrumb">'. implode(' › ', $breadcrumb) .'</div>';
  }
}
mmilano’s picture

function phptemplate_breadcrumb($variables) {
  $breadcrumb = $variables['breadcrumb'];
  if (!empty($breadcrumb)) {
    array_shift($breadcrumb);
    return '<div class="breadcrumb">' . implode(' » ', $breadcrumb) . '</div>';
  }
}
Deepika.chavan’s picture

Hi Mike Milano,
Thanks. In the above code I just replaced 'phptemplate' with my 'themename'.(according to this) and it works. Again thanks for the code.

Rgrds,
Deepika.

pwhite’s picture

If you just want to hide the home link the following will work in Drupal 7:

function phptemplate_breadcrumb($variables) {
  $breadcrumb = $variables['breadcrumb'];

if (!empty($breadcrumb) && count($breadcrumb)>1) { //edited to hide just home
    return '<div class="breadcrumb">'. implode(' › ', $breadcrumb) .'</div>';
  }
}

Change phptemplate to your themes name.

brainHax’s picture

<?php
function albir_breadcrumb($variables) {
  $sep = ' <span class="bcarrows"> » </span> ';
 if (!empty($variables['breadcrumb'])) {
	array_shift($variables['breadcrumb']);
 if (count($variables['breadcrumb']) > 0) {
	return implode($sep, $variables['breadcrumb']) . $sep;
  } 
 }
  else {
    return t("الصفحة الرئيسية");
  }
}
?>
rogical’s picture

Custom breadcrumbs 2.x is very powerful, a series ofsub-modules help to to custom any styles and also remove the 'Home' link.

Drupal Solution Architect

annahelin’s picture

Where do you put the code in D7?

I tried to put it in template.php but i get a syntax error. That's why I assume that I should put it somewhere else :)

/Anna

vm’s picture

which code did you use? there are multiple snippets through out this thread?

if from http://drupal.org/node/103174#comment-4807468 , it does go in template.php however, I'd change the function name from phptemplate to yourthemename

annahelin’s picture

Yes, I used the one you linked to. I changed the name aswell, but it still does not work. I get a syntax error for the < that starts the code.

vm’s picture

did you remove the opening and closing php tags? they aren't needed in template.php. They are included in the comment to trigger the code filter.

annahelin’s picture

No I didn't (wasn't aware of that).

Tried the code again, and removed the <? in the top and bottom.

The error message is gone, but the code is not working. I cleared the cache, but nothing happend.

nitse’s picture

Same problem here. I renamed the phptemplate with my theme's name but nothing happened.
I removed the php tags and it doesn't recognize it as php code..

Any advice?

vm’s picture

it is imperative to understand which version of drupal is in use to know whether or not you are using the correct code. It is also imperative to understand which code you are actually using.

if D7 see: http://api.drupal.org/api/drupal/includes--theme.inc/function/theme_brea... for the correct function and manipulate as needed.

carsonw’s picture

function blue_menu_breadcrumb_alter(&$active_trail, $item) {
	// If there are no more than 1 items displaying in the breadcrumb trail, hide breadcrumbs altogether.
	if (!isset($active_trail['2'])) {
		drupal_add_css('#breadcrumbs {display:none;}', $option['type'] = 'inline');
	}
}
Taxoman’s picture

gabrielZ’s picture

If you have path breadcrumbs module installed. Go to structure > Path breadcrumbs > path breadcrumbs settings, then check the "Hide breadcrumbs navigation for single breadcrumb", save configuration, refresh page. Done.