首页 文章

WordPress - 带有类别的Breadcrumb NavXT问题

提问于
浏览
12

我对这个插件有一些重大问题

https://wordpress.org/plugins/breadcrumb-navxt/installation/

我有这个布局到我的网站 . 在我的functions.php文件中,我使用以下代码在'Products'中创建了一些新类别:

add_action( 'init', 'create_product_cat_scaffolding' );

function create_product_cat_scaffolding() {
    register_taxonomy(
        'ScaffoldingProducts',
        'products',
        array(
            'label' => __( 'Scaffolding Products' ),
            'rewrite' => array( 'slug' => 'scaffoldingproducts' ),
            'hierarchical' => true,
            )
        );
}
add_action( 'init', 'create_product_cat_fencing' );

function create_product_cat_fencing() {
    register_taxonomy(
        'FencingHoardings',
        'products',
        array(
            'label' => __( 'Fencing Hoardings' ),
            'rewrite' => array( 'slug' => 'fencinghoardings' ),
            'hierarchical' => true,
            )
        );
}
add_action( 'init', 'create_product_cat_groundworks' );

function create_product_cat_groundworks() {
    register_taxonomy(
        'Groundworks',
        'products',
        array(
            'label' => __( 'Groundworks' ),
            'rewrite' => array( 'slug' => 'groundworks' ),
            'hierarchical' => true,
            )
        );
}
add_action( 'init', 'create_product_cat_Safety' );

function create_product_cat_Safety() {
    register_taxonomy(
        'Safety',
        'products',
        array(
            'label' => __( 'Safety' ),
            'rewrite' => array( 'slug' => 'safety' ),
            'hierarchical' => true,
            )
        );
}
add_action( 'init', 'create_product_cat_access' );

function create_product_cat_access() {
    register_taxonomy(
        'Access',
        'products',
        array(
            'label' => __( 'Access' ),
            'rewrite' => array( 'slug' => 'access' ),
            'hierarchical' => true,
            )
        );
}

这创建了以下内容:

enter image description here

从这里开始,我为每个子类添加了子类别,例如:

enter image description here

然后当我创建产品时,我只选择它们适用的子类别 .

现在 - 我的问题 . 当我点击我的安全页面时,插件工作正常,它会:

My Site > Safety

但是如果我点击安全性的子类别,例如安全类别,而不是面包屑去:

My Site > Safety > Safety Category

它去了

My Site > Safety

有没有人有任何想法?

在插件中,设置有Taxonomies选项,显示:

<span typeof="v:Breadcrumb"><a rel="v:url" property="v:title" title="Go to the %title% Safety archives." href="%link%">%htitle%</a></span>

2 回答

  • 1

    在fill()函数行855控制Breadcrumb-NavXT / class.bcn_breadcrumb_trail.php中发生的事情 .

    else if(is_archive())
    {
        $type = $wp_query->get_queried_object();
        //For date based archives
        if(is_date())
        {
            $this->do_archive_by_date();
        }
        else if(is_post_type_archive() && !isset($type->taxonomy))
        {
            $this->do_archive_by_post_type();
        }
        //For taxonomy based archives
        else if(is_category() || is_tag() || is_tax())
        {
            $this->do_archive_by_term();
        }
        $this->type_archive($type);
    }
    
  • 1

    跟着这些步骤

    go to Setting > Permalinks > Select Custom Structure
     add this into textbox /%category%/postname
    

    希望这会有所帮助

相关问题