Jake Vanderwerf
4 hours ago b7aed073c23396afa7eccb488dd25bfa222c1819
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
<?php
// /taxonomies/style.php
 
use JVBase\registrar\Registrar;
if (!defined('ABSPATH')) {
    exit;
}
 
add_action('jvbDefineRegistrar', 'aei_style');
add_action('jvbDefineRegistrarFields', 'aei_style_fields');
 
add_action('plugins_loaded', 'aei_style',3);
//Add fields later so we can verify taxonomies/post types exist
add_action('plugins_loaded', 'aei_style_fields', 4);
 
add_filter('aei_StyleSchemaDefault', 'aei_style_schema');
add_filter('aei_StyleMetaDefault', 'aei_style_meta');
add_filter('aei_StyleArchiveDefault', 'aei_style_archive');
 
function aei_style(){
    if (!class_exists('JVBase\registrar\Registrar')) {
        return;
    }
    $style = Registrar::forTerm('style', 'Style', 'Styles')
        ->setIcon('style')
        ->make([
            'rewrite'   => [
                'slug'          => 'in/style',
                'with_front'    => false,
                'hierarchical'  => true,
            ],
            'for'    => [
                'artist',
                'event',
            ],
            'hierarchical'  => true,
        ])
        ->setAll([
            'show_feed',
            'show_directory',
            'track_changes',
        ]);
 
//$directory = $style->getConfig('directory');
 
}
 
function aei_style_fields():void
{
    if (!class_exists('JVBase\registrar\Registrar')) {
        return;
    }
    $style = Registrar::getInstance('style');
 
    $fields = $style->fields();
    $fields->addCommon('wiki');
    $fields->addCommon('alternate_name');
    $fields->addCommon('keywords');
}
 
function aei_style_schema():array
{
    return [
//        'type'              => 'JVBase\managers\SEO\render\Thing\CreativeWork\CreativeWork',
        'name'              => '{{name}} | Canadian Style',
        'about'             => [
            'type'  => 'JVBase\managers\SEO\render\Thing\Place\AdministrativeArea\Style',
            'name'  => '{{name}}',
        ],
        'description'       => '{{description}}',
    ];
}
 
function aei_style_meta():array
{
    return[
        'name' => 'Best Tattoos in {{name}}',
        'description'   => 'Tattoos, piercings, tattoo artists, and tattoo styles in {{name}}.'
    ];
}
 
function aei_style_archive(array $defaults):array
{
    return array_merge($defaults, [
        'name' => '{{name}}\'s Best Tattoo Artists',
    ]);
}
 
function aei_style_reference_schema(array $defaults):array
{
    return $defaults;
}