Vania
1
I have a custom post type “Servicios”. It has a hierarchical custom taxonomy “categorie-servicios”.
Bricks breadcrumbs show: Home → Servicios → Post title
Rank math breadcrumb show: Home → Servicios → Category → Sub Category → Post title
Any chance to include category and subcategory in Bricks native breadcrumbs?
4 Likes
amrali
2
I have the same requirments, I have a CPT and custom categories and the breadcrumb shows only the post type name
Is there a solution to this by now? I can neither see any in the builder options nor does it display correctly.
The solution here does not work for the blog post archives with categories.
Ultron
4
I added some functionality to be able to display the post type and category for the breadcrumbs.
function get_display_post_type() {
global $post;
$post_type = get_post_type_object(get_post_type($post));
if ($post_type) {
return $post_type->labels->singular_name;
}
return '';
}
function get_all_parent_categories() {
$categories = get_the_category();
$parent_categories = array();
if (!empty($categories)) {
foreach ($categories as $category) {
if ($category->parent) {
$parent_category = get_category($category->parent);
$parent_categories[] = $parent_category->name;
}
}
}
if (!empty($parent_categories)) {
return implode('/ ', $parent_categories);
} else {
return '';
}
}
And here’s how I use them
/{echo:get_display_post_type}/{echo:get_all_parent_categories}/{post_terms_category}/
Hope this helps you too
3 Likes