0

I am experiencing problems with breadcrumb trails inconsistently not displaying correctly. I am using the core breadcrumb module, without any others installed. (I did have Custom Breadcrumbs installed but have since uninstalled and removed it.)

I have links to nodes nested in parent items in the main menu like this: Home > Chapter > Topic > Subtopic. Most nodes are displaying the breadcrumbs like that, which is what I want. However, a few are displaying like this: Home > Subtopic (not showing the chapter and topic under which they are listed)

I believe I started getting this error when I changed the numerical weight of the menu items in structure > menu. I have since changed their depth, changed their parent menu item, flushed caches, nothing has worked. It is only a few nodes with the problem and they were originally working as expected. I cannot recreate this problem either. If I create new nodes they show the proper breadcrumb trail. The items in question are all as they should be in weight and parent menu item position they should be. If I install Custom Breadcrumbs I can force the breadcrumb trail to the desired state. Is there a table that I can flush in the database that will fix this problem? Is there a way to fix this without deleting the node and recreating it?

Edit: I found the problem. I have links to these nodes in two different menus on the same page. Drupal is using the other menu I created instead of the Main-Menu to make the breadcrumb trail.

2 Answers 2

1

It looks you need to fix the breadcrumbs for a particular contentHere is my idea.

  • In your theme, in template.php implement theme_breadcrumns(), as below
  • Inside the theme_breadcrumbs() implementation check type of node using

menu_get_object()

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

// Lets assume your content type name is chapter
  $node = menu_get_object();
  $node_type = $node->type; 
  if($store == "chapter") {
     $links[0] =  l(t('Home'), '<front>');
     $links[1] =  t('Chapter');
     $links[2] =  t('Topic');
     $links[3] =  t($node->title); // Considering Sub topic as node title
     drupal_set_breadcrumb($links); 
  }
1
  • Thanks for the response. I found a solution with just a module. The problem was that I had two links to these nodes in two different menus on the same page. Drupal was using the other menu I created instead of the Main-Menu to make the breadcrumb trail.
    – xturgorex
    Commented Sep 8, 2013 at 1:16
0

The problem is having multiple menus with the node's links on the node's page at the same time. Instead of using the main-menu, Drupal is using the other menu you have created, which has no parent-items. You need to override it's default function.

  1. Install Menu Breadcrumb
  2. Go to admin/config/user-interface/menu-breadcrumb
  3. Re-order the list to reflect the priority in which you want to be used for the breadcrumb trail
    AND/OR
    Deselect the menus you do not want to use for the Breadcrumb trail

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.