Jake Vanderwerf
2026-04-26 3f08cede4c4e71244a5c5f8f6cfe1ce98e5e908b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
<?php
// /content/soap.php
 
use JVBase\registrar\Registrar;
if (!defined('ABSPATH')) {
    exit;
}
 
 
add_action('jvbDefineRegistrar', 'atat_soap');
add_action('jvbDefineRegistrarFields', 'atat_soap_fields');
 
add_action('plugins_loaded', 'atat_soap',3);
//Add fields later so we can verify taxonomies/post types exist
add_action('plugins_loaded', 'atat_soap_fields', 4);
 
add_filter('atat_FaqSchemaDefault', 'atat_soap_schema');
add_filter('atat_FaqMetaDefault', 'atat_soap_meta');
add_filter('atat_FaqArchiveDefault', 'atat_soap_archive');
 
function atat_soap(){
    if (!class_exists('JVBase\registrar\Registrar')) {
        return;
    }
    $soap = Registrar::forPost('soap', 'Soap', 'Soaps')
        ->setIcon('sparkle')
        ->make([
            'rewrite'   => [
                'slug'          => 'soap',
                'with_front'    => false,
            ],
            'taxonomies'    => [
                'flag',
            ],
            'public'    => false,
        ])
        ->setAll([
            'show_directory',
        ])
        ->setIntegration('helcim')
        ->setIntegration('facebook')
        ->setIntegration('instagram');
 
//$directory = $soap->getConfig('directory');
 
}
 
function atat_soap_fields():void
{
    if (!class_exists('JVBase\registrar\Registrar')) {
        return;
    }
    $soap = Registrar::getInstance('soap');
//    $breadcrumbs = $soap->config('breadcrumbs');
//    $breadcrumbs->setCrumb('section');
 
 
    $fields = $soap->fields();
    $fields->addField('ingredients', [
        'type'      => 'textarea',
        'quill'     => true,
        'label'     => 'Ingredients',
    ]);
    $fields->addField('extra_info', [
        'type'      => 'textarea',
        'quill'     => true,
        'label'     => 'Extra Info',
    ]);
    $fields->addField('flag', [
        'type'      => 'selector',
        'subtype'   => 'taxonomy',
        'taxonomy'  => 'flag',
        'label'     => 'Flags',
    ]);
}
 
function atat_soap_schema():array
{
    return [
        'type'              => 'JVBase\managers\SEO\render\Thing\Product\Product',
        'name'              => '{{post_title}} | Handmade in Edmonton',
    ];
}
 
function atat_soap_meta():array
{
    return[
        'name' => '{{post_title}} | Handmade in Edmonton',
    ];
}
 
function atat_soap_archive(array $defaults):array
{
    return array_merge($defaults, [
        'name' => 'Handmade Soaps',
        'description' => 'Handmade Soaps in Edmonton, Alberta.'
    ]);
}
 
function atat_soap_reference_schema(array $defaults):array
{
    return $defaults;
}
// /content/soap.php
//function atat_soap():array
//{
//    return [
//        'singular'       => 'Soap',
//        'plural'       => 'Soaps',
//        'dash_title'    => 'Soap',
//        'dash_description' => 'Manage your soap',
//        'breadcrumb'    => 'Soap',
//        'icon'         => 'sparkle',
//      'integrations'  => [
//          'helcim'    => [
//              'initial'   => true,
//              'update'    => true,
//          ],
//      ],
//        'rewrite'      => [
//            'slug'       => 'soap',
//            'with_front' => false,
//        ],
//        'fields'       => [
//            'post_title'     => [
//                'type'  => 'text',
//                'label' => 'Name',
//            ],
//            'post_status'         => [
//                'type'      => 'radio',
//                'label'     => 'Status',
//                'hidden'    => true,
//                'options'   => [
//                    'publish'   => 'Show',
//                    'draft'     => 'Hide',
//                    'trash'     => 'Scrap',
//                    'delete'    => 'Permanently Delete'
//                ]
//            ],
//            'post_slug' => [
//                'type'  => 'text',
//                'label' => 'Slug',
//              'hidden'    => true,
//            ],
//            'post_content'        => [
//                'type'  => 'textarea',
//                'label' => 'Description',
//                'quill' => true,
//            ],
//            'ingredients' => [
//                'type'  => 'textarea',
//                'label' => 'Ingredients',
//              'quill' => true,
//            ],
//            'extra_info' => [
//                'type'  => 'textarea',
//                'label' => 'Extra Info',
//              'quill' => true,
//            ],
//            'flags'  => [
//                'type'  => 'taxonomy',
//              'taxonomy'  => 'flags',
//                'term'    => 'flags',
//                'label'   => 'Flags',
//            ]
//        ],
//        'single_image' => true,
//        'upload_title' => 'Upload Soaps',
//    ];
//}