| | |
| | | // /content/development.php |
| | | use JVBase\meta\Meta; |
| | | use JVBase\registrar\Registrar; |
| | | use JVBase\utility\Image; |
| | | |
| | | if (!defined('ABSPATH')) { |
| | | exit; |
| | |
| | | add_filter('ajv_DevelopmentSchemaDefault', 'ajv_development_schema'); |
| | | add_filter('ajv_DevelopmentMetaDefault', 'ajv_development_meta'); |
| | | add_filter('ajv_DevelopmentArchiveDefault', 'ajv_development_archive'); |
| | | add_filter('ajv_DevelopmentExtras', 'ajv_development_extras'); |
| | | |
| | | function ajv_development(){ |
| | | if (!class_exists('JVBase\registrar\Registrar')) { |
| | |
| | | ] |
| | | ]); |
| | | } |
| | | // |
| | | |
| | | function ajv_development_extras(array $extras):array |
| | | { |
| | | return [[ |
| | | 'type' => 'JVBase\managers\SEO\render\Thing\Intangible\Service', |
| | | 'id' => get_post_type_archive_link(BASE.'development').'#service', |
| | | 'name' => 'Custom Website Development in Edmonton, Alberta', |
| | | 'description' => 'Custom website development by Canadian developer Jake Vanderwerf. |
| | | Whether you\'re looking for custom functionality, integration of your services, or a completely custom development solutions.', |
| | | 'url' => get_post_type_archive_link(BASE.'development'), |
| | | 'provider' => ['id' => get_home_url(null, '#localbusiness')], |
| | | 'areaServed' => [ |
| | | '@type' => 'JVBase\managers\SEO\render\Thing\Place\AdministrativeArea\Country', |
| | | 'name' => 'Canada' |
| | | ], |
| | | ]]; |
| | | |
| | | } |
| | | |
| | | //function ajv_development():array |
| | | //{ |
| | | // return [ |
| | |
| | | //} |
| | | |
| | | |
| | | function ajv_render_development_content(array $block, string $content):string |
| | | |
| | | function ajv_prerender_development_content(array $block, ?string $content, ?WP_Block $parent):?string |
| | | { |
| | | $out = ''; |
| | | $ID = get_the_ID(); |
| | |
| | | |
| | | $fields = $meta->getAll(); |
| | | |
| | | |
| | | |
| | | $bits = []; |
| | | if (array_key_exists('post_excerpt', $fields) && !empty($fields['post_excerpt'])) { |
| | | $bits[] = sprintf( |
| | | '<section id="excerpt"><h2>At a Glance</h2>%s</section>', |
| | | jvb_filter_content($fields['post_excerpt']) |
| | | $excerpt = ''; |
| | | |
| | | $rows = []; |
| | | foreach (['project', 'form', 'city', 'style', 'theme'] as $type) { |
| | | |
| | | if (!empty($fields[$type])) { |
| | | $rows[] = jvbMetaTermList($fields[$type], $type); |
| | | } |
| | | |
| | | } |
| | | if (!empty($rows)) { |
| | | $excerpt .= sprintf( |
| | | '<ul class="summary">%s</ul>', |
| | | implode('', array_map(function ($row) { |
| | | return '<li>'.$row.'</li>'; |
| | | }, $rows)) |
| | | ); |
| | | } |
| | | |
| | | if (array_key_exists('url', $fields) && !empty($fields['url'])) { |
| | | if (!empty($fields['post_excerpt']??'')) { |
| | | $excerpt .= wpautop($fields['post_excerpt']); |
| | | } |
| | | if (!empty($excerpt)) { |
| | | $bits[] = sprintf('<section id="summary"><h3>At a Glance</h3>%s</section>',$excerpt); |
| | | } |
| | | |
| | | if (!empty($fields['gallery']??'')) { |
| | | $bits[] = sprintf( |
| | | '<section id="url"><a class="button" href="%s" target="_blank">See it Live</a></section>', |
| | | $fields['url'] |
| | | '<section id="gallery"><h2>Gallery</h2>%s</section>', |
| | | Image::gallery($fields['gallery']) |
| | | ); |
| | | } |
| | | |
| | | 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>'.jvb_filter_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'])) { |
| | | if (!empty($fields['post_content']??'')) { |
| | | $bits[] = sprintf( |
| | | '<section id="content">%s</section>', |
| | | $fields['post_content'] |
| | | ); |
| | | } |
| | | |
| | | if (array_key_exists('needs', $fields) && !empty($fields['needs'])) { |
| | | if (!empty($fields['needs']??'')) { |
| | | $bits[] = ajvb_format_needs($fields['needs']); |
| | | } |
| | | if (array_key_exists('wants', $fields) && !empty($fields['wants'])) { |
| | | if (!empty($fields['wants']??'')) { |
| | | $bits[] = ajvb_format_wants($fields['wants']); |
| | | } |
| | | |
| | |
| | | return [ |
| | | 'type' => 'JVBase\managers\SEO\render\Thing\CreativeWork\CreativeWork', |
| | | 'name' => '{{post_title}} | Canadian Development', |
| | | 'about' => [ |
| | | |
| | | ], |
| | | 'description' => '{{post_excerpt}}', |
| | | 'thumbnail' => '{{post_thumbnail}}', |
| | | 'dateCreated' => '{{post_date}}', |