Breadcrumbs on specific pages

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.

OK, I’ve sussed the basics. After adding that extra custom function for is_page, I then added the page id reference in the CSS, like this:

.forum-archive .site>.x-container, .page-id-40297 .site>.x-container, .page-id-40548 .site>.x-container, .page-id-40350 .site>.x-container {
    background-color: #f8f8f8;
    padding: 30px;
    position: relative;
    z-index: 999;    
}

So I guess my only question now is, how do I make the breadcrumb add the child pages to the account page? That is, when in ‘Subscriptions’, how do I display the breadcrumb like this…

FTBMates >> Account Details >> Subscriptions

I have tried

	if (is_page('https://followtheboat.com/ftbmates-account/?action=subscriptions')) {
		$crumbs[0]['label'] = 'FTBMates';
    $crumbs[0]['url'] = '/ftbmates';
	$crumbs[1]['label'] = 'Account Details';
    $crumbs[1]['url'] = '/ftbmates-account';
	$crumbs[2]['label'] = 'Subscriptions';
    $crumbs[2]['url'] = '/ftbmates-account/?action=subscriptions';
		}

but that doesn’t work. Any pointers?

Hi @demonboy,

Unfortunately, we are not the correct people to answer your question, as this is a considerable customization request and outside of our support scope.

Kindly contact a developer that has more info on the BBPress plugin to help you out, our theme, in this case, does not have anything o do with the portion that you want to customize and this is a pure bbPress functionality.

I did a Google Search regarding the case that might help you with your research.

Thank you for your understanding.

Sure, I was just hoping one of you might know of one line of code that solves the issue of that ‘?action=’ link. Not to worry, cheers.

Great!
If you need anything else we can help you with, don’t hesitate to open another thread.

1 Like

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