I am using this code in my functions.php file to display breadcrumbs on my web site..
function the_breadcrumb() {
if (!is_home()) {
echo '<a href="';
echo get_option('home');
echo '">';
echo 'Home';
echo "</a> û ";
if (is_category() || is_single()) {
the_category('title_li=');
if (is_single()) {
echo " û ";
the_title();
}
} elseif (is_page()) {
echo the_title();
}
}
}
I would like to know how to modify this so that only Parent categories are displayed? I have lots of posts that are assigned to multiple sub categories so the breadcrumb trail can get huge!
Can anyone help?
Here’s a suggestion: Yoast’s SEO plugin is practically a must for a WordPress site, and has a breadcrumb implementation baked in.