From 85f32c02f80286094cc5230a30cd7ebbe77eae2d Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Sat, 14 Feb 2026 19:15:40 +0000
Subject: [PATCH] =added functions for outputting custom meta fields for our post types

---
 content/strategy.php    |   14 ++
 content/development.php |   16 ++
 content/art.php         |   86 +++++++++-----
 blocks/_setup.php       |   60 ++++++++--
 content/writing.php     |   14 ++
 ajakevan.php            |  115 +++++++++++++++++++
 content/design.php      |   14 ++
 7 files changed, 270 insertions(+), 49 deletions(-)

diff --git a/ajakevan.php b/ajakevan.php
index 670e2e2..79eb523 100644
--- a/ajakevan.php
+++ b/ajakevan.php
@@ -44,6 +44,7 @@
 }
 
 use JVBase\managers\CacheManager;
+use JVBase\meta\Meta;
 
 add_filter('jvb_base', function () {
     return 'ajv_';
@@ -267,4 +268,118 @@
         $base = call_user_func($function, $block, $content);
     }
     return $base.JVB()->blocks()->render_core_post_content($block, $content);
+}
+
+add_filter('the_seo_framework_meta_render_data', 'ajvb_no_next_archive', 10, 1);
+function ajvb_no_next_archive($tags) {
+    if (is_tax() || is_post_type_archive()) {
+        if (array_key_exists('next', $tags)) {
+            unset($tags['next']);
+        }
+    }
+    return $tags; // Keep the link for other pages
+}
+
+
+
+
+add_filter('jvbSummaryDetailsOutput', 'ajvb_summary_info',10, 1);
+function ajvb_summary_info(string $return):string
+{
+    if (!is_singular(array_map(function($item) { return BASE.$item;}, array_keys(JVB_CONTENT)))) {
+        return $return;
+    }
+
+    $return = ajvb_term_list();
+    $return .= ajvb_meta_output();
+
+    return $return;
+}
+
+function ajvb_term_list():string
+{
+    if (!JVB_TAXONOMY){
+        return '';
+    }
+    $ID = get_the_ID();
+    $type = jvbNoBase(get_post_type($ID));
+    $taxonomies = array_filter(JVB_TAXONOMY, function($config) use ($type){
+        return in_array($type, $config['for_content']);
+    });
+
+    $lists = [];
+    foreach ($taxonomies as $taxonomy => $config) {
+        $terms = wp_get_object_terms($ID, $taxonomy);
+        if ($terms && !is_wp_error($terms)) {
+            $list = sprintf(
+                '<li>%s<span>%s</span><ul class="term-list">',
+                jvbIcon($config['icon']),
+                $config['plural']
+            );
+            foreach ($terms as $term) {
+                $list .= sprintf(
+                    '<li><a href="%s" rel="tag">%s</a></li>',
+                    get_term_link($term),
+                    $term->name
+                );
+            }
+            $list .='</ul></li>';
+            $lists[] = $list;
+        }
+    }
+    $out ='';
+    if (!empty($lists)){
+        $out = sprintf(
+            '<ul class="ajv-term-list">%s</ul>',
+            implode('',$lists)
+        );
+    }
+
+    return $out;
+
+}
+
+function ajvb_meta_output():string
+{
+    if (!class_exists('JVBase\meta\Meta')) {
+        return '';
+    }
+    $ID = get_the_ID();
+    $type = jvbNoBase(get_post_type($ID));
+
+    return apply_filters('ajvb_summary_meta_output', '', $type);
+}
+
+function ajvb_format_needs(array $needs):string
+{
+    $theNeeds = '';
+    foreach ($needs as $need) {
+        $theNeeds .= sprintf(
+            '<li><h3>%s</h3>%s<div class="info">%s</div></li>',
+            $need['need'],
+            $need['image'] !== '' ? jvbFormatImage($need['image']) : '',
+            $need['fulfilled']
+        );
+    }
+    return sprintf(
+        '<section id="needs"><h2>What we needed:</h2><ul class="needs-wants">%s</ul></section>',
+        $theNeeds
+    );
+}
+
+function ajvb_format_wants(array $wants):string
+{
+    $theWants = '';
+    foreach ($wants as $want) {
+        $theWants .= sprintf(
+            '<li><h3>%s</h3>%s<div class="info">%s</div></li>',
+            $want['need'],
+            $want['image'] !== '' ? jvbFormatImage($want['image']) : '',
+            $want['fulfilled']
+        );
+    }
+    return sprintf(
+        '<section id="wants"><h2>What we wanted:</h2><ul class="needs-wants">%s</ul></section>',
+        $theWants
+    );
 }
\ No newline at end of file
diff --git a/blocks/_setup.php b/blocks/_setup.php
index 4142256..03ad113 100644
--- a/blocks/_setup.php
+++ b/blocks/_setup.php
@@ -1,5 +1,4 @@
 <?php
-use JVBase\utility\Image;
 
 function ajv_render_core_site_logo(array $block, string $content):string
 {
@@ -13,23 +12,60 @@
     return $open.$icons.$close;
 }
 
-function ajv_render_core_cover(array $block, string $content):string
+function ajv_render_core_cover(array $block):string
 {
     $types = array_map(function($type) {
         return BASE.$type;
     }, array_keys(JVB_CONTENT));
-    if (!is_post_type_archive($types)) {
-        return JVB()->blocks()->render_core_cover($block);
-    }
-    $obj = get_queried_object();
-    foreach ($types as $type) {
-        if ($type === $obj->name) {
-            $type = jvbNoBase($type);
-            $function = 'ajv_render_'.$type.'_cover';
-            return '<section class="align-full cover alt '.$type.'">'.call_user_func($function).'</section>';
+
+    if (is_post_type_archive($types)) {
+        $obj = get_queried_object();
+        foreach ($types as $type) {
+            if ($type === $obj->name) {
+                $type = jvbNoBase($type);
+                $function = 'ajv_render_'.$type.'_cover';
+                return '<section class="align-full cover alt '.$type.'">'.call_user_func($function).'</section>';
+            }
         }
     }
-    return JVB()->blocks()->render_core_cover($block);
+
+
+    if(!is_singular(array_map(function($item) { return BASE.$item; }, array_keys(JVB_CONTENT)))) {
+        return JVB()->blocks()->render_core_cover($block);
+    }
+
+    $ID = get_the_ID();
+    $imgID = get_post_thumbnail_id($ID);
+    $img = '';
+    if ($imgID && $imgID > 0) {
+        $img = str_replace('<img', '<img style="object-fit:center"',jvbFormatImage($imgID, 'tiny', 'large', false)) ;
+    }
+
+    $post_type = jvbNoBase(get_post_type());
+    $singular = JVB_CONTENT[$post_type]['singular'];
+
+    $header = 'Canadian made '.$singular.'.&emsp;Made in Edmonton.';
+    $title = get_the_title();
+
+    $title = '<small>'.$header.'</small>'.$title;
+
+
+    $date = '<small><time datetime="'.get_the_date('c').'" itemprop="datePublished">'.get_the_date().'</time></small>';
+
+
+    return sprintf(
+        '<section class="overlay-50 a-end end align-full cover row" style="background-color: rgba(var(--base-rgb), var(--rgb-medium));">
+        %s
+        <div class="content">
+        <h1>%s</h1>
+        %s
+        </div>
+        </section>',
+        $img,
+        $title,
+        $date
+    );
+
 }
 
 function ajv_get_limited_posts(string $type, int $limit):array {
diff --git a/content/art.php b/content/art.php
index e8b5156..9b4abaa 100644
--- a/content/art.php
+++ b/content/art.php
@@ -145,6 +145,11 @@
                         'label' => 'Need',
                         'required' => true
                     ],
+                    'image' => [
+                        'type'  => 'upload',
+                        'multiple' => true,
+                        'label' => 'Example Image'
+                    ],
                     'fulfilled' => [
                         'type'  => 'textarea',
                         'quill' => true,
@@ -161,6 +166,11 @@
                         'label' => 'Want',
                         'required' => true
                     ],
+                    'image' => [
+                        'type'  => 'upload',
+                        'multiple' => true,
+                        'label' => 'Example Image'
+                    ],
                     'fulfilled' => [
                         'type'  => 'textarea',
                         'quill' => true,
@@ -176,41 +186,55 @@
 
 function ajv_render_art_content(array $block, string $content):string
 {
+    $out = '';
     $ID = get_the_ID();
     $meta = Meta::forPost($ID);
+
     $fields = $meta->getAll();
 
-    $city = (empty($fields['city'])) ? 'Edmonton' : jvbGetTermLink((int)$fields['city']);
-    $form = (empty($fields['form'])) ? 'art' : jvbGetTermLink((int)$fields['form']);
-
-    $style = (empty($fields['style'])) ? '' : jvbGetTermLink(explode(',',$fields['style'])[0]).' ';
-    $subtitle = '<h2 class="subtitle">'.$city.' handmade '.$style.'<b>'.$form.'</b>.</h2>';
-
-
-    /** INTRO **/
-    $intro = '<section id="intro" class="row"><div class="text">'.apply_filters('wpautop', $fields['post_excerpt']).'</div><div class="images">';
-    $intro .= (!empty($fields['post_thumbnail'])) ? jvbImageCaption($fields['post_thumbnail']) : '';
-    if (!empty($fields['gallery'])) {
-        $images = explode(',',$fields['gallery']);
-        foreach ($images as $image) {
-            $intro .= jvbImageCaption($image, 'tiny', 'medium');
-        }
-    }
-    $intro .= '</section>';
-
-
-    /** META **/
-    $taxonomies = ['city', 'project','form', 'media','style','theme'];
-    $meta = '';
-    foreach ($taxonomies as $taxonomy) {
-        if (!empty($fields[$taxonomy])) {
-            $icon = jvbIcon(JVB_TAXONOMY[$taxonomy]['icon'])??'';
-            $meta .= jvbRenderTermList($fields[$taxonomy], $icon.JVB_TAXONOMY[$taxonomy]['singular']);
-        }
-    }
-    if ($meta !== '') {
-        $meta = '<section class="meta">'.$meta.'</section>';
+    $bits = [];
+    if (array_key_exists('post_excerpt', $fields) && !empty($fields['post_excerpt'])) {
+        $bits[] = sprintf(
+            '<section id="excerpt"><h2>At a Glance</h2>%s</section>',
+            apply_filters('the_content', $fields['post_excerpt'])
+        );
     }
 
-    return $subtitle.$meta.$intro.$meta;
+    if (array_key_exists('gallery', $fields) && !empty($fields['gallery'])) {
+        $gallery = explode(',',$fields['gallery']);
+        $gallery = array_map(function ($imgID) {
+            $out = '<figure>'.jvbFormatImage($imgID,'tiny','medium');
+            $caption = wp_get_attachment_caption($imgID);
+            $out .= ($caption && $caption !== '') ? '<figcaption>'.apply_filters('the_content', $caption).'</figcaption>' : '';
+            $out .= '</figure>';
+            return $out;
+
+        }, $gallery);
+        $gallery = implode('',$gallery);
+        $bits[] = sprintf(
+            '<section id="gallery"><h2>Gallery</h2><div>%s</div></section>',
+            $gallery
+        );
+    }
+
+    if (array_key_exists('post_content', $fields) && !empty($fields['post_content'])) {
+        $bits[] = sprintf(
+            '<section id="content">%s</section>',
+            apply_filters('the_content', $fields['post_content'])
+        );
+    }
+
+    if (array_key_exists('needs', $fields) && !empty($fields['needs'])) {
+        $bits[] = ajvb_format_needs($fields['needs']);
+    }
+    if (array_key_exists('wants', $fields) && !empty($fields['wants'])) {
+        $bits[] = ajvb_format_wants($fields['wants']);
+    }
+
+    if (!empty($bits)) {
+        $out = implode('',$bits);
+    }
+
+
+    return $out;
 }
\ No newline at end of file
diff --git a/content/design.php b/content/design.php
index a0948d0..213f5d8 100644
--- a/content/design.php
+++ b/content/design.php
@@ -8,6 +8,7 @@
         'directory' => 'Design',
         'show_feed'    => true,
         'show_directory'=> true,
+        'addCrumb'      => 'project',
         'favouritable' => true,
         'karma'        => false,
         'icon'         => 'scribble',
@@ -113,6 +114,7 @@
                 'label' => 'Notes'
             ],
 
+
             'needs' => [
                 'type'  => 'repeater',
                 'label' => 'Needs',
@@ -122,6 +124,11 @@
                         'label' => 'Need',
                         'required' => true
                     ],
+                    'image' => [
+                        'type'  => 'upload',
+                        'multiple' => true,
+                        'label' => 'Example Image'
+                    ],
                     'fulfilled' => [
                         'type'  => 'textarea',
                         'quill' => true,
@@ -138,6 +145,11 @@
                         'label' => 'Want',
                         'required' => true
                     ],
+                    'image' => [
+                        'type'  => 'upload',
+                        'multiple' => true,
+                        'label' => 'Example Image'
+                    ],
                     'fulfilled' => [
                         'type'  => 'textarea',
                         'quill' => true,
@@ -147,6 +159,6 @@
             ],
         ],
         'single_image' => false,
-        'upload_title' => 'Upload Artwork',
+        'upload_title' => 'Upload Designs',
     ];
 }
diff --git a/content/development.php b/content/development.php
index 0b7ba3c..38806bb 100644
--- a/content/development.php
+++ b/content/development.php
@@ -7,8 +7,7 @@
         'singular'       => 'Development',
         'plural'       => 'Developments',
         'directory' => 'Development',
-        'hide_single'  => false,
-        'redirectToAuthor'=> false,
+        'addCrumb'      => 'project',
         'show_directory'=> true,
         'show_feed'    => true,
         'favouritable' => true,
@@ -109,6 +108,7 @@
                 'label' => 'Notes'
             ],
 
+
             'needs' => [
                 'type'  => 'repeater',
                 'label' => 'Needs',
@@ -118,6 +118,11 @@
                         'label' => 'Need',
                         'required' => true
                     ],
+                    'image' => [
+                        'type'  => 'upload',
+                        'multiple' => true,
+                        'label' => 'Example Image'
+                    ],
                     'fulfilled' => [
                         'type'  => 'textarea',
                         'quill' => true,
@@ -134,6 +139,11 @@
                         'label' => 'Want',
                         'required' => true
                     ],
+                    'image' => [
+                        'type'  => 'upload',
+                        'multiple' => true,
+                        'label' => 'Example Image'
+                    ],
                     'fulfilled' => [
                         'type'  => 'textarea',
                         'quill' => true,
@@ -143,6 +153,6 @@
             ],
         ],
         'single_image' => false,
-        'upload_title' => 'Upload Artwork',
+        'upload_title' => 'Upload Development',
     ];
 }
diff --git a/content/strategy.php b/content/strategy.php
index f0e0c83..a3d9e12 100644
--- a/content/strategy.php
+++ b/content/strategy.php
@@ -9,6 +9,7 @@
         'redirectToAuthor'=> false,
         'show_directory'=> true,
         'directory' => 'Strategy',
+        'addCrumb'      => 'project',
         'show_feed'    => true,
         'favouritable' => true,
         'karma'        => false,
@@ -107,6 +108,7 @@
                 'label' => 'Notes'
             ],
 
+
             'needs' => [
                 'type'  => 'repeater',
                 'label' => 'Needs',
@@ -116,6 +118,11 @@
                         'label' => 'Need',
                         'required' => true
                     ],
+                    'image' => [
+                        'type'  => 'upload',
+                        'multiple' => true,
+                        'label' => 'Example Image'
+                    ],
                     'fulfilled' => [
                         'type'  => 'textarea',
                         'quill' => true,
@@ -132,6 +139,11 @@
                         'label' => 'Want',
                         'required' => true
                     ],
+                    'image' => [
+                        'type'  => 'upload',
+                        'multiple' => true,
+                        'label' => 'Example Image'
+                    ],
                     'fulfilled' => [
                         'type'  => 'textarea',
                         'quill' => true,
@@ -141,6 +153,6 @@
             ],
         ],
         'single_image' => false,
-        'upload_title' => 'Upload Artwork',
+        'upload_title' => 'Upload Strategies',
     ];
 }
diff --git a/content/writing.php b/content/writing.php
index 737966e..8cd4c7f 100644
--- a/content/writing.php
+++ b/content/writing.php
@@ -8,6 +8,7 @@
         'hide_single'  => false,
         'redirectToAuthor'=> false,
         'show_feed'    => true,
+        'addCrumb'      => 'project',
         'show_directory'=> true,
         'directory' => 'Writing',
         'favouritable' => true,
@@ -107,6 +108,7 @@
                 'quill' => true,
                 'label' => 'Notes'
             ],
+
             'needs' => [
                 'type'  => 'repeater',
                 'label' => 'Needs',
@@ -116,6 +118,11 @@
                         'label' => 'Need',
                         'required' => true
                     ],
+                    'image' => [
+                        'type'  => 'upload',
+                        'multiple' => true,
+                        'label' => 'Example Image'
+                    ],
                     'fulfilled' => [
                         'type'  => 'textarea',
                         'quill' => true,
@@ -132,6 +139,11 @@
                         'label' => 'Want',
                         'required' => true
                     ],
+                    'image' => [
+                        'type'  => 'upload',
+                        'multiple' => true,
+                        'label' => 'Example Image'
+                    ],
                     'fulfilled' => [
                         'type'  => 'textarea',
                         'quill' => true,
@@ -141,6 +153,6 @@
             ],
         ],
         'single_image' => false,
-        'upload_title' => 'Upload Artwork',
+        'upload_title' => 'Upload Writings',
     ];
 }

--
Gitblit v1.10.0