Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

Here's a suggestion: Yoast's SEO plugin is practically a must for a WordPress site, and has a breadcrumb implementation baked in.

share|improve this answer
    
Good call Chris, after trying lots of different solutions none of them were as efficient as Yoasts built in functions so I have gone with that instead. –  fightstarr20 Sep 11 '12 at 14:21

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.