From c4aa5cdb5e90ad4b420e22772797d16980232a2b Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Wed, 15 Apr 2026 18:38:55 +0000
Subject: [PATCH] =Updating custom tables to utilize CustomTable.php
---
inc/managers/SEO/BreadcrumbManager.php | 52 +++++++++++++++++++++++++++++-----------------------
1 files changed, 29 insertions(+), 23 deletions(-)
diff --git a/inc/managers/SEO/BreadcrumbManager.php b/inc/managers/SEO/BreadcrumbManager.php
index 8d3288e..72929a2 100644
--- a/inc/managers/SEO/BreadcrumbManager.php
+++ b/inc/managers/SEO/BreadcrumbManager.php
@@ -121,10 +121,10 @@
'name' => $contentRegistrar->getConfig('breadcrumbs')['title']??$contentRegistrar->getPlural(),
'url' => get_post_type_archive_link(jvbCheckBase($content)),
];
- $crumbs[] = [
- 'name' => 'By ' . $registrar->getSingular(),
- 'url' => false,
- ];
+// $crumbs[] = [
+// 'name' => 'By ' . $registrar->getSingular(),
+// 'url' => false,
+// ];
}
}
@@ -150,9 +150,11 @@
// Add directory if exists
$content = jvbNoBase($post->post_type);
$registrar = Registrar::getInstance($content);
+ $crumbConfig = false;
if ($registrar){
$crumbConfig = $registrar->getConfig('breadcrumbs');
}
+
if($registrar && $registrar->hasFeature('show_directory')) {
$directory = JVB()->directories()?->directories($content)??[];
if (!empty($directory)) {
@@ -209,7 +211,7 @@
} elseif (is_post_type_archive() && $registrar && $registrar->hasFeature('show_directory')) {
$crumbs[] = [
- 'name' => $registrar->getConfig('breadcrumb')['title'] ?? $registrar->getPlural(),
+ 'name' => $registrar->getConfig('breadcrumbs')['title'] ?? $registrar->getPlural(),
'url' => get_post_type_archive_link($type)
];
}
@@ -366,29 +368,33 @@
}
}
- public function addTaxToCrumbs(array $crumbs, string $taxonomy):array
+ public function addTaxToCrumbs(array $crumbs, string|array $taxonomy):array
{
$ID = get_the_ID();
- $taxonomy = jvbCheckBase($taxonomy);
- $terms = get_the_terms($ID, $taxonomy);
- if ($terms && !is_wp_error($terms)) {
- $term = $terms[0];
- $ancestors = get_ancestors($term->term_id, $taxonomy, 'taxonomy');
- $ancestors = array_reverse($ancestors);
- foreach ($ancestors as $ancestor) {
- $aTerm = get_term($ancestor, $taxonomy);
- if ($aTerm && !is_wp_error($aTerm)) {
- $crumbs[] = [
- 'name' => $aTerm->name,
- 'url' => get_term_link($ancestor, $taxonomy)
- ];
+ $taxonomies = is_string($taxonomy) ? [$taxonomy] : $taxonomy;
+ foreach ($taxonomies as $tax) {
+ $taxonomy = jvbCheckBase($tax);
+ $terms = get_the_terms($ID, $taxonomy);
+ if ($terms && !is_wp_error($terms)) {
+ $term = $terms[0];
+ $ancestors = get_ancestors($term->term_id, $taxonomy, 'taxonomy');
+ $ancestors = array_reverse($ancestors);
+ foreach ($ancestors as $ancestor) {
+ $aTerm = get_term($ancestor, $taxonomy);
+ if ($aTerm && !is_wp_error($aTerm)) {
+ $crumbs[] = [
+ 'name' => $aTerm->name,
+ 'url' => get_term_link($ancestor, $taxonomy)
+ ];
+ }
}
+ $crumbs[] = [
+ 'name' => html_entity_decode($term->name),
+ 'url' => get_term_link($term, $taxonomy)
+ ];
}
- $crumbs[] = [
- 'name' => html_entity_decode($term->name),
- 'url' => get_term_link($term, $taxonomy)
- ];
}
+
return $crumbs;
}
}
--
Gitblit v1.10.0