Breadcrumbs function for WordPress
function the_breadcrumb($current_post, $seperator = ' > ', $display_home = false, $add_current_page_to_breadcrumbs = true)
{
echo '<ul class="breadcrumbs">';
if($display_home) {
echo '<li>';
echo '<a href="'.get_bloginfo('url').'" title="">'.get_bloginfo('name').$seperator.'</a>';
echo '</li>';
}
$parent_id = $current_post->post_parent;
$breadcrumbs = array();
while ($parent_id)
{
$page = get_page($parent_id);
array_push($breadcrumbs, '<li><a href="'.get_permalink($page->ID).'" title="">'.get_the_title($page->ID).$seperator.'</a></li>');
$parent_id = $page->post_parent;
}
if($add_current_page_to_breadcrumbs)
{
array_push($breadcrumbs, '<li>'.get_the_title().'</li>');
}
foreach ($breadcrumbs as $breadcrumb)
{
echo $breadcrumb;
}
echo '</ul>';
}