Just for clarification, are you talking about unlinking a breadcrumb (or several) in the trail on specific posts/pages, or unlinking the breadcrumb that represents a specific post/page on all trails that contain said breadcrumb?
As for your second question, setting the breadcrumb trail to be unlinked is controlled at call time. This is done either via the second parameter to bcn_display(), or via the widget options when using the widget.
Hello John,
I mean the first thing. I would like to disable specific items in the breadcrumb in specific post or page. For example I have homepage/post-category/post-name, I would like to keep post category as breadcrumb trail item but unlinked only when I’m on post page for example. I use widget, I was wondering if there’s a way to to that in functions.php with a function.
Please let me know!
Hello again,
I would like to paste here a sample of code I used to unlink specific breadcrumb trail items on an array of pages. The item is unlinked (a href=”#”) but it seems like it is still linked (it still works like a link even if href is null).
Here’s the code:
add_filter('bcn_breadcrumb_url', 'my_breadcrumb_url_stripper', 3, 10);
function my_breadcrumb_url_stripper($url, $type, $id)
{
if(in_array('post-page', $type) && in_array((int) $id, array(642, 766, 1666)))
{
$url = NULL;
}
return $url;
}
Is there a way to have a function like this removing the link tag completely?
Thank you!
It looks like a change made in 6.4.0 broke the way that method of removing links worked. For 6.4.0, it appears the only good way to remove the linked status is to use the bcn_after_fill action and run through the breadcrumb list using the set_linked(false) method to unlink the breadcrumbs you want unlinked. I’m thinking I need to add a filter for the newly separated off linked status (I’m tracking this in the following github issue: https://github.com/mtekk/Breadcrumb-NavXT/issues/232 )