| | |
| | | 'label' => 'Need', |
| | | 'required' => true |
| | | ], |
| | | 'image' => [ |
| | | 'type' => 'upload', |
| | | 'multiple' => true, |
| | | 'label' => 'Example Image' |
| | | ], |
| | | 'fulfilled' => [ |
| | | 'type' => 'textarea', |
| | | 'quill' => true, |
| | |
| | | 'label' => 'Want', |
| | | 'required' => true |
| | | ], |
| | | 'image' => [ |
| | | 'type' => 'upload', |
| | | 'multiple' => true, |
| | | 'label' => 'Example Image' |
| | | ], |
| | | 'fulfilled' => [ |
| | | 'type' => 'textarea', |
| | | 'quill' => true, |
| | |
| | | |
| | | function ajv_render_art_content(array $block, string $content):string |
| | | { |
| | | $out = ''; |
| | | $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>'; |
| | | $bits = []; |
| | | if (array_key_exists('post_excerpt', $fields) && !empty($fields['post_excerpt'])) { |
| | | $bits[] = sprintf( |
| | | '<section id="excerpt"><h2>At a Glance</h2>%s</section>', |
| | | apply_filters('the_content', $fields['post_excerpt']) |
| | | ); |
| | | } |
| | | |
| | | return $subtitle.$meta.$intro.$meta; |
| | | if (array_key_exists('gallery', $fields) && !empty($fields['gallery'])) { |
| | | $gallery = explode(',',$fields['gallery']); |
| | | $gallery = array_map(function ($imgID) { |
| | | $out = '<figure>'.jvbFormatImage($imgID,'tiny','medium'); |
| | | $caption = wp_get_attachment_caption($imgID); |
| | | $out .= ($caption && $caption !== '') ? '<figcaption>'.apply_filters('the_content', $caption).'</figcaption>' : ''; |
| | | $out .= '</figure>'; |
| | | return $out; |
| | | |
| | | }, $gallery); |
| | | $gallery = implode('',$gallery); |
| | | $bits[] = sprintf( |
| | | '<section id="gallery"><h2>Gallery</h2><div>%s</div></section>', |
| | | $gallery |
| | | ); |
| | | } |
| | | |
| | | if (array_key_exists('post_content', $fields) && !empty($fields['post_content'])) { |
| | | $bits[] = sprintf( |
| | | '<section id="content">%s</section>', |
| | | apply_filters('the_content', $fields['post_content']) |
| | | ); |
| | | } |
| | | |
| | | if (array_key_exists('needs', $fields) && !empty($fields['needs'])) { |
| | | $bits[] = ajvb_format_needs($fields['needs']); |
| | | } |
| | | if (array_key_exists('wants', $fields) && !empty($fields['wants'])) { |
| | | $bits[] = ajvb_format_wants($fields['wants']); |
| | | } |
| | | |
| | | if (!empty($bits)) { |
| | | $out = implode('',$bits); |
| | | } |
| | | |
| | | |
| | | return $out; |
| | | } |