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
---
ajakevan.php | 261 ++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 252 insertions(+), 9 deletions(-)
diff --git a/ajakevan.php b/ajakevan.php
index 34f71b6..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_';
@@ -53,13 +54,16 @@
const AJV_DIR = WP_PLUGIN_DIR . '/ajakevan';
define('AJV_URL', plugin_dir_url(__FILE__));
-require(AJV_DIR . '/content/setup.php');
+require(AJV_DIR . '/blocks/_setup.php');
+require(AJV_DIR . '/content/_setup.php');
//require(AJV_DIR . '/dashboard/setup.php');
-//require(AJV_DIR . '/forms/setup.php');
-require(AJV_DIR . '/login/setup.php');
-require(AJV_DIR . '/taxonomies/setup.php');
+require(AJV_DIR . '/forms/_setup.php');
+require(AJV_DIR . '/email/_setup.php');
+require(AJV_DIR . '/login/_setup.php');
+require(AJV_DIR . '/taxonomies/_setup.php');
//require(AJV_DIR . '/users/setup.php');
//require(AJV_DIR . '/files/fileManagement.php');
+require(AJV_DIR . '/seo.php');
/**
@@ -83,9 +87,10 @@
{
return [
'icons' => 'light',
- 'is_directory' => false, //as in, a membership directory
+ 'is_directory' => true, //as in, a membership directory
+ 'directory_label' => ['List', 'Lists'],
'has_membership' => false,
- 'has_map' => true,
+// 'has_map' => true,
'dashboard' => true,
'support' => true,
'feed_block' => true,
@@ -96,15 +101,16 @@
'facebook' => false,
'maps' => true,
'gmb' => true,
- 'helcim' => false,
+ 'helcim' => true,
'instagram' => false,
- 'square' => true,
+ 'square' => false,
'umami' => true,
+ 'postmark' => true,
],
'is_restaurant' => false,
'limit_hours' => false,
'enthusiast' => true,
- 'favourites' => true, //optional flag to allow enthusiasts, but not favourites
+ 'favourites' => false, //optional flag to allow enthusiasts, but not favourites
];
}
/**
@@ -140,3 +146,240 @@
//{
// return [];
//}
+
+add_filter('jvbLoadingIcon', 'ajv_loading_icon', 999999);
+function ajv_loading_icon():string
+{
+ return 'loading';
+}
+
+add_filter('jvbDrawerItems', 'jvDrawerItems', 10, 2);
+function jvDrawerItems(array $items, string $menuID):array
+{
+ if ($menuID !== 'main') {
+ return $items;
+ }
+ $items = [
+ [
+ 'text' => 'About Jake',
+ 'url' => home_url('/about'),
+ 'icon' => 'user-square',
+ ]
+ ];
+ foreach (JVB_CONTENT as $slug => $config) {
+ if (array_key_exists('public', $config) && !$config['public']) {
+ continue;
+ }
+ $items[] = [
+ 'text' => $config['singular'],
+ 'url' => get_post_type_archive_link(BASE.$slug),
+ 'icon' => $config['icon'],
+ 'class' => $slug,
+ ];
+ }
+ $items[] = [
+ 'text' => 'Contact',
+ 'icon' => 'chat-teardrop',
+ 'url' => home_url('/contact'),
+ ];
+// $items[] = [
+// 'text' => 'Account',
+// 'url' => home_url('/dash'),
+// 'icon' => 'user-circle',
+// ];
+ return $items;
+}
+
+add_filter('jvbBeforeFooter', 'ajv_acknowledgement');
+function ajv_acknowledgement():string
+{
+
+ return '<p>I live and work in amiskwacîwâskahikan ᐊᒥᐢᑲᐧᒋᐋᐧᐢᑲᐦᐃᑲᐣ</p><p><a href="https://www.treatysix.org/#comp-lkljqlw1" title="Learn More">Treaty 6 territory</a></p><p>Edmonton, Alberta, Canada</p>';
+}
+
+add_filter('jvbRegisterCustomIcons', 'jv_custom_icons');
+function jv_custom_icons(array $icons):array
+{
+ $icons['logo'] = AJV_DIR . '/assets/icons/logo-concentric.svg';
+ $icons['logo-jakevan'] = AJV_DIR . '/assets/icons/logo-concentric-jakevan.svg';
+ $icons['logo-right'] = AJV_DIR . '/assets/icons/logo-right-aligned.svg';
+ $icons['logo-right-jakevan'] = AJV_DIR . '/assets/icons/logo-right-aligned-jakevan.svg';
+ $icons['jakevan'] = AJV_DIR . '/assets/icons/jakevan.svg';
+ $icons['loading'] = AJV_DIR . '/assets/icons/loading.svg';
+ return $icons;
+}
+
+
+
+add_filter('jvbMenuExtra', 'ajv_contact_nav', 10, 3);
+function ajv_contact_nav(string $nav, string $menuName, array $block):string
+{
+ if (array_key_exists('attrs', $block)
+ && array_key_exists('className', $block['attrs'])
+ && $block['attrs']['className'] === 'is-style-fixed'
+ && $nav === '') {
+ $text = '<li><a href="'.jvbTextLink(8258239916,'I have an idea - can you help bring it to life?').'" title="Text Me">'.jvbIcon('chat').'<span class="hide-small">825.823.9916</span></a></li>';
+ $email = '<li><a href="'.jvbMailToLink(
+ 'get@jakevan.ca',
+ '[JakeVan] I have an idea - can you help bring it to life?','Be sure to as much detail as possible, including what your idea is about, when you need it done by, and budget.'
+ ).'" title="Email Me">'.jvbIcon('envelope').'<span class="hide-small">get@jakevan.ca</span></a></li>';
+
+ return $text.$email;
+ }
+
+ return $nav;
+}
+
+add_filter('jvbRandomFooterText', 'ajv_footer_text');
+function ajv_footer_text(string $text):string
+{
+ $privacy = get_privacy_policy_url();
+ $privacy = ($privacy === '') ? '' : ' | <a href="'.$privacy.'">Privacy Policy</a>';
+ return '<p class="font-small">©'.date('Y').' <a href="'.get_home_url().'">'.get_bloginfo('name').'</a>'.$privacy.' | <a href="'.get_home_url(null, '/legal/terms-of-service/').'" title="Terms of Service">Terms of Service</a></p><p class="font-small">Built with ♡ by <a href="https://jakevan.ca">Jake Van</a> <small>(of course!)</small></p>';
+}
+
+
+add_filter('jvbSummaryHeader', 'ajv_summary_header', 10, 2);
+function ajv_summary_header(string $return, string $type):string
+{
+ $extra = match($type) {
+ 'strategy' => 'Edmonton-focused brand',
+ default => 'Edmonton made'
+ };
+ $title = ($type === 'directory') ? 'Directory' : JVB_CONTENT[$type]['singular'];
+ return '<small>'.$extra.'</small>'.$title.'.';
+}
+
+add_filter('jvbSummaryHeaderExtra', 'altr_summary_extra', 10, 2);
+function altr_summary_extra(string $return, string $type):string
+{
+ return ($type === 'directory') ? '' : '<p>Or see <a href="'.JVB()->directories()->getDirectoryList()[$type]['url'].'">alphabetical list</a>.</p>';
+}
+
+function ajv_render_core_post_content(array $block, string $content = ''):string
+{
+ if(!is_singular(array_map(function($item) { return BASE.$item; }, array_keys(JVB_CONTENT)))) {
+ return JVB()->blocks()->render_core_post_content($block, $content);
+ }
+ $postType = jvbNoBase(get_post_type());
+ $function = "ajv_render_{$postType}_content";
+ $base = '';
+ if (function_exists($function)) {
+ $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
--
Gitblit v1.10.0