From 47e77f9fac1155c536b2b87fec552c7fcce66fa6 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Mon, 01 Jun 2026 18:06:34 +0000
Subject: [PATCH] =Timeline block fixes. Next up: adding article schema classes
---
inc/managers/SEO/render/SchemaOutput.php | 21 +++++++++++++++------
1 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/inc/managers/SEO/render/SchemaOutput.php b/inc/managers/SEO/render/SchemaOutput.php
index 4619d94..8bd5a35 100644
--- a/inc/managers/SEO/render/SchemaOutput.php
+++ b/inc/managers/SEO/render/SchemaOutput.php
@@ -23,7 +23,7 @@
{
$schema = [];
-
+ $registrar = false;
if (is_front_page()) {
$schema[] = $this->buildWebsiteSchema(true);
$test = $this->buildOrganizationSchema();
@@ -34,12 +34,16 @@
if (is_singular($this->types)) {
$type = get_post_type();
$registrar = Registrar::getInstance($type);
- if ($registrar) {
+
+ $function = BASE.'build_singular_'.jvbNoBase($type).'_schema';
+ if (function_exists($function)) {
+ $schema = $function(get_the_ID());
+ } else if ($registrar) {
$seo = $registrar->getSEO();
$schema[] = $seo->schema()->outputSingularSchema();
}
}elseif (is_post_type_archive($this->types)) {
- error_log('It is a post type archive');
+
$type = get_queried_object();
$type = $type->name;
$registrar = Registrar::getInstance($type);
@@ -54,7 +58,7 @@
$registrar = Registrar::getInstance($type);
if ($registrar ) {
$seo = $registrar->getSEO();
- error_log('SEO: '.print_r($seo->schema(), true));
+// error_log('SEO: '.print_r($seo->schema(), true));
$schema[] = $seo->schema()->outputArchiveSchema();
}
}
@@ -62,9 +66,9 @@
return intval(get_option(BASE.$item.'_archive', false));
},Registrar::getFeatured('is_content', 'term'))));
- if (is_page($isContent)){
+ if (!empty($isContent) && is_page($isContent)){
$type = get_post_meta(get_the_id(), BASE.'for_type', true);
- error_log('Type: '.print_r($type, true));
+// error_log('Type: '.print_r($type, true));
if (!empty($type)) {
$registrar = Registrar::getInstance($type);
if ($registrar) {
@@ -74,6 +78,10 @@
}
+ if ($registrar && !empty($registrar->getSEO()->schema()->extra())) {
+ $schema = array_merge($schema, $registrar->getSEO()->schema()->extra());
+ }
+
$breadcrumbs = $this->buildBreadcrumbs();
@@ -103,6 +111,7 @@
'@graph' => $schema
];
}
+
return $schema;
}
--
Gitblit v1.10.0