| | |
| | | <?php |
| | | // /content/art.php |
| | | use JVBase\meta\Meta; |
| | | |
| | | function ajv_art():array |
| | | { |
| | | return [ |
| | |
| | | 'plural' => 'Art', |
| | | 'dash_title' => 'Art', |
| | | 'dash_description' => 'Manage your art posts', |
| | | 'directory' => 'Art', |
| | | 'breadcrumb' => 'Art', |
| | | 'addCrumb' => 'form', |
| | | 'hide_single' => false, |
| | | 'show_feed' => true, |
| | | 'show_directory'=> true, |
| | | 'favouritable' => true, |
| | | 'karma' => false, |
| | | 'icon' => 'palette', |
| | | 'seo' => [ |
| | | 'schema' => [ |
| | | 'type' => 'VisualArtwork', |
| | | 'name' => '{{post_title}}', |
| | | 'description' => '{{post_excerpt}}', |
| | | 'about' => ['@id' => '{{site_url}}/#art'], |
| | | 'associatedMedia' => '{{post_thumbnail}}', |
| | | 'dateCreated' => '{{post_date}}', |
| | | // artform, artMedium, creator, keywords auto-enriched by VisualArtworkResolver |
| | | ], |
| | | 'meta' => [ |
| | | 'title' => '{{post_title}} — {{form.name}} Art | Handmade. Human.', |
| | | 'description' => '{{post_excerpt}}', |
| | | ], |
| | | 'archive' => [ |
| | | 'type' => 'CollectionPage', |
| | | 'name' => 'Canadian Art. Made in Edmonton, Alberta.', |
| | | 'description' => 'Handmade sculpture, jewelry, and more from Edmonton, Alberta.', |
| | | ], |
| | | ], |
| | | 'feed' => [ |
| | | 'single' => [ |
| | | 'pre_title' => 'Canadian Art. Made in Edmonton, Alberta.', |
| | | ], |
| | | 'archive' => [ |
| | | |
| | | ], |
| | | 'config' => [ |
| | | 'is_gallery' => false, |
| | | 'content' => 'art', |
| | | 'context' => 'art', |
| | | 'id' => [], |
| | | 'class' => [], |
| | | ] |
| | | ], |
| | | 'rewrite' => [ |
| | | 'slug' => 'art', |
| | | 'with_front' => false, |
| | | ], |
| | | |
| | | 'fields' => [ |
| | | 'post_status' => [ |
| | | 'type' => 'radio', |
| | | 'label' => 'Status', |
| | | 'options' => [ |
| | | 'publish' => 'Show', |
| | | 'draft' => 'Hide', |
| | | 'trash' => 'Scrap', |
| | | 'delete' => 'Permanently Delete' |
| | | ], |
| | | 'hidden' => true, |
| | | ], |
| | | 'post_title' => [ |
| | | 'type' => 'text', |
| | | 'label' => 'Title', |
| | | ], |
| | | 'featured_image' => [ |
| | | 'type' => 'image', |
| | | 'post_date' => [ |
| | | 'type' => 'date', |
| | | 'label' => 'Date', |
| | | ], |
| | | 'city' => [ |
| | | 'type' => 'taxonomy', |
| | | 'taxonomy' => 'city', |
| | | 'autocomplete' => true, |
| | | 'label' => 'City', |
| | | ], |
| | | 'form' => [ |
| | | 'type' => 'taxonomy', |
| | | 'taxonomy' => 'form', |
| | | 'autocomplete' => true, |
| | | 'label' => 'Art Form', |
| | | ], |
| | | 'media' => [ |
| | | 'type' => 'taxonomy', |
| | | 'taxonomy' => 'media', |
| | | 'autocomplete' => true, |
| | | 'label' => 'Media', |
| | | ], |
| | | 'style' => [ |
| | | 'type' => 'taxonomy', |
| | | 'taxonomy' => 'style', |
| | | 'autocomplete' => true, |
| | | 'label' => 'Style', |
| | | ], |
| | | 'theme' => [ |
| | | 'type' => 'taxonomy', |
| | | 'taxonomy' => 'theme', |
| | | 'autocomplete' => true, |
| | | 'label' => 'Theme', |
| | | ], |
| | | 'project' => [ |
| | | 'type' => 'taxonomy', |
| | | 'taxonomy' => 'project', |
| | | 'autocomplete' => true, |
| | | 'label' => 'Project', |
| | | ], |
| | | 'post_thumbnail' => [ |
| | | 'type' => 'upload', |
| | | 'label' => 'Image', |
| | | ], |
| | | 'gallery' => [ |
| | | 'type' => 'gallery', |
| | | 'type' => 'upload', |
| | | 'multiple'=> 'true', |
| | | 'label' => 'Gallery', |
| | | ], |
| | | 'price' => [ |
| | | 'type' => 'number', |
| | | 'label' => 'Price', |
| | | ], |
| | | 'post_excerpt' => [ |
| | | 'type' => 'textarea', |
| | | 'label' => 'Short Blurb', |
| | | ], |
| | | 'post_content' => [ |
| | | 'type' => 'textarea', |
| | | 'quill' => true, |
| | | 'label' => 'Notes' |
| | | ] |
| | | ], |
| | | 'needs' => [ |
| | | 'type' => 'repeater', |
| | | 'label' => 'Needs', |
| | | 'fields'=> [ |
| | | 'need' => [ |
| | | 'type' => 'text', |
| | | 'label' => 'Need', |
| | | 'required' => true |
| | | ], |
| | | 'fulfilled' => [ |
| | | 'type' => 'textarea', |
| | | 'quill' => true, |
| | | 'label' => 'How I fulfilled it' |
| | | ] |
| | | ] |
| | | ], |
| | | 'wants' => [ |
| | | 'type' => 'repeater', |
| | | 'label' => 'Wants', |
| | | 'fields'=> [ |
| | | 'need' => [ |
| | | 'type' => 'text', |
| | | 'label' => 'Want', |
| | | 'required' => true |
| | | ], |
| | | 'fulfilled' => [ |
| | | 'type' => 'textarea', |
| | | 'quill' => true, |
| | | 'label' => 'How I fulfilled it' |
| | | ] |
| | | ] |
| | | ], |
| | | ], |
| | | 'single_image' => false, |
| | | 'upload_title' => 'Upload Artwork', |
| | | ]; |
| | | } |
| | | |
| | | function ajv_render_art_content(array $block, string $content):string |
| | | { |
| | | $ID = get_the_ID(); |
| | | $meta = Meta::forPost($ID); |
| | | $fields = $meta->getAll(); |
| | | |
| | | $city = (empty($fields['city'])) ? 'Edmonton' : jvbGetTermLink((int)$fields['city']); |
| | | $form = (empty($fields['form'])) ? 'art' : jvbGetTermLink((int)$fields['form']); |
| | | |
| | | $style = (empty($fields['style'])) ? '' : jvbGetTermLink(explode(',',$fields['style'])[0]).' '; |
| | | $subtitle = '<h2 class="subtitle">'.$city.' handmade '.$style.'<b>'.$form.'</b>.</h2>'; |
| | | |
| | | |
| | | /** INTRO **/ |
| | | $intro = '<section id="intro" class="row"><div class="text">'.apply_filters('wpautop', $fields['post_excerpt']).'</div><div class="images">'; |
| | | $intro .= (!empty($fields['post_thumbnail'])) ? jvbImageCaption($fields['post_thumbnail']) : ''; |
| | | if (!empty($fields['gallery'])) { |
| | | $images = explode(',',$fields['gallery']); |
| | | foreach ($images as $image) { |
| | | $intro .= jvbImageCaption($image, 'tiny', 'medium'); |
| | | } |
| | | } |
| | | $intro .= '</section>'; |
| | | |
| | | |
| | | /** META **/ |
| | | $taxonomies = ['city', 'project','form', 'media','style','theme']; |
| | | $meta = ''; |
| | | foreach ($taxonomies as $taxonomy) { |
| | | if (!empty($fields[$taxonomy])) { |
| | | $icon = jvbIcon(JVB_TAXONOMY[$taxonomy]['icon'])??''; |
| | | $meta .= jvbRenderTermList($fields[$taxonomy], $icon.JVB_TAXONOMY[$taxonomy]['singular']); |
| | | } |
| | | } |
| | | if ($meta !== '') { |
| | | $meta = '<section class="meta">'.$meta.'</section>'; |
| | | } |
| | | |
| | | return $subtitle.$meta.$intro.$meta; |
| | | } |