Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #995841

    please refer to the link in private content.

    you can see the breadcrumbs is like this
    You are here:Home /Blog /Resources /Polycrystalline vs Monocrystalline Solar Panel, Which one is better?

    how can I change it to
    You are here:Home /Polycrystalline vs Monocrystalline Solar Panel, Which one is better?

    since you can see my link structure is as simple as the latter one

    #995974

    Hey paulchiao,

    You might want to consider a plugin to be able to have more flexibility with breadcrumbs.

    If you need further assistance please let us know.
    Best regards,
    Victoria

    #995985

    please advise plugin, thanks.

    #995990

    Hi,

    Please try to add this code to your child theme functions.php to remove the “Blog” link from the breadcrumb:

    
    add_filter( 'avia_breadcrumbs_trail', 'avia_breadcrumbs_trail_mod', 50, 2 );
    function avia_breadcrumbs_trail_mod( $trail, $args ) 
    {
    	if ( is_single() ) 
    	{
    		unset($trail[1]);
    	}
    
    	return $trail;
    }
    

    If you want to remove the “resources” link too you can try this code:

    
    add_filter( 'avia_breadcrumbs_trail', 'avia_breadcrumbs_trail_mod', 50, 2 );
    function avia_breadcrumbs_trail_mod( $trail, $args ) 
    {
    	if ( is_single() ) 
    	{
    		unset($trail[1]);
    		unset($trail[2]);
    	}
    
    	return $trail;
    }
    

    Best regards,
    Dude

    #996021

    Hi Dude,

    thanks,
    I added this code to function.php, it works.

    the resources link is only a category link in the blog

    what if I will add another category, such as “how-to” category
    will I have to modify the code again?
    since I do not want the category links to be shown in the breadcrumb.

    thanks for your efforts.

    #996271

    Hi,

    It depends on the hierarchy of the categories. I’d recommend to check the breadcrumb structure after you added the category. If it pops up in the breadcrumb simply add another line to the code:

    
    unset($trail[3]);
    

    Best regards,
    Dude

    #996275

    Hi, Dude,

    thank you again for your efforts.

    Best regards,
    Paul

    #996277

    Hi,

    Glad we could help you :)

    Best regards,
    Dude

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘how to change breadcrumbs structure’ is closed to new replies.