I am using both bbpress and buddypress. In buddypress pages I can set the first breadcrumb to be my forum root and rename it.
However within the bbpress forum the breadcrumb is adding a home icon and a link to my website home page. I want to remove this first part.
This is the code currently in my functions.php file. What I don’t understand is that the first part of this code is saying ‘make the forums the root’.
// CHANGE 'FORUMS' TO 'FTBMATES' IN THE BREADCRUMB
// =============================================================================
function my_custom_breadcrumbs( $crumbs, $args ) {
foreach ( $crumbs as $i => $crumb ) {
if ( $crumb['type'] === 'bbp-breadcrumb-root' && $crumb['label'] === 'Forums' ) {
$crumbs[$i]['label'] = 'ftbmates';
}
if (bp_is_my_profile()) {
$crumbs[0]['label'] = 'FTBMates';
$crumbs[0]['url'] = '/ftbmates';
$crumbs[1]['label'] = 'My Home';
$crumbs[1]['url'] = '/ftbmates/me/';
$crumbs[2]['label'] = '';
$crumbs[2]['url'] = '';
}
if ( bp_is_user() ) {
$crumbs[0]['label'] = 'FTBMates';
$crumbs[0]['url'] = '/ftbmates';
$crumbs[1]['label'] = 'My Home';
$crumbs[1]['url'] = '/members/me/';
}
}
return $crumbs;
}
add_filter( 'x_breadcrumbs_data', 'my_custom_breadcrumbs', 10, 2 );
function breadcrumbs_for_account ( $crumbs, $args ) {
if (is_page('40350')) {
$crumbs[0]['label'] = 'FTBMates';
$crumbs[0]['url'] = '/ftbmates';
}
if (is_page('34779')) {
$crumbs[0]['label'] = 'FTBMates';
$crumbs[0]['url'] = '/ftbmates';
}
return $crumbs;
}
add_filter( 'x_breadcrumbs_data', 'breadcrumbs_for_account', 10, 2 );
