<?php
|
// /content/piercing.php
|
|
use JVBase\registrar\Registrar;
|
if (!defined('ABSPATH')) {
|
exit;
|
}
|
|
add_action('jvbDefineRegistrar', 'aei_piercing');
|
add_action('jvbDefineRegistrarFields', 'aei_piercing_fields');
|
|
add_action('plugins_loaded', 'aei_piercing',3);
|
//Add fields later so we can verify taxonomies/post types exist
|
add_action('plugins_loaded', 'aei_piercing_fields', 4);
|
|
add_filter('aei_PiercingSchemaDefault', 'aei_piercing_schema');
|
add_filter('aei_PiercingMetaDefault', 'aei_piercing_meta');
|
add_filter('aei_PiercingArchiveDefault', 'aei_piercing_archive');
|
|
function aei_piercing(){
|
if (!class_exists('JVBase\registrar\Registrar')) {
|
return;
|
}
|
$piercing = Registrar::forPost('piercing', 'Piercing', 'Piercings')
|
->setIcon('piercing')
|
->make([
|
'rewrite' => [
|
'slug' => 'piercings',
|
'with_front' => false,
|
],
|
'taxonomies' => [
|
'city',
|
'piercing_placement',
|
'piercing_style',
|
],
|
])
|
->setAll([
|
'show_directory',
|
'hide_single',
|
'redirect_to_author',
|
'favouritable',
|
'karma',
|
'show_feed'
|
])
|
->setIntegration('facebook')
|
->setIntegration('instagram');
|
|
//$directory = $piercing->getConfig('directory');
|
|
}
|
|
function aei_piercing_fields():void
|
{
|
if (!class_exists('JVBase\registrar\Registrar')) {
|
return;
|
}
|
$piercing = Registrar::getInstance('piercing');
|
// $breadcrumbs = $piercing->config('breadcrumbs');
|
// $breadcrumbs->setCrumb('section');
|
|
|
$fields = $piercing->fields();
|
$fields->modifyField('post_thumbnail', 'label', 'Main Image');
|
$fields->modifyField('post_content', 'label', 'Notes (optional)');
|
$fields->addField('gallery', [
|
'type' => 'upload',
|
'label' => 'Additional Images',
|
]);
|
$fields->addField('piercing_placement', [
|
'type' => 'selector',
|
'subtype' => 'taxonomy',
|
'taxonomy' => 'piercing_placement',
|
'label' => 'Placement',
|
]);
|
$fields->addField('piercing_style', [
|
'type' => 'selector',
|
'subtype' => 'taxonomy',
|
'taxonomy' => 'piercing_style',
|
'label' => 'Piercing Style',
|
]);
|
}
|
|
function aei_piercing_schema():array
|
{
|
return [
|
'type' => 'JVBase\managers\SEO\render\Thing\CreativeWork\VisualArtwork',
|
'name' => '{{post_title}} | by {{post_author.name}} {{post_author.city}} Piercer',
|
];
|
}
|
|
function aei_piercing_meta():array
|
{
|
return[
|
'name' => '{{post_title}} | by {{post_author.name}} {{post_author.city}} Piercer',
|
'description' => '{{style}} {{colour}} {{theme}} piercing in {{post_author.city}}.',
|
];
|
}
|
|
function aei_piercing_archive(array $defaults):array
|
{
|
return array_merge($defaults, [
|
'name' => 'Edmonton\'s Best Piercings',
|
'description' => 'Piercings in Edmonton, Alberta.'
|
]);
|
}
|
|
function aei_piercing_reference_schema(array $defaults):array
|
{
|
return $defaults;
|
}
|