From a17c578433ef543e220697813a9367a260df83e1 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Thu, 28 May 2026 19:14:31 +0000
Subject: [PATCH] =new gitblit setup
---
taxonomies/project.php | 168 ++++++++++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 150 insertions(+), 18 deletions(-)
diff --git a/taxonomies/project.php b/taxonomies/project.php
index 28865b6..341e489 100644
--- a/taxonomies/project.php
+++ b/taxonomies/project.php
@@ -3,6 +3,7 @@
use JVBase\managers\Cache;
use JVBase\meta\Meta;
use JVBase\registrar\Registrar;
+use JVBase\utility\Image;
if (!defined('ABSPATH')) {
exit;
@@ -22,7 +23,7 @@
return;
}
$project = Registrar::forTerm('project', 'Project', 'Projects')
- ->setIcon('scribble')
+ ->setIcon('cards-three')
->make([
'rewrite' => [
'slug' => 'projects',
@@ -40,7 +41,7 @@
->setAll([
'show_feed',
'show_directory',
- 'is_content'
+ 'is_content',
]);
}
function ajv_project_fields():void
@@ -50,7 +51,8 @@
}
$project = Registrar::getInstance('project');
- //$directory = $project->getConfig('directory');
+ $directory = $project->config('directory');
+ $directory->setTitle('Projects');
//$breadcrumbs = $project->config('breadcrumbs');
//$breadcrumbs->setCrumb('project');
@@ -419,7 +421,7 @@
$extra = jvbCommaList($temp);
}
}
- $extra .= ' Made Project';
+ $extra .= '-Based Project';
return '<small>'.$extra.'</small>'.$fields['name'].'.';
}
@@ -432,7 +434,7 @@
}
- return '<p>Or see <a href="'.JVB()->directories()->getDirectoryList()[$type]['url'].'">all projects</a>.</p>';
+ return '<p>Or see <a href="'.get_home_url(null,'/projects/').'">all projects</a>.</p>';
}
add_filter('jvbBeforeSummary', 'ajv_project_before_summary', 10, 2);
@@ -444,7 +446,7 @@
$meta = Meta::forTerm(get_queried_object_id());
$fields = $meta->getAll();
$rows = [];
- if ($fields['city'] !== '') {
+ if (!empty($fields['city'])) {
$rows[] = jvbMetaTermList($fields['city'], 'city');
}
if ($fields['target'] !== '') {
@@ -464,29 +466,51 @@
for ($i = 0; $i <= (int) $fields['budget']; $i++) {
$budget .= '$';
}
- $title = match((int)$fields['budget']) {
- 0 => 'Low',
- 1 => 'Medium Low',
- 2 => 'Medium',
- 3 => 'Medium High',
- 4 => 'High'
+
+ $budget = match($fields['budget']) {
+ 'low' => '$',
+ 'medium-low' => '$$',
+ 'medium' => '$$$',
+ 'medium-high' => '$$$$',
+ 'high' => '$$$$$'
};
+
+ $title = ucwords($fields['budget']);
$rows[] = '<span>'.jvbIcon('currency-dollar-simple').'Budget:</span><span title="'.$title.'">'.$budget.'</span>';
}
if ($fields['timeline'] !== '') {
$rows[] = '<span>'.jvbIcon('hourglass-medium').'Timeline:</span>'.$fields['timeline'];
}
- $summary = '';
+
+ $summary = '<section id="summary"><h2>At a Glance</h2>';
if (!empty($rows)) {
- $summary = '<section id="summary"><h2>At a Glance</h2><ul class="summary">';
+ $summary .= '<ul class="summary">';
$summary .= implode('', array_map(function ($row) {
return '<li>'.$row.'</li>';
}, $rows));
- $summary .= '</ul></section>';
- }
- return $summary;
+ $summary .= '</ul>';
+ }
+ if (!empty($meta->get('summary'))) {
+ $summary .= '<div>'.wpautop($meta->get('summary')).'</div>';
+ }
+ $summary .= '</section>';
+
+ $img = '';
+ if (!empty($meta->get('thumbnail'))) {
+ $data = Image::getData($meta->get('thumbnail'));
+ if (!empty($data)) {
+ $img = sprintf(
+ '<div class="poster" style="background-image:url(\'%s\');" data-bg-img data-bg-small="%s" data-bg-medium="%s" data-bg-large="%s"></div>',
+ $data['tiny'],
+ $data['small'],
+ $data['medium'],
+ $data['large'],
+ );
+ }
+ }
+ return $summary.$img;
}
add_filter('jvbSummaryImage', 'ajv_project_summary_image', 10, 2);
@@ -495,6 +519,7 @@
if ($type !== 'project') {
return $return;
}
+ return '';
$meta = Meta::forTerm(get_queried_object_id());
$thumbnail = $meta->get('thumbnail');
@@ -513,7 +538,7 @@
$fields = $meta->getAll();
if ($fields['summary'] !== '') {
- $return['about-this-project'] = $fields['summary'];
+ $return['about-this-project'] = wpautop($fields['summary']);
}
if (!empty($fields['needs'])) {
$return['needs'] = ajvb_format_needs($fields['needs']);
@@ -707,4 +732,111 @@
}
$ids[] = 'project-parts';
return $ids;
+}
+
+add_filter('jvb_content_tax_args_project', 'ajv_modify_project_args');
+function ajv_modify_project_args(array $args):array
+{
+// $args['meta_key'] = BASE.'started';
+// $args['meta_type'] = 'DATETIME';
+// $args['orderby'] = 'meta_value';
+ return $args;
+}
+
+function ajv_render_project_content(int $termID):string
+{
+ $meta = Meta::forTerm($termID);
+ $slug = sanitize_title($meta->get('name'));
+ $inside = '';
+
+ $postTypes = array_map(function($type) { return jvbCheckBase($type);}, Registrar::getInstance('project')->registrar->for);
+ $images = ajv_get_limited_post_images([
+ 'post_type' => $postTypes,
+ 'tax_query' => [
+ [
+ 'taxonomy' => BASE.'project',
+ 'terms' => $termID
+ ]
+ ]
+ ], true);
+
+
+
+ if (!empty($images)) {
+ $images = sprintf(
+ '<h3>Project Parts</h3><ul class="loop scroll">%s</ul>',
+ implode('',array_map(function ($img) {
+ return sprintf(
+ '<li>%s</li>',
+ $img
+ );
+ }, $images))
+ );
+ } else {
+ $images = '';
+ }
+ $url = get_term_link($termID, BASE.'project')??'';
+
+ $titleExtra = '';
+ $terms = [
+ 'city',
+ 'target'
+ ];
+ foreach ($terms as $term) {
+ if (!empty($meta->get($term))) {
+ $registrar = Registrar::getInstance($term);
+
+ $titleExtra .= '<li>'.jvbIcon($registrar->getIcon()).jvbGetTermLink($meta->get($term), BASE.$term).'</li>';
+ }
+ }
+ if (!empty($titleExtra)) {
+ $titleExtra = '<ul class="terms">'.$titleExtra.'</ul>';
+ }
+ $times = [
+ 'started',
+ 'ended'
+ ];
+
+ $temp = '';
+ foreach ($times as $time) {
+ if (!empty($meta->get($time))) {
+ $theTime = strtotime($meta->get($time));
+ $temp .= sprintf(
+ '<li>%s: <time datetime="%s">%s</time></li>',
+ ucfirst($time),
+ date('c', $theTime),
+ date('F j, Y', $theTime)
+ );
+ }
+ }
+ if (!empty($temp)) {
+ $titleExtra .= '<ul class="term-list">'.$temp.'</ul>';
+ }
+ return sprintf(
+ '<li id="%s">
+ <div class="cover row btm x-mid">
+ %s
+ <div class="content">
+ <h2><a href="%s">%s</a></h2>
+ <div class="meta">
+ %s
+ </div>
+ </div>
+ </div>
+ %s
+ %s
+ %s
+ <a class="btn" href="%s">%sSee Full Project</a>
+ </li>',
+ $slug,
+ jvbFormatImage((int)$meta->get('thumbnail')),
+ $url,
+ $meta->get('name'),
+ $titleExtra,
+ empty($meta->get('summary')) ? '' : wpautop($meta->get('summary')),
+ $inside,
+ $images,
+ $url,
+ jvbIcon('arrow-circle-right')
+ );
}
\ No newline at end of file
--
Gitblit v1.10.0