X theme over-riding my bbpress breadcrumb root link name

Hi,

If you look here:

https://followtheboat.com/ftbmates/forum/supporter-only-videos/

You can see that the root link for my forums says ‘FORUMS’. I have used both a plugin, and also made a change to my functions file to change the name of this to ‘FTBMates’. However X seems to be over-riding this name change. The code I am using for my functions file (which I think is the same as what the plugin is trying to use) is:

add_filter( 'bbp_get_breadcrumb', 'change_breadcrumb_text' );

Function change_breadcrumb_text ($trail) {
$trail = str_replace ('Forums','FTBMates',$trail) ;
return $trail ;
}

How do I disable X from over-riding this name change, or how do I force this name-change?

Thanks!

Hello @demonboy,

Thanks for writing in!

I have inspected your site and there are plugins that may be overriding the breadcrumbs. Please take at look as your BBP Style Pack plugin settings and the BBP Toolkit plugin. One of these could change or have been overriding the breadcrumbs.

Hope this helps.

Hi, thanks for getting back to me. I have disabled both these plugins (and others, just to check) and they don’t have any effect. What is interesting is that I disabled BBP Style Plugin, which creates the little ‘home’ icon in the breadcrumb and, despite disabling it, it is still there… unless this is part of the X theme? Along the way I have lost my ‘create new topic’ button, so Wordpress did seem to make the changes after disabling (ie I don’t think this is a cache issue).

BTW - I switched my theme to WP 2019 and the breadcrumbs displayed as they should…

… so there’s definitely something in X theme that is restricting the plugin’s ability to change the breadcrumbs.

Hey @demonboy,

Sorry for the confusion. Our themes do have its own breadcrumbs and that is being used so you will need to filter our theme’s x_breadcrumbs_data instead of bbPress’ hooks.

We have provided an example to override a breadcrumb in this thread: https://theme.co/apex/forum/t/modify-the-breadcrumb-element/24923/4

Hope that helps.

1 Like

Hi, thanks for the link but I’m not really understanding this. Firstly, I notice this code, which I have amended to suit my site:

function my_custom_breadcrumbs( $crumbs, $args ) {

foreach ( $crumbs as $i => $crumb ) {
 if ( $crumb['type'] === 'page' && $crumb['label'] === 'forums' ) {
  $crumbs[$i]['label'] = 'ftbmates';
}
}

return $crumbs;

}

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

… where the page ‘forums’ (bearing in mind this is dynamically created and not a static page) is replaced with the word ‘ftbmates’. This didn’t change anything.

Secondly, what are the two numbers ‘10’ and ‘2’ referenced in the add_filter section? Are these page numbers?

And can I get away with putting this function in my functions.php child theme?

This is the structure of my current breadcrumb:

array(3) { [0]=> array(3) { ["type"]=> string(4) "home" ["url"]=> string(26) "https://followtheboat.com/" ["label"]=> 
string(119) "Home" } [1]=> array(3) { ["type"]=> string(19) "bbp-breadcrumb-root" ["url"]=> string(35) 
"https://followtheboat.com/ftbmates/" ["label"]=> string(6) "Forums" } [2]=> array(3) { ["type"]=> string(11) "bbp-current" 
["url"]=> string(68) "https://followtheboat.com/ftbmates/forum/first-viewing-ftb-episodes/" ["label"]=> string(27) "First 
Viewing: FTB Episodes" } }

Right, done it! I had to replace the ‘type’ from ‘page’ to ‘bbp-breadcrumb-root’. It now works as I wanted. Hoorah!

Thanks for your help.

I’m still interested to know what the 10 and 2 is in the add_filter part…

Hello @demonboy,

In the function code, the 10 and 2 is for the priority number and the accepted arguments in the filter.

Hope this helps.

1 Like

Thanks for your help.

You are most welcome!

1 Like

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