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
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
| <?php
| // /content/terms.php
|
| use JVBase\registrar\Registrar;
| if (!defined('ABSPATH')) {
| exit;
| }
|
|
| add_action('jvbDefineRegistrar', 'altr_terms');
| add_action('jvbDefineRegistrarFields', 'altr_terms_fields');
|
| add_action('plugins_loaded', 'altr_terms',1);
| //Add fields later so we can verify taxonomies/post types exist
| add_action('plugins_loaded', 'altr_terms_fields', 2);
|
| add_filter('altr_TermsSchemaDefault', 'altr_terms_schema');
| add_filter('altr_TermsMetaDefault', 'altr_terms_meta');
| add_filter('altr_TermsArchiveDefault', 'altr_terms_archive');
|
| function altr_terms(){
| if (!class_exists('JVBase\registrar\Registrar')) {
| return;
| }
| $terms = Registrar::forPost('terms', 'Term', 'Terms')
| ->setIcon('asterisk')
| ->make([
| 'rewrite' => [
| 'slug' => 'glossary',
| 'with_front' => false,
| ],
| 'taxonomies' => [
| 'section',
| ]
| ])
| ->setAll([
| 'show_directory',
| 'hide_single',
| 'is_glossary',
| ]);
|
| //$directory = $terms->getConfig('directory');
|
| }
|
| function altr_terms_fields():void
| {
| if (!class_exists('JVBase\registrar\Registrar')) {
| return;
| }
| $terms = Registrar::getInstance('terms');
|
| $fields = $terms->fields();
| $fields->addField('pronunciation', [
| 'type' => 'repeater',
| 'label' => 'Pronunciation',
| 'fields' => [
| 'part' => [
| 'type' => 'text',
| 'label' => 'Part',
| ]
| ]
| ]);
| $fields->addField('type', [
| 'type' => 'radio',
| 'label' => 'Type',
| 'options' => [
| 'adjective',
| 'noun',
| 'verb'
| ]
| ]);
|
| $dashboard = $terms->config('dashboard');
| $dashboard->setTitle('Glossary');
| $dashboard->setDescription('Manage your terms');
|
|
| }
|
| function altr_terms_schema():array
| {
| return [
| 'type' => 'JVBase\managers\SEO\render\Thing\Intangible\DefinedTerm',
| 'name' => '{{post_title}} | What it Means',
| 'description' => '{{post_content}}'
| ];
| }
|
| function altr_terms_meta():array
| {
| return[
| 'name' => '{{post_title}} | What it Means',
| ];
| }
|
|
| function altr_terms_archive(array $defaults):array
| {
| return array_merge($defaults, [
| 'mainEntity' => [
| 'type' => 'JVBase\managers\SEO\render\Thing\CreativeWork\DefinedTermSet',
| 'id' => 'glossary-of-terms',
| 'name' => 'Glossary of Terms',
| 'description' => 'Brief definitions of terms and how they relate with laser tattoo removal.'
| ],
|
| 'name' => 'Glossary of Terms',
| 'description' => 'Brief definitions of terms and how they relate with laser tattoo removal.'
| ]);
| }
|
| function altr_terms_reference_schema(array $defaults):array
| {
| return $defaults;
| }
| //
| //function altr_terms():array
| //{
| // return [
| // 'singular' => 'Term',
| // 'plural' => 'Terms',
| // 'dash_title' => 'Glossary',
| // 'dash_description' => 'Manage your terms',
| // 'breadcrumb' => 'Glossary',
| // 'hide_single' => true,
| // 'icon' => 'asterisk',
| // 'is_gallery' => true,
| // 'seo' => [
| // 'schema' => [
| // 'type' => 'DefinedTerm',
| // 'name' => '{{post_title}}',
| // 'description' => '{{post_content}}'
| // ],
| // 'archive' => [
| // 'type' => 'DefinedTermSet',
| // ]
| // ],
| // 'rewrite' => [
| // 'slug' => 'glossary',
| // 'with_front' => false,
| // ],
| // 'fields' => [
| // 'post_title' => [
| // 'type' => 'text',
| // 'label' => 'Title',
| // ],
| // 'post_status' => [
| // 'type' => 'radio',
| // 'label' => 'Status',
| // 'hidden' => true,
| // 'options' => [
| // 'publish' => 'Show',
| // 'draft' => 'Hide',
| // 'trash' => 'Scrap',
| // 'delete' => 'Permanently Delete'
| // ]
| // ],
| // 'post_slug' => [
| // 'type' => 'text',
| // 'label' => 'Slug'
| // ],
| // 'post_content' => [
| // 'type' => 'textarea',
| // 'label' => 'Definition',
| // 'quill' => true,
| // ],
| // 'pronunciation' => [
| // 'type' => 'repeater',
| // 'label' => 'Pronunciation',
| // 'fields' => [
| // 'part' => [
| // 'type' => 'text',
| // 'label' => 'Part',
| // ]
| // ]
| // ],
| // 'type' => [
| // 'type' => 'radio',
| // 'label' => 'Type',
| // 'options' => [
| // 'adjective',
| // 'noun',
| // 'verb'
| // ]
| // ]
| // ],
| // 'single_image' => false,
| // 'upload_title' => 'Upload Before & Afters',
| // ];
| //}
|
|