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/registrar/Registrar.php | 30 ++++++++++++++++++++----------
1 files changed, 20 insertions(+), 10 deletions(-)
diff --git a/inc/registrar/Registrar.php b/inc/registrar/Registrar.php
index 38233f9..c4f0989 100644
--- a/inc/registrar/Registrar.php
+++ b/inc/registrar/Registrar.php
@@ -888,21 +888,29 @@
'offset' => ($page - 1) * $per_page,
'meta_key' => BASE.'date_modified',
'meta_type' => 'DATETIME',
- 'orderby' => 'meta_value'
+ 'orderby' => 'meta_value',
+ 'order' => 'desc',
]);
- $cache = Cache::for($this->slug);
- $max = get_terms([
- 'taxonomy' => $this->based,
- 'fields' => 'ids',
- 'number' => 0,
- 'hide_empty' => true
- ]);
- $max = count($max??[]);
+ $cache = Cache::for($this->slug)->connect('taxonomy');
+ $max = $cache->remember(
+ 'max',
+ function () {
+ $max = get_terms([
+ 'taxonomy' => $this->based,
+ 'fields' => 'ids',
+ 'number' => 0,
+ 'hide_empty' => true
+ ]);
+ return count($max??[]);
+ }
+ );
+
+
$totalPages = floor($max/$per_page);
global $wp;
- $current = get_home_url(null, '/'.$wp->request);
+ $current = get_home_url(null, '/'.$wp->request.'/');
$pages = '';
for ($i = 1; $i<=$totalPages; $i++) {
@@ -924,6 +932,7 @@
$page < $totalPages ? '<a href="'.add_query_arg('tp', $page+1, $current).'" title="Next Page" class="btn">'.jvbIcon('arrow-circle-right').'<span class="screen-reader-text">Next Page</span></a>' : '',
);
+
$out = $nav. Cache::for($this->slug)->remember(
$cache->generateKey(['type' =>'contentArchive', ... $args]),
function() use ($args) {
@@ -936,6 +945,7 @@
$method = BASE.'render_'.$this->slug.'_content';
if ($items && !is_wp_error($items)) {
foreach ($items as $termID) {
+ $meta = Meta::forTerm($termID);
if (function_exists($method)) {
$out[] = $method($termID);
continue;
--
Gitblit v1.10.0