Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Wordpress-自定义面包屑导航_Php_Wordpress_Breadcrumbs - Fatal编程技术网

Php Wordpress-自定义面包屑导航

Php Wordpress-自定义面包屑导航,php,wordpress,breadcrumbs,Php,Wordpress,Breadcrumbs,现在我的面包屑显示为Home>Services>X-Ray,但我希望它们显示为Home>Services,有没有办法定制面包屑NavXT来实现这一点?进入/wp content/plugins/breadcrumb NavXT/class.bcn_breadcrumb\u trail.php 查找功能显示并将其替换为: public function display($return = false, $linked = true, $reverse = false) { //Set tr

现在我的面包屑显示为
Home>Services>X-Ray
,但我希望它们显示为
Home>Services
,有没有办法定制面包屑NavXT来实现这一点?

进入/wp content/plugins/breadcrumb NavXT/class.bcn_breadcrumb\u trail.php

查找功能显示并将其替换为:

public function display($return = false, $linked = true, $reverse = false)
{
    //Set trail order based on reverse flag
    $this->order($reverse);
    //Initilize the string which will hold the assembled trail
    $trail_str = '';
    $position = 1;
    //The main compiling loop
    foreach($this->breadcrumbs as $key => $breadcrumb)
    {
        //We do different things for the separator based on the breadcrumb order
        if($reverse)
        {
            //Add in the separator only if we are the 2nd or greater element
            if($key > 0)
            {
                $trail_str .= $this->opt['hseparator'];
            }
        }
        else
        {
            if($key == 0  ) continue;
            //Only show the separator when necessary
            if($key < count($this->breadcrumbs) - 1)
            {
                $trail_str .= $this->opt['hseparator'];
            }
        }
        //Trim titles, if needed
        if($this->opt['blimit_title'] && $this->opt['amax_title_length'] > 0)
        {
            //Trim the breadcrumb's title
            $breadcrumb->title_trim($this->opt['amax_title_length']);
        }
        //Place in the breadcrumb's assembled elements
        $trail_str .= $breadcrumb->assemble($linked, $position);
        $position++;
    }
    //Should we return or echo the assembled trail?
    if($return)
    {
        return $trail_str;
    }
    else
    {
        //Helps track issues, please don't remove it
        $credits = "<!-- Breadcrumb NavXT " . $this::version . " -->\n";
        echo $credits . $trail_str;
    }
}
if($key == 0  ) continue;