<?php
|
// /taxonomies/style.php
|
use JVBase\registrar\Registrar;
|
|
if (!defined('ABSPATH')) {
|
exit;
|
}
|
|
|
add_action('plugins_loaded', 'ajv_style',1);
|
//Add fields later so we can verify taxonomies/post types exist
|
add_action('plugins_loaded', 'ajv_style_fields', 2);
|
|
add_filter('ajv_StyleSchemaDefault', 'ajv_style_schema');
|
add_filter('ajv_StyleMetaDefault', 'ajv_style_meta');
|
add_filter('ajv_StyleArchiveDefault', 'ajv_style_archive');
|
|
function ajv_style(){
|
if (!class_exists('JVBase\registrar\Registrar')) {
|
return;
|
}
|
$style = Registrar::forTerm('style', 'Style', 'Styles')
|
->setIcon('folder')
|
->make([
|
'rewrite' => [
|
'slug' => 'in/style',
|
'with_front' => false,
|
'hierarchical' => true,
|
],
|
'for' => [
|
'art',
|
'design',
|
'development',
|
'strategy',
|
'writing'
|
],
|
'hierarchical' => true,
|
])
|
->setAll([
|
'show_feed',
|
'show_directory'
|
]);
|
}
|
|
function ajv_style_fields():void
|
{
|
if (!class_exists('JVBase\registrar\Registrar')) {
|
return;
|
}
|
$style = Registrar::getInstance('style');
|
|
//$directory = $style->getConfig('directory');
|
//$breadcrumbs = $style->config('breadcrumbs');
|
//$breadcrumbs->setCrumb('project');
|
|
$fields = $style->fields();
|
$fields->addCommon('wiki');
|
$fields->addCommon('alternate_name');
|
$fields->addCommon('keywords');
|
}
|
|
//function ajv_style():array
|
//{
|
// return [
|
// 'directory' => 'Styles',
|
// 'singular' => 'Style',
|
// 'plural' => 'Styles',
|
// 'show_directory' => true,
|
// 'approve_new' => false,
|
// 'icon' => 'folder',
|
// 'favouritable' => true,
|
// 'show_feed' => true,
|
// 'rewrite' => [
|
// 'slug' => 'style',
|
// 'with_front' => false,
|
// 'hierarchical' => true,
|
// ],
|
// 'hierarchical' => true,
|
// 'for_content' => [
|
// 'art',
|
// 'style',
|
// 'development',
|
// 'strategy',
|
// 'writing',
|
// ],
|
// 'seo' => [
|
// 'schema' => [
|
// 'type' => 'DefinedTerm',
|
// 'name' => '{{name}}',
|
// 'description' => '{{description}}',
|
// 'alternateName' => '{{alternate_name}}',
|
// ],
|
// 'meta' => [
|
// 'title' => '{{name}} Style | JakeVan',
|
// 'description' => '{{description}}',
|
// ],
|
// 'archive' => [
|
// 'type' => 'CollectionPage',
|
// 'name' => '{{name}} Projects',
|
// ],
|
// ],
|
// 'fields' => [
|
// 'term_name' => [
|
// 'label' => 'Name',
|
// 'type' => 'text',
|
// 'quickEdit' => true,
|
// ],
|
// 'common' => [ 'wiki', 'alternate_name', 'keywords' ]
|
// ]
|
// ];
|
//}
|
|
|
function ajv_style_schema():array
|
{
|
return [
|
// 'type' => 'JVBase\managers\SEO\render\Thing\CreativeWork\CreativeWork',
|
'name' => '{{name}} | Style',
|
'alternateName' => '{{alternateName}}',
|
'description' => '{{description}}',
|
];
|
}
|
|
function ajv_style_meta():array
|
{
|
return[
|
'name' => '{{name}} | Style',
|
];
|
}
|
|
function ajv_style_archive(array $defaults):array
|
{
|
return array_merge($defaults, [
|
'name' => '{{name}}',
|
]);
|
}
|
|
function ajv_style_reference_schema(array $defaults):array
|
{
|
return $defaults;
|
}
|