I’m looking to modify my breadcrumbs on woocommerce products a bit.
Here’s how they look: Home / Store / Books / War & Peace
Here’s what I want: Store > Books
So I need to:
1) Remove the Home link & trailing separator
2) Remove the Post title and preceding separator
3) Change the “/” separator to “>”
This is the only place I’m using breadcrumbs so I have the freedom to change a lot of the code.
How do I start a thread?
Thanks,
Hey!
Please go to Enfold/framework/php folder and open class-breadcrumb.php and find following line
$separator = '<span class="sep">' . $separator . '</span>';
and change it to
$separator = '<span class="sep"> > </span>';
and then add following code to Functions.php file in Appearance > Editor
add_filter('avia_breadcrumbs_args', 'avia_remove_home_breadcrumb', 10, 1);
function avia_remove_home_breadcrumb($args){
$args['show_home'] = "";
return $args;
}
Best regards,
Yigit
Thanks Yigit.
The separators still show as “/” after I edit the class-breadcrumb.php file.
The update to functions.php now shows a “Products” link in place of home. Products / Shop / Category / Product Name
I ended up using some css selectors I have not used before.
..breadcrumb span:last-of-type, .breadcrumb span:first-of-type, .breadcrumb-trail .sep {display: none;}
So this hid the first and last parts of the trail along with the separators and left me with: Shop Books as the breadcrum trail which is close enough to what I want for now.
I think more flexibility or control of the titles of individual elements (posts, products, portfolios) is one area that could make the theme better.