REST API Reference
Introduced in Breadcrumb NavXT 6.1, a REST API is available for retrieving breadcrumb trails for posts (of any post type), terms (of any taxonomy), and author archives.
Retrieve a Breadcrumb Trail for a Term
Breadcrumb NavXT will return a Schema.org BreadcrumbList JSON-LD object containing the breadcrumb trail for the passed in term ID and taxonomy. The following is the definition and available arguments for this endpoint:
GET /bcn/v1/term/<taxonomy>/<id>
- id – (integer)(required) The ID for the term to retrieve
- taxonomy – (string)(required) The taxonomy type of the term to retrieve
Retrieve a Breadcrumb Trail for a Post
Breadcrumb NavXT will return a Schema.org BreadcrumbList JSON-LD object containing the breadcrumb trail for the passed in post ID. The following is the definition and available arguments for this endpoint:
GET /bcn/v1/post/<id>
- id – (integer)(required) The ID for the post (of any post type) to retrieve
Retrieve a Breadcrumb Trail for an Author
Breadcrumb NavXT will return a Schema.org BreadcrumbList JSON-LD object containing the breadcrumb trail for the passed in author ID. The following is the definition and available arguments for this endpoint:
GET /bcn/v1/author/<id>
- id – (integer)(required) The ID for the author to retrieve
Hi there,
I’m using your plugin within our companies intranet and there are some problems with categories und sub-categories.
cat_A
sub-cat_A1
sub-cat_A2
sub-sub-cat_A2_1
sub-sub-cat_A2_2
sub_cat_A3
sub-sub-cat_A3_1
sub-sub-cat_A3_2
sub_cat_A4
The breadcrumbs for an article in sub-sub-cat_A3_2 are displaying correctely BUT the breadcrumbs for an article of sub-sub-cat_A2_1 not (same category structure). In this case there is only sub-cat_A2 displaying, the rest is missing after opening the article…
Can somebody help me?
Hi Nick,
Is the post an explicit member of more than just the “sub-sub-cat_A2_1” category (e.g. an explicit member of “sub-cat_A2” and an explicit member of “sub-sub-cat_A2_1”)? If that is the case, I recommend changing the post to be only an explicit member of “sub-sub-cat_A2_1” (it will be an implicit member of the parent categories of “sub-sub-cat_A2_1”). You may also try the master branch of Breadcrumb NavXT on GitHub, its term selection behavior has changed slightly that may fix this for you.
-John Havlik
Yes, the article was a member of more than just the sub-sub-category. I changed it so the article is explicit member of tha last category in the row and it works great! Good to know (explicit vs. implicit)
THX A LOT! :)
Hello,
So far I love this plugin. I have one question st this time. Currently on our site, that is in development, all posts are classified under the category news. From the news page visitors can select blogs to read. For example when someone clicks a blog the breadcrumb will read home/news/blog title just as it should. The issue is though when someone tries to click the “news” link in the breadcrumbs it takes them to the page home/categories/news. This is not right. I want it to take the visitor directly back to home/news minus category. How can this be done.
Thanks in advance
Hi Stephen,
Breadcrumb NavXT uses the
get_term_link()
function to link to term archives (e.g. categories). You will need to hook into that function and remove the ‘/categories’ from the URL it returns. If you don’t want to affect every category link, you can always use thebcn_breadcrumb_url
filter. See the documentation for examples of how to use that filter.-John Havlik
Hello John,
could you please guide me to this function? I can’t find a get_term_link() anywhere in the plugin’s php files. And as a non-native speaker it is quite hard to understand every line in the documentation or settings helper texts…
TIA
Peter
Hi Peter,
Breadcrumb NavXT calls the function
get_term_link()
on lines 402, 423, and 542 of class.bcn_breadcrumb_trail.php.-John Havlik
How can I hide main category in woocommerce product page and leave just subcategory? And can I do all links active?
In general, it is considered bad form to hide a category. It is possible, though you have to write a hook into the
bcn_after_fill
action and remove the unwanted category breadcrumb. To link all of the breadcrumbs in the breadcrumb trail (e.g. to link the current item, which is not usually linked), you need to ensure the “Link Current Item” setting is checked in the Breadcrumb NavXT settings page.-John Havlik
Hi John,
I like the plugin very much and was able to customise the looks of it very well. However, how can I hide displaying the current post title in the breadcrumbs? I tried reading the documentation but did not figure it out. There are also 4 websites describing it and none of the steps have worked.
Thanks!
Andrej
Hi Andrej,
Have you tried the solution provided in the FAQ: https://mtekk.us/code/breadcrumb-navxt/faq/#bcn_ci ? The Breadcrumb NavXT Remove Current Item Extension plugin linked to in the solution that should do this for you (simply upload to your server and activate).
-John Havlik
NavXT follows the path as defined in “reading settings -> posts page.”
My website uses a custom home page, that I do not set in “reading settings.” Doing so, would override the custom page I built.
Is there a hook or method of letting NavXT understand that a particular page is my main (one and only) blog page?
I meant to say my website uses a custom “blog” page.
Hi John,
Thanks for an awesome plugin.
When you click on a product on this page:
http://www.kunkelgraphics.com/wordpress/living/
the text in the trail is correct, but when clicking on ‘Living’ in the breadcrumb trail, you go back to the wrong category page.
Please help!
Hi John –
Your plug-in was exactly what I needed for my site… Easy to install, easy to configure. Thanks for this! I’m experiencing some weirdness w/ how the Titles of pages are carrying through to hte plug-in… it appears that most Titles include an indentatin directly after the title, which adds a weird space..
Check this webpage for a sample: Website sample
I checked your guide which details how to shorten the length of text displayed in breadcrumbs, however it still included that indent..
Any ideas of what CSS styles I can apply to .breadcrumbs to close out that white space? Thank you so much for your assistance. Have a nice day!
Hi Joe,
The issue here is that you have CSS style rules for the too generic
.post
class. These end up being applied to all elements with the classpost
on the page. This happens to include breadcrumbs representing posts (of any type).Also, I noticed you are using the deprecated
<center>
HTML tag. I strongly encourage you to move to a more modern way to center elements using CSS.-John Havlik
Having trouble styling the breadcrumb links. Haven’t done CSS in a long time. I inspected the element and saw links are in a div class of breadcrumbs, with the breadcrumbs having classes of “home” “taxonomy” and “category”. I came up with:
div.breadcrumbs a.taxonomy.category:link { color: #00ff00; }
div.breadcrumbs a.taxonomy.category:visited { color: #00ff00; }
div.breadcrumbs a.taxonomy.category:hover { color: #70DB93; }
div.breadcrumbs a.taxonomy.category:active { color: #70DB93; }
Nothing is working – tried a few different variations. Any ideas?
Hey there, Does anyone know how to display the full title with all the pages.
For instead of Home > Accounting I want
Home > Accounting > Buisness accounting services > industry >child care
Hello,
in my website, only for some pages i need to add a custom word in the breadcrumb trail, between Home > and the current page.
How can i do it?
Thank you for your help
Simone
If you want to add another, manual breadcrumb, you can manually inject breadcrumbs in the breadcrumb trail using the `bcn_after_fill` action. See this article on adding static breadcrumbs to the breadcrumb trail.
If you want to use a custom title on some resources (pages, posts, etc), something like Breadcrumb NavXT Title Trixx may suit your needs.
-John Havlik
Hi there,
many thanks for this plugin. I do have one issue though.
I build my pages with the Divi builder tool, and I need to have the breadcrumb displayed beneath some elements of my page.
I know there is no shortcode to do this within the breadcrumb plugin.
I tried to create one on my own, but the breadcrumb is displayed at the top of the page, out of the divi builder itself. Most of time this is due to an echo rather than a return in the display function, but if I check the bcn_display function, it is supposed to be a return.
Do you know if there is a way to display the breadcrumb at a certain position of my page?
Many thanks in advance.
I am using the widget on my Posts and wanted to use it in my shop for products. However, it appears that does not work. Is it a known limitation? Is there a tweak to make it work?
Hi James,
My initial thought is that this is likely due to your theme having a different widget sidebar for the products page (if that is the case, you will need to setup the widget on that sidebar as well). However, this is only if the breadcrumb trail/widget is not showing up at all on the product pages (could test this by using the Title field in the widget and see if only that shows up). If that is not the case, then it may be a conflict with how the product pages are setup (I’d need more information to further diagnose the issue).
-John Havlik
How do I set “home page” for taxonomies? I can see a dropdown for custom post types, but what I need to manually set the page for taxonomies as well.
In WordPress, there isn’t a concept of a home/root page for taxonomies. Taxonomies only get a home/root page that is inferred from the post type they are associated with. If you are trying to map an hierarchical taxonomy term to a page, you may find Breadcrumb NavXT Paths helpful.
-John Havlik
In 6.2.0 NavXT REST API endpoints are no longer enabled by default. Can you tell me how to enable them, because my WP/react project now lost its breadcrumb functionality. Thanks in advance, regards, Mark
Hi Mark,
Please see this article on enabling/requesting an endpoint to be made available in Breadcrumb NavXT 6.2: https://mtekk.us/archives/guides/enabling-the-breadcrumb-navxt-rest-api/
-John Havlik
Hi, I cant add the “home” on the breadcrump. It put only the things after the home… Can you help me please ?
Can you elaborate as to the problem you are having? Breadcrumb NavXT will by default try to generate the home breadcrumb, though it may use the site title rather than ‘home’. This can be changed by replacing %htitle% and %title% with home in the home breadcrumb templates in the Breadcrumb NavXT settings page. If it is not displaying and “display the home breadcrumb” is checked in the settings page, please check to ensure the breadcrumb is not being hidden by CSS (use your web browser’s builtin inspector tool to see what markup Breadcrumb NavXT is generating, looking for the home breadcrumb).
-John Havlik