3

I would like to disable breadcrumbs on my home page and I don't know of any easy way to do this so I was going to just display:none the breadcrumbs class.

Suggestions welcome, thank you!

13

Assuming you are using D7. There are a number ways to achieve it. I am providing three methods here.

Contributed module. The easiest one is to use "Disable Breadcrumbs" module.

Theme Overide. If you think it is overkill, don't want to use that module, you can also implement the preprocess html hook to remove breadcrumb like this:

/**
 * Implements template_preprocess_html()
 */
function THEMENAME_preprocess_html(&$variables) {
  if ($variables['is_front']) {
    // kill breadcrumb, set to empty array
    drupal_set_breadcrumb(array());
  }
}

Custom Module. You can also done this in your custom module by implementing hook_page_alter

/**
 * Implements hook_page_alter().
 */
function MODULENAME_page_alter(&$page) {
  if (in_array('front', $page['#theme_wrappers'])) {
    // kill breadcrumb, set to empty array
    drupal_set_breadcrumb(array());
  }
}
6

You add a page-front.tpl.php to your theme (duplicating page.tpl.php) and than remove codes that prints breadcrumbrs. Or, in page.tpl.php, add some "if conditions" to display breadcrumbs everywehre except homepage.

3

Well you can target front-page elements specifically by using the .front css class, which is added to the body by almost all Drupal themes. If you have the element in a block, you can also control its visibility by setting it visible to everything but the <front> token.

I'm sure there's a programmatic way to solve this question better, however, with this solution you won't have to delve in the code.

0

The good way to do it: themes/YOURTHEME/template.php

function YOURTHEME_breadcrumb($variables){
    if(drupal_is_front_page()){
        return false;
    }
}
0

I used for fix the problem the hook_page_alter.

In my case, i hould disable breadcrumb for specific page according path

function mymodule_home_page_alter(&$page) {
  if(current_path() == "my_url_path"){
    drupal_set_breadcrumb(array());
  }
}
0

I usually hide it with CSS.

.breadcrumb {
    display: none;
}

Works great for me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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