Breadcrumbs – Exclude Child Categories

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!

Read More

Can anyone help?

Related posts

Leave a Reply

1 comment