From 76d68c97f572120dc75d0501cc82acf4022d6b33 Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Tue, 23 Dec 2025 20:14:14 +0000
Subject: [PATCH] =legacy rebrand finished
---
content/progress.php | 245 +++++++++++++++++++++++++++++++++++++++++++++---
1 files changed, 229 insertions(+), 16 deletions(-)
diff --git a/content/progress.php b/content/progress.php
index e06ef9b..7ba6d1a 100644
--- a/content/progress.php
+++ b/content/progress.php
@@ -1,46 +1,259 @@
<?php
-// /content/art.php
+// /content/progress.php
+use JVBase\meta\MetaManager;
+
function altr_progress():array
{
return [
'singular' => 'Before & After',
'plural' => 'Before & Afters',
- 'dash_title' => 'Before & Afters',
+ 'dash_title' => 'Progress',
'dash_description' => 'Manage your before and after posts',
'breadcrumb' => 'Before & Afters',
- 'hide_single' => false,
+ 'capability_type' => ['progress', 'progress'],
+ 'hide_children' => true,
+ 'is_timeline' => true,
'show_feed' => true,
- 'favouritable' => false,
- 'karma' => false,
+ 'hierarchical' => true,
'icon' => 'arrows-left-right',
'rewrite' => [
'slug' => 'before-and-after',
'with_front' => false,
],
+ 'sections' => [
+ 'progression' => [
+ 'label' => 'Progression',
+ ]
+ ],
+ 'seo' => [
+ 'schema' => [
+ 'type' => 'BeforeAfter',
+ 'name' => '{{post_title}}',
+ 'description' => '{{post_excerpt}}',
+ 'about' => ['@id' => '{{site_url}}/#laser-removal-service'],
+ 'temporalCoverage' => '{{post_date}}/{{last_date}}',
+ 'additionalProperty' => [
+ ['name' => 'Number of sessions', 'value' => '{{number.name}}'],
+ ['name' => 'Treatment area', 'value' => '{{body-part.name}}'],
+ ],
+ 'associatedMedia' => '{{timeline_photos}}', // parent post thumbnail = before; each child post has a post thumbnail, too
+ ],
+ 'meta' => [
+ 'title' => '{{body-part.name}} Laser Tattoo Removal – Before & After',
+ 'description' => 'Documented progress of {{body-part.name}} laser tattoo removal over {{number.name}} sessions.',
+ ],
+ 'archive' => [
+ 'type' => 'CollectionPage',
+ 'name' => 'Tattoos Before and After Laser Tattoo Removal',
+ ],
+ ],
+ 'feed' => [
+ 'single' => [
+ 'pre_title' => 'Before & After Laser Tattoo Removal',
+ ],
+ 'archive' => [
+
+ ],
+ 'config' => [
+ 'is_gallery' => false,
+ 'content' => 'progress',
+ 'context' => 'progress',
+ 'id' => [],
+ 'class' => [],
+ ]
+ ],
'fields' => [
'post_title' => [
'type' => 'text',
'label' => 'Title',
+ 'quickEdit' => true,
+ 'section' => 'progression',
+ 'for_all' => true,
],
- 'featured_image' => [
- 'type' => 'image',
- 'label' => 'Image',
+ 'post_status' => [
+ 'type' => 'radio',
+ 'label' => 'Status',
+ 'options' => [
+ 'publish' => 'Show',
+ 'draft' => 'Hide',
+ 'trash' => 'Scrap',
+ 'delete' => 'Permanently Delete'
+ ],
+ 'section' => 'progression',
+ 'for_all' => true,
],
- 'gallery' => [
- 'type' => 'gallery',
- 'label' => 'Gallery',
+ 'post_date' => [
+ 'type' => 'date',
+ 'label' => 'Date',
+ 'for_all' => true,
],
- 'price' => [
- 'type' => 'number',
- 'label' => 'Price',
+ 'post_thumbnail' => [
+ 'type' => 'upload',
+ 'label' => 'Image',
+ 'quickEdit' => true,
+ 'section' => 'progression',
+ 'for_all' => true,
+ ],
+ 'person' => [
+ 'type' => 'taxonomy',
+ 'taxonomy' => 'person',
+ 'autocomplete' => true,
+ 'label' => 'Person',
+ 'quickEdit' => true,
+ 'createNew' => true,
+ 'section' => 'progression',
+ 'hint' => 'Not public, just to make it easier to find'
+ ],
+ 'goal' => [
+ 'type' => 'taxonomy',
+ 'taxonomy' => 'goal',
+ 'autocomplete' => true,
+ 'label' => 'Goal',
+ 'quickEdit' => true,
+ 'createNew' => true,
+ 'section' => 'progression'
+ ],
+ 'timeline' => [
+ 'type' => 'taxonomy',
+ 'taxonomy' => 'timeline',
+ 'autocomplete' => true,
+ 'label' => 'Timeline',
+ 'quickEdit' => true,
+ 'createNew' => true,
+ 'section' => 'progression',
+ 'for_all' => true,
+ ],
+ 'body-part' => [
+ 'type' => 'taxonomy',
+ 'taxonomy' => 'body-part',
+ 'label' => 'Body Part',
+ 'autocomplete' => true,
+ 'quickEdit' => true,
+ 'createNew' => true,
+ 'section' => 'progression'
+ ],
+ 'style' => [
+ 'type' => 'taxonomy',
+ 'taxonomy' => 'style',
+ 'autocomplete' => true,
+ 'label' => 'Tattoo Style',
+ 'quickEdit' => true,
+ 'createNew' => true,
+ 'section' => 'progression'
+ ],
+ 'skin-type' => [
+ 'type' => 'taxonomy',
+ 'taxonomy' => 'skin-type',
+ 'label' => 'Skin Type',
+ 'autocomplete' => true,
+ 'quickEdit' => true,
+ 'createNew' => true,
+ 'section' => 'progression'
+ ],
+ 'age' => [
+ 'type' => 'taxonomy',
+ 'taxonomy' => 'age',
+ 'autocomplete' => true,
+ 'label' => 'Age of Tattoo',
+ 'quickEdit' => true,
+ 'createNew' => true,
+ 'section' => 'progression'
+ ],
+ 'number' => [
+ 'type' => 'taxonomy',
+ 'taxonomy' => 'number',
+ 'autocomplete' => true,
+ 'label' => 'Number of Treatments',
+ 'quickEdit' => true,
+ 'createNew' => true,
+ 'section' => 'progression'
],
'post_content' => [
'type' => 'textarea',
'quill' => true,
- 'label' => 'Notes'
+ 'label' => 'Notes',
+ 'section' => 'progression',
+ 'for_all' => true,
]
],
- 'single_image' => false,
'upload_title' => 'Upload Before & Afters',
];
}
+
+add_filter('jvbFeedItem', 'altr_progress_item', 10, 2);
+
+function altr_progress_item(string $out, array $config):string
+{
+ if (!in_array('progress', $config['content'])) {
+ return $out;
+ }
+
+ ob_start();
+ ?>
+ <details class="item feed col a-start" data-timeline>
+ <summary>
+ <a>
+ <span>Before</span>
+ <img width="300px" height="300px" loading="lazy" decoding="async" class="before">
+ <img width="300px" height="300px" loading="lazy" decoding="async" class="after">
+ <span>After</span>
+ </a>
+ </summary>
+ <div class="more">
+ <p class="started">Started:<time></time></p>
+ <p class="updated">Last treated:<time></time></p>
+ <p class="total">Total Treatments: <b></b></p>
+ <ul class="term-list"><li><a></a></li></ul>
+ </div>
+ </details>
+ <?php
+ return ob_get_clean();
+}
+
+
+add_filter('jvbCoreFeaturedImage', 'altr_progress_featured_image', 10, 2);
+function altr_progress_featured_image(string $out, string $postType):string
+{
+ if ($postType !== BASE.'progress') {
+ return $out;
+ }
+ $route = JVB()->routes('content');
+
+ global $post;
+ $data = $route->formatTimeline($post);
+ $timeline = $data['fields']['timeline'];
+ $total = count($timeline);
+ if ($total === 1) {
+ return $out;
+ }
+
+ $total--;
+ $first = '<span class="before">Before</span>'.jvbFormatImage($timeline[0]['post_thumbnail'],'tiny','medium',false);
+ $last = '<span class="after">After '.$total.' Tx</span>'.jvbFormatImage($timeline[$total]['post_thumbnail'],'tiny','medium',false);
+ return $first.$last;
+}
+
+
+add_filter('jvbSEOResolveVariable', 'altr_progress_variables', 10, 6);
+function altr_progress_variables(mixed $return, string $variable, ?int $ID, ?string $objectType, ?string $contentType, ?MetaManager $meta):mixed
+{
+ if ($contentType !== 'progress' || !in_array($variable, ['timeline_photos', 'last_date'])) {
+ return $return;
+ }
+
+ $children = get_children([
+ 'post_parent' => $ID,
+ 'post_status' => 'publish',
+ 'order_by' => 'date',
+ 'fields' => 'ids'
+ ]);
+ //Insert the parent to the beginning
+ array_unshift($children, $ID);
+ if ($variable === 'timeline_photos') {
+ return array_map(function ($item) {
+ return get_post_thumbnail_id($item);
+ }, $children);
+ }
+ // $variable === 'last_date'
+ return get_the_date('c', $children[array_key_last($children)]);
+}
--
Gitblit v1.10.0