Support » Plugin: Breadcrumb NavXT » Unlink items link in specific post/page

  • Hello,
    I would like to know if it’s possible to unlink one or more items in the breadcrumb trail for specific post or pages.
    Another question: is it possible to activate unlinked breadcrumb trail globally from plugin settings?

    Thank you!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author John Havlik

    (@mtekk)

    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.

    Thread Starter FoxMulder84

    (@foxmulder84)

    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!

    Thread Starter FoxMulder84

    (@foxmulder84)

    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!

    Plugin Author John Havlik

    (@mtekk)

    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 )

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Unlink items link in specific post/page’ is closed to new replies.