I'm posting this here instead of the theme list because even though this would typically be needed in a theme, it's not about theming, per se.
I struggled [way too long] today to generate a full category breadcrumb. Yes, I know, this type of thing has been asked and answered ad nauseum. The difference here is that the point at which I need the breadcrumb (eg grandparent category / parent category / category) is in a field template for a field that appears in the node display ... so long before $breadcrumb becomes available during the page render.
What I ended up with is the following. I do plan on moving the code, so no need to flame me on having it in the template. :-) I'd like to know if there's an easier way to do it ... "Oh, you could have just called blah blah" ... I promise not to cry... much.
<?php $parents = taxonomy_get_parents($variables['element']['#object']->field_product_category['und'][0]['tid']); ?> <?php $breadcrumb = drupal_get_breadcrumb(); ?> <?php foreach($parents as $parent): ?> <?php $breadcrumb[] = $parent->name; ?> <?php endforeach; ?> <?php $breadcrumb[] = $variables['element']['#object']->field_product_category['und'][0]['taxonomy_term']->name; ?> <?php print theme('breadcrumb', array('breadcrumb'=>$breadcrumb)); ?>