From aa974bf5954d0cca2506003a3cd9ec4eb89ed0bc Mon Sep 17 00:00:00 2001
From: Jake Vanderwerf <get@jakevanderwerf.ca>
Date: Mon, 11 May 2026 18:35:55 +0000
Subject: [PATCH] =Transfer to new Registrar system
---
taxonomies/body-part.php | 165 +++++++++++++++++++++++++++++++++++++++++-------------
1 files changed, 124 insertions(+), 41 deletions(-)
diff --git a/taxonomies/body-part.php b/taxonomies/body-part.php
index 6038c16..77305df 100644
--- a/taxonomies/body-part.php
+++ b/taxonomies/body-part.php
@@ -1,47 +1,130 @@
<?php
// /taxonomies/body-part.php
-function altr_body_part():array
+
+use JVBase\registrar\Registrar;
+if (!defined('ABSPATH')) {
+ exit;
+}
+
+add_action('jvbDefineRegistrar', 'altr_body_part');
+add_action('jvbDefineRegistrarFields', 'altr_body_part_fields');
+
+add_action('plugins_loaded', 'altr_body_part',1);
+//Add fields later so we can verify taxonomies/post types exist
+add_action('plugins_loaded', 'altr_body_part_fields', 2);
+
+add_filter('altr_Body_partSchemaDefault', 'altr_body_part_schema');
+add_filter('altr_Body_partMetaDefault', 'altr_body_part_meta');
+add_filter('altr_Body_partArchiveDefault', 'altr_body_part_archive');
+
+function altr_body_part(){
+ if (!class_exists('JVBase\registrar\Registrar')) {
+ return;
+ }
+ $bodyPart = Registrar::forTerm('body_part', 'Location on Body', 'Locations on Body')
+ ->setIcon('person')
+ ->make([
+ 'rewrite' => [
+ 'slug' => 'before-and-after/by/location',
+ 'with_front' => false,
+ 'hierarchical' => true
+ ],
+ 'hierarchical' => true,
+ 'for' => [
+ 'progress',
+ ],
+ ])
+ ->setAll([
+ 'show_directory',
+ 'show_feed',
+ ]);
+
+//$directory = $bodyPart->getConfig('directory');
+
+}
+
+function altr_body_part_fields():void
+{
+ if (!class_exists('JVBase\registrar\Registrar')) {
+ return;
+ }
+ $bodyPart = Registrar::getInstance('body_part');
+
+ $fields = $bodyPart->fields();
+ $fields->addCommon('wiki');
+}
+
+function altr_body_part_schema():array
{
return [
- 'singular' => 'Location',
- 'plural' => 'Locations',
- 'description' => [
- 'Location of the tattoo on body.'
- ],
- 'icon' => 'person',
- 'show_feed' => true,
- 'show_directory' => true,
- 'approve_new' => false,
- 'rewrite' => [
- 'slug' => 'before-and-after/by/location',
- 'with_front' => false,
- 'hierarchical' => true,
- ],
- 'hierarchical' => true,
- 'for_content' => [
- 'progress',
- ],
- 'seo' => [
- 'meta' => [
- 'title' => '{{term_name}} Tattoo Removal – Before & After Results',
- 'description' => 'See laser tattoo removal results on the {{term_name}}. Real before and after photos from Legacy Tattoo Removal in Edmonton.',
- ],
- 'schema' => [
- 'type' => 'CollectionPage',
- 'name' => '{{term_name}} Laser Tattoo Removal Before & Afters',
- ],
- 'archive' => [
- 'type' => 'CollectionPage',
- 'name' => 'Tattoo Removal on the {{term_name}} – Before & After',
- ],
- ],
- 'fields' => [
- 'term_name' => [
- 'label' => 'Name',
- 'type' => 'text',
- 'quickEdit' => true,
- ],
- 'common' => [ 'wiki' ]
- ]
+ 'name' => '{{name}} Laser Tattoo Removal Before & Afters',
];
}
+
+function altr_body_part_meta():array
+{
+ return[
+ 'name' => '{{name}} Tattoo Removal – Before & After Results',
+ 'description' => 'See laser tattoo removal results on the {{term_name}}. Real before and after photos from Legacy Tattoo Removal in Edmonton.',
+ ];
+}
+
+function altr_body_part_archive(array $defaults):array
+{
+ return array_merge($defaults, [
+ 'name' => 'Tattoo Removal on the {{term_name}} – Before & After',
+ ]);
+}
+
+function altr_body_part_reference_schema(array $defaults):array
+{
+ return $defaults;
+}
+
+
+//
+//function altr_body_part():array
+//{
+// return [
+// 'singular' => 'Location',
+// 'plural' => 'Locations',
+// 'description' => [
+// 'Location of the tattoo on body.'
+// ],
+// 'icon' => 'person',
+// 'show_feed' => true,
+// 'show_directory' => true,
+// 'approve_new' => false,
+// 'rewrite' => [
+// 'slug' => 'before-and-after/by/location',
+// 'with_front' => false,
+// 'hierarchical' => true,
+// ],
+// 'hierarchical' => true,
+// 'for_content' => [
+// 'progress',
+// ],
+// 'seo' => [
+// 'meta' => [
+// 'title' => '{{term_name}} Tattoo Removal – Before & After Results',
+// 'description' => 'See laser tattoo removal results on the {{term_name}}. Real before and after photos from Legacy Tattoo Removal in Edmonton.',
+// ],
+// 'schema' => [
+// 'type' => 'CollectionPage',
+// 'name' => '{{term_name}} Laser Tattoo Removal Before & Afters',
+// ],
+// 'archive' => [
+// 'type' => 'CollectionPage',
+// 'name' => 'Tattoo Removal on the {{term_name}} – Before & After',
+// ],
+// ],
+// 'fields' => [
+// 'term_name' => [
+// 'label' => 'Name',
+// 'type' => 'text',
+// 'quickEdit' => true,
+// ],
+// 'common' => [ 'wiki' ]
+// ]
+// ];
+//}
--
Gitblit v1.10.0