Jake Vanderwerf
2026-05-28 a17c578433ef543e220697813a9367a260df83e1
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
<?php
// /taxonomies/media.php
use JVBase\registrar\Registrar;
 
if (!defined('ABSPATH')) {
    exit;
}
 
 
add_action('plugins_loaded', 'ajv_media',1);
//Add fields later so we can verify taxonomies/post types exist
add_action('plugins_loaded', 'ajv_media_fields', 2);
 
add_filter('ajv_MediaSchemaDefault', 'ajv_media_schema');
add_filter('ajv_MediaMetaDefault', 'ajv_media_meta');
add_filter('ajv_MediaArchiveDefault', 'ajv_media_archive');
 
function ajv_media(){
    if (!class_exists('JVBase\registrar\Registrar')) {
        return;
    }
    $media = Registrar::forTerm('media', 'Medium', 'Media')
        ->setIcon('scribble')
        ->make([
            'rewrite'   => [
                'slug'          => 'in/media',
                'with_front'    => false,
            ],
            'for'    => [
                'art',
                'design',
                'development',
                'strategy',
                'writing'
            ],
            'hierarchical'  => true,
        ])
        ->setAll([
            'show_feed',
            'show_directory',
        ]);
}
 
function ajv_media_fields():void
{
    if (!class_exists('JVBase\registrar\Registrar')) {
        return;
    }
    $media = Registrar::getInstance('media');
 
    //$directory = $media->getConfig('directory');
    //$breadcrumbs = $media->config('breadcrumbs');
    //$breadcrumbs->setCrumb('project');
 
    $fields = $media->fields();
    $fields->addCommon('wiki');
}
 
//function ajv_media():array
//{
//    return [
//        'singular'       => 'Medium',
//        'plural'         => 'Media',
//        'description'    => [
//            '<b>What it\'s made of.</b>',
//            'From clay to oil paints'
//        ],
//        'icon'           => 'diamonds-four',
//        'show_feed'      => true,
//        'show_directory' => true,
//        'approve_new'    => true,
//        'rewrite'        => [
//            'slug'         => 'media',
//            'with_front'   => false,
//            'hierarchical' => true,
//        ],
//        'hierarchical'   => true,
//        'for_content'    => [
//            'art'
//        ],
//        'seo' => [
//            'schema' => [
//                'type' => 'DefinedTerm',
//                'name' => '{{name}}',
//                'description' => '{{description}}',
//            ],
//            'meta' => [
//                'title' => '{{name}} Art | JakeVan',
//                'description' => '{{description}}',
//            ],
//            'archive' => [
//                'type' => 'CollectionPage',
//                'name' => '{{name}} Artwork',
//            ],
//        ],
//        'fields'         => [
//            'term_name' => [
//                'label'     => 'Name',
//                'type'      => 'text',
//                'quickEdit' => true,
//            ],
//            'common'    => [ 'wiki' ]
//        ]
//    ];
//}
 
 
function ajv_media_schema():array
{
    return [
//        'type'              => 'JVBase\managers\SEO\render\Thing\CreativeWork\CreativeWork',
        'name'              => '{{name}} Artwork',
        'description'       => '{{description}}',
    ];
}
 
function ajv_media_meta():array
{
    return[
        'name' => '{{name}} | Human-made Art',
    ];
}
 
function ajv_media_archive(array $defaults):array
{
    return array_merge($defaults, [
        'name' => 'Canadian {{name}} Artwork. Made in Edmonton, Alberta.',
    ]);
}
 
function ajv_media_reference_schema(array $defaults):array
{
    return $defaults;
}