Custom Breadcrumbs for Blog Pages in Drupal 6

I recently had a problem with the breadcrumbs for blog pages in Drupal 6.  The format was:

Home > Blog > User > Page title

After a bit of searching around and a chat with an expert Drupal 6 developer the simplest way was to override the default breadcrumb rendering in the template.php file.

I was using a sub-theme of Zen so I just copied the function from Zens template.php and modified it to meet my theme's requirement.  So the function would look something like this:

<?php
function mytheme_breadcrumb($breadcrumb) {
 
// Determine if we are to display the breadcrumb.
 
$show_breadcrumb = theme_get_setting('zen_breadcrumb');
  if (
$show_breadcrumb == 'yes' || $show_breadcrumb == 'admin' && arg(0) == 'admin') {
   
// Optionally get rid of the homepage link.
   
$show_breadcrumb_home = theme_get_setting('zen_breadcrumb_home');
    if (!
$show_breadcrumb_home) {
     
array_shift($breadcrumb);
    }

   
// Return the breadcrumb with separators.
   
if (!empty($breadcrumb)) {
      if (
$breadcrumb[1] == l('Blogs',t('blog'))){  // For blog nodes...
        //unset($breadcrumb[2]);                      // ...remove "user's blog"...
       
unset($breadcrumb[1]);                      // ...and "blogs".
       
$breadcrumb[2] = l('SEO Software Blog','blogs');
      }

     
$breadcrumb_separator = theme_get_setting('zen_breadcrumb_separator');
     
$trailing_separator = $title = '';
      if (
theme_get_setting('zen_breadcrumb_title')) {
        if (
$title = drupal_get_title()) {
         
$trailing_separator = $breadcrumb_separator;
        }
      }
      elseif (
theme_get_setting('zen_breadcrumb_trailing')) {
       
$trailing_separator = $breadcrumb_separator;
      }

      if(
strtolower($title) == 'blog' || strtolower($title) == 'blogs') {
       
$title = 'SEO Software Blog';
      }
      return
'<div class="breadcrumb">' . implode($breadcrumb_separator, $breadcrumb) . "$trailing_separator$title</div>";
    }
  }

 
// Otherwise, return an empty string.
 
return '';
}
?>