Php WordPress-面包屑导航与分类问题
我对这个插件有一些主要问题 我有这个布局到我的网站。在我的functions.php文件中,我使用以下代码在“产品”中创建了一些新类别:Php WordPress-面包屑导航与分类问题,php,jquery,wordpress,breadcrumbs,Php,Jquery,Wordpress,Breadcrumbs,我对这个插件有一些主要问题 我有这个布局到我的网站。在我的functions.php文件中,我使用以下代码在“产品”中创建了一些新类别: add_action( 'init', 'create_product_cat_scaffolding' ); function create_product_cat_scaffolding() { register_taxonomy( 'ScaffoldingProducts', '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,
)
);
}
这将创建以下内容:
从这里开始,我向其中每一项添加了子类别,例如:
然后当我创建产品时,我只选择它们应用于哪个子类别
现在-我的问题。当我点击我的安全页面时,插件工作正常,它如下所示:
我的网站>安全
但是,如果我单击“安全”中的子类别,例如“安全”类别,而不是面包屑,则会:
我的网站>安全>安全类别
去
我的网站>安全
有人有什么想法吗
在插件中,设置中有一个分类选项,显示如下:
<span typeof="v:Breadcrumb"><a rel="v:url" property="v:title" title="Go to the %title% Safety archives." href="%link%">%htitle%</a></span>
在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);
}
遵循以下步骤
go to Setting > Permalinks > Select Custom Structure
add this into textbox /%category%/postname
希望这将有助于或,如能提供适合我需要的替代方案,将不胜感激!面包屑可能在去年的搜索引擎优化?您是否已在主题中创建自定义类别页面?喜欢
taxonomy ScaffoldingProducts.php
,taxonomy Safety.php
,taxonomy FencingHoardings.php
,taxonomy Access.php
,ScaffoldingProducts.php
,Safety.php
,FencingHoardings.php
,Groundworks.php
和Access.php
allHi Hemal,我有它们的分类页面:)有人吗?这有100多个视图像这样吗?if(count($this->breadcrumbs)>0){//Exit early,因为我们在跟踪中有breadcrumbs,返回NULL;}else if(is_archive()){$type=$wp_query->get_queryed_object();//对于基于日期的存档,if(is_date()){$this->do_archive_by_date()}else if(is_post_type_archive()&!isset($type->分类法)){$this->do_archive_by_post_type()}//对于基于分类法的存档,如果(is_category()| is_tag()| | is_tax()){$this->do_archive_by_term()}$this->type_archive($type)}如果我在家-类别,并单击子类别,它就会返回家-子类别-子类别-子类别