hi there,

I have a little question that i am facing a little problem in my theme breadcrumbs and dont know how to resolve this issue

actually the breadcrumbs is not seprating the main and primary category it should be work like

Home > Main Category > Parent Category > Parent Sub Category > Sample Post title

but its showing me like this

Home> MainCategory Parent Category Parent Sub Vategory> Sample post title

please help me to resolve this issue

here is my breadcrumbers code

/* ---------------------------------------------------------------------------

* Breadcrumbs

* --------------------------------------------------------------------------- */

function doover_breadcrumbs() {

    global $post;

    $home = __('Home','doover');

    $homeLink = home_url();

    echo '<ul class="breadcrumbs">';

    echo '<li class="home">' . __('You are here:','doover') . '</li>';

    echo '<li><a href="' . $homeLink . '">' . $home . '</a></li>';

    // Blog Category

    if ( is_category() ) {

        echo '<li class="last"><a href="'. curPageURL() .'">' . __('Archive by category','doover').' "' . single_cat_title('', false) . '"</a></li>';

    // Blog Day

    } elseif ( is_day() ) {

        echo '<li><a href="'. get_year_link(get_the_time('Y')) . '">'. get_the_time('Y') .'</a></li>';

        echo '<li><a href="'. get_month_link(get_the_time('Y'),get_the_time('m')) .'">'. get_the_time('F') .'</a></li>';

        echo '<li class="last"><a href="'. curPageURL() .'">'. get_the_time('d') .'</a></li>';

    // Blog Month

    } elseif ( is_month() ) {

        echo '<li><a href="' . get_year_link(get_the_time('Y')) . '">' . get_the_time('Y') . '</a></li>';

        echo '<li class="last"><a href="'. curPageURL() .'">'. get_the_time('F') .'</a></li>';

    // Blog Year

    } elseif ( is_year() ) {

        echo '<li class="last"><a href="'. curPageURL() .'">'. get_the_time('Y') .'</a></li>';

    // Single Post

    } elseif ( is_single() && !is_attachment() ) {



        // Custom post type

        if ( get_post_type() != 'post' ) {

            $post_type = get_post_type_object(get_post_type());

            $slug = $post_type->rewrite;



            if( $slug['slug'] == doover_get_option( 'portfolio_item_slug', 'portfolio-item', true ) && $portfolio_page_id = doover_get_option( 'portfolio_page' ) )

            {

                echo '<li><a href="' . get_page_link( $portfolio_page_id ) . '">'. get_the_title( $portfolio_page_id ) .'</a></li>';

            } else {

                echo '<li><a href="' . $homeLink . '/' . $slug['slug'] . '/">' . $post_type->labels->singular_name . '</a></li>';

            }

            echo '<li class="last"><a href="' . curPageURL() . '">'. wp_title( '',false ) .'</a></li>';



        // Blog post   

        } else {

            $cat = get_the_category();

            $cat = $cat[0];

            echo '<li>';

            echo get_category_parents($cat, TRUE, '');

            echo '</li>';

            echo '<li class="last"><a href="' . curPageURL() . '">'. wp_title( '',false ) .'</a></li>';

        }

    // Taxonomy

    } elseif( get_post_taxonomies() ) {

        $post_type = get_post_type_object(get_post_type());

        if( $post_type->name == 'portfolio' && $portfolio_page_id = doover_get_option( 'portfolio_page' ) ) {

            echo '<li><a href="' . get_page_link( $portfolio_page_id ) . '">'. get_the_title( $portfolio_page_id ) .'</a></li>';

        }

        echo '<li class="last"><a href="' . curPageURL() . '">'. wp_title( '',false ) .'</a></li>';

    // Page with parent

    } elseif ( is_page() && $post->post_parent ) {

        $parent_id  = $post->post_parent;

        $breadcrumbs = array();

        while ($parent_id) {

            $page = get_page($parent_id);

            $breadcrumbs[] = '<li><a href="' . get_permalink($page->ID) . '">' . get_the_title($page->ID) . '</a></li>';

            $parent_id  = $page->post_parent;

        }

        $breadcrumbs = array_reverse($breadcrumbs);

        foreach ($breadcrumbs as $crumb) echo $crumb;



        echo '<li class="last"><a href="' . curPageURL() . '">'. get_the_title() .'</a></li>';

    // Default

    } else {

        echo '<li class="last"><a href="' . curPageURL() . '">'. get_the_title() .'</a></li>';

    }

    echo '</ul>';

}

Hmm, are you saying that you problem is, you're not seeing the ">" separate the breadcrumbs?

yes but in main and parent category

I'm not even seeing anywhere in this code where a ">" would be added to the values before they get added to array $breadcrumbs. It could be another piece of code somewhere that handles that or possibly it is getting added with CSS, or some other method.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.