Hi John,
thank you for your reply!
I did some research and found these articles:
https://mtekk.us/archives/guides/add-a-static-breadcrumb-to-the-breadcrumb-trail/
https://www.ads-software.com/support/topic/insert-item-between-breadcrumb-on-specific-pages/
I didn’t know, that this plugin offers such user-friendly customization options. Now I’m sure I can solve the problem easily ??
I have several other taxonomies, and this is one example structure:
example.de/birthplace/australia/sydney
“birthplace” is a custom taxonomy with hierarchical terms like australia and sydney. But “birthplace” is also a normal wordpress page, where I’ve inserted a table of contents of the existing terms. It works without problems.
The breadcrumbs should look like this:
Home -> Birthplace (content of the page “birthplace”)
Home -> Birthplace -> Australia (content of term australia)
Home -> Birthplace -> Australia -> Sydney (content of term sydney)
So I need a static breadcrumb item called “Birthplace” between the Home- and the Country-item. I’ve tried something with the code examples, but I can’t get it right.
The following code displays: Home -> Birthplace -> Birthplace of persons (where ‘Birthplace of persons’ is the title-tag of the page):
add_filter('bcn_after_fill', 'my_static_breadcrumb_adder');
function my_static_breadcrumb_adder($breadcrumb_trail) {
$new_breadcrumb = new bcn_breadcrumb('Birthplace', NULL, array('birthplace'), '/birthplace/');
array_splice($breadcrumb_trail->breadcrumbs, -1, -0, array($new_breadcrumb));
}
When I change the numbers in the array_splice from “-1, -0” to “-2, -1” the breadcrumb path is “Home -> Birthplace”, that means the word I’ve set in ‘new bcn_breadcrumb’, is taken.
Could you explain the meaning of the numbers, please? (I found a description of the hooks, but unfortunately without examples).
I would like to have this breadcrumb path for the page ‘birthplace’: Home -> Birthplace of persons (title tag)
For the two taxonomy terms (australia, sydney) I tried to modify the code, but can’t get it to work correctly, because the inserted item was on the wrong position and without link. I would be very glad, if you could help me!
Thank you very much in advance!
Andreas