简体   繁体   English

wordpress 面包屑错误“将样式 class 提供给某些页面而不将其提供给其他页面”

[英]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我在 WordPress 中使用 Rana 主题,我在某些页面中遇到面包屑错误,它工作得很好,而其他页面工作正常,但有一个样式错误工作面包屑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 ps:在使用 inspect 时,它似乎将样式 class 赋予工作的样式,而不会将样式 class 赋予非工作的样式

i searched every breadcrumb setting and search all over the web but i didn't find a clue about what is happening我搜索了每个面包屑设置并搜索了整个 web 但我没有找到关于正在发生的事情的线索

i just fixed this by editing the theme breadcrumbs code it was missing the url line in the breadcrumbs array我只是通过编辑主题面包屑代码来解决这个问题,它缺少面包屑数组中的 url 行

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,
                    );
                } 
            }
        }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM