While searching the WordPress forums for the answer to another problem, I stumbled upon this script that places a breadcrumb navigation trail into your WordPress theme template.
It’s easy to use and works like a charm. It would have taken me hours and hours to figure out how to do this myself, so I am glad it was available to me without having to reinvent the wheel. I hope you can put it to use, too.
<div id="breadcrumbs">;
<span>You are here: </span>
<a href="<?php echo get_bloginfo('url'); ?>" title="">Home</a>
<?php
$parent_id = $post->post_parent;
$breadcrumbs = array();
while ($parent_id) {
$page = get_page($parent_id);
$breadcrumbs[] = '<a href="'.get_permalink($page->ID).'" title="">'.get_the_title($page->ID).</a>';
$parent_id = $page->post_parent;
}
$breadcrumbs = array_reverse($breadcrumbs);
foreach ($breadcrumbs as $crumb) echo ' » '.$crumb;
?>
<span> » <?php the_title(); ?></span>
</div>
[eof]