Hi,
I have breadcrumbs for both bbpress and buddypress, where the root of the forum has been changed. The CSS I was given to move the breadcrumbs to the top of the page under the title is:
/* move breadcrumbs */
.bbpress .x-landmark {
display: block;
width: 100%;
margin-bottom: 25px;
}
.bbpress .x-landmark-breadcrumbs-wrap {
display: block;
}
.bbpress .x-landmark-breadcrumbs-wrap .x-breadcrumbs-wrap {
display: block;
text-align: left;
width: 100%;
}
.bbpress .x-header-landmark {
padding-bottom: 0;
}
.x-landmark-breadcrumbs-wrap .x-breadcrumbs-wrap {
display: none;
}
/* move breadcrumbs */
.x-breadcrumbs {font-size:12px;}
and the only reference to breadcrumbs in my functions.php file is
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';
}
}
return $crumbs;
}
I’d have thought that by adding this extra code it would display the breadcrumbs on a specific page:
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';
}
if (is_page('40350')) {
$crumbs[0]['label'] = 'FTBMates';
$crumbs[0]['url'] = '/ftbmates';
$crumbs[1]['label'] = 'Account';
$crumbs[1]['url'] = '/account';
}
}
return $crumbs;
}
but it does not display the breadcrumbs on page 40350. Do I need to add anything in my CSS to display the breadcrumbs on that page or is my code in the functions wrong?
In fact this page is an account page and has a couple of other pages that fall under it, specifically account/?action=subscriptions
and account/?action=payments
and the home page of accounts is account/?action=home
. How do I get my breadcrumb to change to take into account these pages, so that the breadcrumb looks like this:
FTBMates >> Account >> Subscription
I’ve also added this to my functions.php file
function breadcrumbs_for_account ( $crumbs, $args ) {
if (is_page('40350')) {
$crumbs[0]['label'] = 'FTBMates';
$crumbs[0]['url'] = '/ftbmates';
$crumbs[1]['label'] = 'Account';
$crumbs[1]['url'] = '/account';
}
return $crumbs;
}
add_filter( 'x_breadcrumbs_data', 'breadcrumbs_for_account', 10, 2 );
I think this should work, so I think all I need to understand is how to display through CSS the breadcrumb on page 40350.
Thanks in advance.