<?php
|
// /content/artwork.php
|
|
use JVBase\registrar\Registrar;
|
if (!defined('ABSPATH')) {
|
exit;
|
}
|
|
add_action('jvbDefineRegistrar', 'aei_artwork');
|
add_action('jvbDefineRegistrarFields', 'aei_artwork_fields');
|
|
add_action('plugins_loaded', 'aei_artwork',3);
|
//Add fields later so we can verify taxonomies/post types exist
|
add_action('plugins_loaded', 'aei_artwork_fields', 4);
|
|
add_filter('aei_ArtworkSchemaDefault', 'aei_artwork_schema');
|
add_filter('aei_ArtworkMetaDefault', 'aei_artwork_meta');
|
add_filter('aei_ArtworkArchiveDefault', 'aei_artwork_archive');
|
|
function aei_artwork(){
|
if (!class_exists('JVBase\registrar\Registrar')) {
|
return;
|
}
|
$artwork = Registrar::forPost('artwork', 'Artwork', 'Artwork')
|
->setIcon('artwork')
|
->make([
|
'rewrite' => [
|
'slug' => 'artworks',
|
'with_front' => false,
|
],
|
'taxonomies' => [
|
'city',
|
'art_form',
|
'art_style',
|
'art_theme',
|
],
|
])
|
->setAll([
|
'show_directory',
|
'hide_single',
|
'redirect_to_author',
|
'favouritable',
|
'karma',
|
'show_feed'
|
])
|
->setIntegration('facebook')
|
->setIntegration('instagram');
|
|
//$directory = $artwork->getConfig('directory');
|
|
}
|
|
function aei_artwork_fields():void
|
{
|
if (!class_exists('JVBase\registrar\Registrar')) {
|
return;
|
}
|
$artwork = Registrar::getInstance('artwork');
|
// $breadcrumbs = $artwork->config('breadcrumbs');
|
// $breadcrumbs->setCrumb('section');
|
|
|
$fields = $artwork->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('art_form', [
|
'type' => 'selector',
|
'subtype' => 'taxonomy',
|
'taxonomy' => 'art_form',
|
'label' => 'Art Form',
|
]);
|
$fields->addField('art_style', [
|
'type' => 'selector',
|
'subtype' => 'taxonomy',
|
'taxonomy' => 'art_style',
|
'label' => 'Art Style',
|
]);
|
$fields->addField('art_theme', [
|
'type' => 'selector',
|
'subtype' => 'taxonomy',
|
'taxonomy' => 'art_theme',
|
'label' => 'Theme(s)',
|
'hint' => 'The subject matter, concept, or idea(s) behind the artwork.',
|
]);
|
$fields->addField('city', [
|
'type' => 'selector',
|
'subtype' => 'taxonomy',
|
'taxonomy' => 'city',
|
'label' => 'City',
|
]);
|
|
}
|
|
function aei_artwork_schema():array
|
{
|
return [
|
'type' => 'JVBase\managers\SEO\render\Thing\CreativeWork\VisualArtwork',
|
'name' => '{{post_title}} | by {{post_author.name}} {{post_author.city}} Artwork Artist',
|
];
|
}
|
|
function aei_artwork_meta():array
|
{
|
return[
|
'name' => '{{post_title}} | by {{post_author.name}} {{post_author.city}} Artwork Artist',
|
'description' => '{{style}} {{colour}} {{theme}} artwork in {{post_author.city}}.',
|
];
|
}
|
|
function aei_artwork_archive(array $defaults):array
|
{
|
return array_merge($defaults, [
|
'name' => 'Edmonton\'s Best Artwork',
|
'description' => 'Artwork in Edmonton, Alberta.'
|
]);
|
}
|
|
function aei_artwork_reference_schema(array $defaults):array
|
{
|
return $defaults;
|
}
|