Add additional link in breadcrumbs

Thanks to X support I added breadcrumbs to bbpress. I then added identical selectors for Buddypress so that too shows breadcrumbs.

.bbpress .x-landmark, .buddypress .x-landmark {
display: block;
width: 100%;
margin-bottom: 25px;
}

.bbpress .x-landmark-breadcrumbs-wrap, .buddypress .x-landmark-breadcrumbs-wrap {
display: block;
}

.bbpress .x-landmark-breadcrumbs-wrap .x-breadcrumbs-wrap, .buddypress .x-landmark-breadcrumbs-wrap .x- 
breadcrumbs-wrap {
display: block;
text-align: left;
width: 100%;
}

.bbpress .x-header-landmark, .buddypress .x-header-landmark {
padding-bottom: 0;
}.bbpress .x-landmark, .buddypress .x-landmark {
display: block;
width: 100%;
margin-bottom: 25px;
}

.bbpress .x-landmark-breadcrumbs-wrap, .buddypress .x-landmark-breadcrumbs-wrap {
display: block;
}

.bbpress .x-landmark-breadcrumbs-wrap .x-breadcrumbs-wrap, .buddypress .x-landmark-breadcrumbs-wrap .x- 
breadcrumbs-wrap {
display: block;
text-align: left;
width: 100%;
}

.bbpress .x-header-landmark, .buddypress .x-header-landmark {
padding-bottom: 0;
}

What I would like to do is add the forum root link from bbpress breadcrumbs to the buddypress breadcrumbs. So currently the buddypress breadcrumb says:

Home >> Members >> forum user

I’d like it to say:

Home >> FTBMates >> Members >> forum user

…where FTBMates is my forum root.

Thank you.

Hey @demonboy,

Adding additional items in the breadcrumbs would require filtering the x_breadcrumbs_data Filter. If you’re not aware of Actions and Filters, please read this documentation: https://theme.co/apex/forum/t/customizations-actions-and-filters-in-x-pro/208

A similar question has been asked here in our forum where mixing post types in the breadcrumbs is needed. We have provided an example in this thread: https://theme.co/apex/forum/t/breadcrumbs-custom-post-type-pro/32254/4?u=christian_y

Please just note that working with Actions and Filters requires custom development and PHP knowledge. If don’t have those, you will need to forward the example to a third-party WordPress developer and he/she will develop the custom feature that you need.

Hope that helps and thank you for understanding.

OK, so based on another issue I was having I included this:

function my_custom_breadcrumbs( $crumbs, $args ) {

foreach ( $crumbs as $i => $crumb ) {
 if ( $crumb['type'] === 'bbp-breadcrumb-root' && $crumb['label'] === 'Forums' ) {
  $crumbs[$i]['label'] = 'ftbmates';
}

}

return $crumbs;

}

add_filter( 'x_breadcrumbs_data', 'my_custom_breadcrumbs', 10, 2 );

That changed the name of ‘Forums’ to ‘FTBMates’. Regarding my issue in this thread, and based on the example you linked to, I included this:

if (bp_is_my_profile()) {
$crumbs[0]['label'] = 'FTBMates';
$crumbs[0]['url'] = '/ftbmates';
}

If I set the position in the brackets as zero [0] then that replaces the Home link. I’m trying to work out how to insert it after Home. I guess one workaround would be to now add a home link before the breadcrumb but that’s a bit long-winded. I’m pretty I have to use something like …

    $breadcrumb[] = array(
        'url' => get_permalink( get_option( 'page_for_posts' ) ),
        'text' => 'Blog',
    );

    array_splice( $links, 1, -2, $breadcrumb );

Hi @demonboy,

To insert it after home link you might need to use one [1]. But then it will replace the default content of [1], so you need to proceed and set the other parts of the breadcrumbs two [2]. It’s adjusting the entire breadcrumb link element content. See it on Rad’s reply on previously suggested thread how it is set.

Also as stated, more changes from here would be getting into custom development and it is outside the scope of our support. Thank you for understanding.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.