2

How do I remove ">>" from the breadcrumbs?

I need to remove those characters because in my site, the breadcrumbs appear like in the following screenshot.

screenshot

This is the code that generates the breadcrumbs.

$temp = "</a>" . $title . "</a></div>"; 
$breadcrumb = str_replace("</a></div>", $temp, $breadcrumb); 
print($breadcrumb);
1
  • It seems a strange way to generate breadcrumbs.
    – apaderno
    Commented Jun 17, 2012 at 14:06

2 Answers 2

2

You can override theme_breadcrumb() function in your theme. As mentioned in the below code.

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

  if (!empty($breadcrumb)) {
    // Provide a navigational heading to give context for breadcrumb links to
    // screen-reader users. Make the heading invisible with .element-invisible.
    $output = '<h2 class="element-invisible">' . t('You are here') . '</h2>';

    $output .= '<div class="breadcrumb">' . implode(' » ', $breadcrumb) . '</div>';
    return $output;
  }
}

Just write above code in your template.php and change >> to whatever you want.

5
  • I edit the "page.tpl.php" located in "sites / all / themes / Bartik / templates" Here's the content that generates brudcrumb <code><!-- /.section, /#breadcrumb --> <?php if ($breadcrumb): ?> <div id="breadcrumb"> <?php $temp = "</a>" . $title . "</a></div>"; $breadcrumb = str_replace("</a></div>", $temp, $breadcrumb); print($breadcrumb); ?> </div><div class="clearfix"></div><code> it does not work, I have not succeeded in obtain a result. thank you for more details please. I use drupal 7
    – Honline
    Commented Jun 16, 2012 at 19:49
  • @Honline - Your code is NOT the same as the answer code. Please try again using the code in the answer provided.
    – Chapabu
    Commented Jun 17, 2012 at 0:10
  • i try with the code in the answer. it does not work, the breadcrumb disapear :(
    – Honline
    Commented Jun 17, 2012 at 8:37
  • In your template.php file, not in your page.tpl.php? Don't forget you'll need to clear your theme registry (cache) for the changes to take effect.
    – Chapabu
    Commented Jun 17, 2012 at 9:04
  • @Honline Did you replace yourthemename with the name of your theme?
    – apaderno
    Commented Jun 20, 2012 at 5:34
0

You can fully customize how you'd like to have your breadcrumps, see http://api.drupal.org/api/drupal/includes!theme.inc/function/theme_breadcrumb/7

1
  • thank you for your response, I did not find how to do it since. I am not an expert in drupal7. I only want to remove the ">>" and thank you for your help :)
    – Honline
    Commented Jun 16, 2012 at 16:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.