Search code examples
wordpresswordpress-themingbreadcrumbs

wordpress breadcrumbs bug "giving styling class to some page and not giving it to other"


i am using Rana theme in WordPress and i face a bug with breadcrumbs in some pages it works perfectly and other it works but with a style bug working breadcrumbs style bug breadcrumbs

ps: while using inspect it seems to give styling class to the working one and doesn't give the styling class to non working one

i searched every breadcrumb setting and search all over the web but i didn't find a clue about what is happening


Solution

  • i just fixed this by editing the theme breadcrumbs code it was missing the url line in the breadcrumbs array

    else if ( is_tax('ranna_recipe_category') ){
                
                $terms = get_the_terms( get_the_ID(), 'ranna_recipe_category');
                echo "<script>console.log('" . json_encode($terms) . "');</script>";
                
                                         
                if ( $terms && ! is_wp_error( $terms ) ){
                 
                    $draught_links = array();
                    echo "<script>console.log('" . json_encode($draught_links) . "');</script>";
                    
                    foreach ( $terms as $term ) {
                        $breadcrumbs[] = array(
                           //Adding this line solve th problem
                            'url'  => $home_url .  $term->slug,
    
                            'name' => $term->name,
                        );
                    } 
                }
            }