setIcon('brain') ->make([ 'rewrite' => [ 'slug' => 'strategy', 'with_front' => false, ], 'taxonomies' => [ 'project', 'form', 'target', 'city' ] ]) ->setAll([ 'show_feed', 'show_directory', 'favouritable' ]); } function ajv_strategy_fields():void { if (!class_exists('JVBase\registrar\Registrar')) { return; } $strategy = Registrar::getInstance('strategy'); //$directory = $strategy->getConfig('directory'); $breadcrumbs = $strategy->config('breadcrumbs'); $breadcrumbs->setCrumb('project'); $fields = $strategy->fields(); $fields->addField('project', [ 'type' => 'selector', 'subtype' => 'taxonomy', 'taxonomy' => 'project', 'label' => 'Project', ]); $fields->addField('form', [ 'type' => 'selector', 'subtype' => 'taxonomy', 'taxonomy' => 'form', 'label' => 'Format', ]); $fields->addField('target', [ 'type' => 'selector', 'subtype' => 'taxonomy', 'taxonomy' => 'target', 'label' => 'Target Audience', ]); $fields->addField('city', [ 'type' => 'selector', 'subtype' => 'taxonomy', 'taxonomy' => 'city', 'label' => 'City', ]); $fields->addField('gallery', [ 'type' => 'upload', 'multiple' => true, 'label' => 'Gallery', ]); $fields->addField('price', [ 'type' => 'number', 'label' => 'Price', ]); $fields->addField('needs', [ 'type' => 'repeater', 'label' => 'Needs', 'fields' => [ 'need' => [ 'type' => 'text', 'label' => 'Need', 'required' => true ], 'image' => [ 'type' => 'upload', 'multiple' => true, 'label' => 'Example Image' ], 'fulfilled' => [ 'type' => 'textarea', 'quill' => true, 'label' => 'How I fulfilled it' ] ] ]); $fields->addField('wants', [ 'type' => 'repeater', 'label' => 'Wants', 'fields' => [ 'need' => [ 'type' => 'text', 'label' => 'Need', 'required' => true ], 'image' => [ 'type' => 'upload', 'multiple' => true, 'label' => 'Example Image' ], 'fulfilled' => [ 'type' => 'textarea', 'quill' => true, 'label' => 'How I fulfilled it' ] ] ]); } function ajv_strategy_extras(array $extras):array { return [[ 'type' => 'JVBase\managers\SEO\render\Thing\Intangible\Service', 'id' => get_post_type_archive_link(BASE.'strategy').'#service', 'name' => 'Best Brand Strategy in Edmonton, Alberta', 'description' => 'Brand strategy services Canadian strategist Jake Vanderwerf. From SEO services to developing your brand identity, target market - or whatever it takes to bring your business to the next level.', 'url' => get_post_type_archive_link(BASE.'strategy'), 'provider' => ['id' => get_home_url(null, '#localbusiness')], 'areaServed' => [ '@type' => 'JVBase\managers\SEO\render\Thing\Place\AdministrativeArea\Country', 'name' => 'Canada' ], ]]; } //function ajv_strategy():array //{ // return [ // 'singular' => 'Strategy', // 'plural' => 'Strategies', // 'hide_single' => false, // 'redirectToAuthor'=> false, // 'show_directory'=> true, // 'directory' => 'Strategy', // 'addCrumb' => 'project', // 'show_feed' => true, // 'favouritable' => true, // 'karma' => false, // 'icon' => 'brain', // 'rewrite' => [ // 'slug' => 'strategy', // 'with_front' => false, // ], // 'seo' => [ // 'schema' => [ // 'type' => 'CreativeWork', // 'name' => '{{post_title}}', // 'description' => '{{post_excerpt}}', // 'about' => ['@id' => '{{site_url}}/#strategy'], // 'associatedMedia' => '{{post_thumbnail}}', // 'dateCreated' => '{{post_date}}', // ], // 'meta' => [ // 'title' => '{{post_title}} | Brand Strategy in Canada', // 'description' => '{{post_excerpt}}', // ], // 'archive' => [ // 'type' => 'CollectionPage', // 'name' => 'Brand Strategy in Canada. Made in Edmonton, Alberta.', // ], // ], // 'feed' => [ // 'single' => [ // 'pre_title' => 'Brand Strategy in Canada. Made in Edmonton, Alberta.', // ], // 'archive' => [ // // ], // 'config' => [ // 'is_gallery' => false, // 'content' => 'strategy', // 'context' => 'strategy', // 'id' => [], // 'class' => [], // ] // ], // 'fields' => [ // 'post_status' => [ // 'type' => 'radio', // 'label' => 'Status', // 'options' => [ // 'publish' => 'Show', // 'draft' => 'Hide', // 'trash' => 'Scrap', // 'delete' => 'Permanently Delete' // ], // 'hidden' => true, // ], // 'post_date' => [ // 'type' => 'date', // 'label' => 'Date', // ], // 'post_title' => [ // 'type' => 'text', // 'label' => 'Title', // ], // 'post_thumbnail' => [ // 'type' => 'upload', // 'label' => 'Image', // ], // 'project' => [ // 'type' => 'taxonomy', // 'taxonomy' => 'project', // 'autocomplete' => true, // 'label' => 'Project', // ], // // 'form' => [ // 'type' => 'taxonomy', // 'taxonomy' => 'form', // 'autocomplete' => true, // 'label' => 'Format', // ], // 'target' => [ // 'type' => 'taxonomy', // 'taxonomy' => 'target', // 'autocomplete' => true, // 'label' => 'Target Audience', // ], // 'city' => [ // 'type' => 'taxonomy', // 'autocomplete' => true, // 'taxonomy' => 'city', // 'label' => 'City', // ], // 'gallery' => [ // 'type' => 'upload', // 'multiple' => true, // 'label' => 'Gallery', // ], // 'price' => [ // 'type' => 'number', // 'label' => 'Price', // ], // 'post_content' => [ // 'type' => 'textarea', // 'quill' => true, // 'label' => 'Notes' // ], // // // 'needs' => [ // 'type' => 'repeater', // 'label' => 'Needs', // 'fields'=> [ // 'need' => [ // 'type' => 'text', // 'label' => 'Need', // 'required' => true // ], // 'image' => [ // 'type' => 'upload', // 'multiple' => true, // 'label' => 'Example Image' // ], // 'fulfilled' => [ // 'type' => 'textarea', // 'quill' => true, // 'label' => 'How I fulfilled it' // ] // ] // ], // 'wants' => [ // 'type' => 'repeater', // 'label' => 'Wants', // 'fields'=> [ // 'need' => [ // 'type' => 'text', // 'label' => 'Want', // 'required' => true // ], // 'image' => [ // 'type' => 'upload', // 'multiple' => true, // 'label' => 'Example Image' // ], // 'fulfilled' => [ // 'type' => 'textarea', // 'quill' => true, // 'label' => 'How I fulfilled it' // ] // ] // ], // ], // 'single_image' => false, // 'upload_title' => 'Upload Strategies', // ]; //} function ajv_prerender_strategy_content(array $block, ?string $content, ?WP_Block $parent):?string { $out = ''; $ID = get_the_ID(); $meta = Meta::forPost($ID); $fields = $meta->getAll(); $bits = []; $excerpt = ''; $rows = []; foreach (['project', 'form', 'city', 'style', 'theme'] as $type) { if (!empty($fields[$type])) { $rows[] = jvbMetaTermList($fields[$type], $type); } } if (!empty($rows)) { $excerpt .= sprintf( '', implode('', array_map(function ($row) { return '
  • '.$row.'
  • '; }, $rows)) ); } if (!empty($fields['post_excerpt']??'')) { $excerpt .= wpautop($fields['post_excerpt']); } if (!empty($excerpt)) { $bits[] = sprintf('

    At a Glance

    %s
    ',$excerpt); } if (!empty($fields['gallery']??'')) { $bits[] = sprintf( '', Image::gallery($fields['gallery']) ); } if (!empty($fields['post_content']??'')) { $bits[] = sprintf( '
    %s
    ', $fields['post_content'] ); } if (!empty($fields['needs']??'')) { $bits[] = ajvb_format_needs($fields['needs']); } if (!empty($fields['wants']??'')) { $bits[] = ajvb_format_wants($fields['wants']); } if (!empty($bits)) { $out = implode('',$bits); } return $out; } function ajv_strategy_schema():array { return [ 'type' => 'JVBase\managers\SEO\render\Thing\CreativeWork\CreativeWork', 'name' => '{{post_title}} | Brand Strategy in Canada', 'description' => '{{post_excerpt}}', 'thumbnail' => '{{post_thumbnail}}', 'dateCreated' => '{{post_date}}', 'dateModified' => '{{post_modified}}', 'keywords' => '{{style.name}}' ]; } function ajv_strategy_meta():array { return[ 'name' => '{{post_title}} | Brand Strategy in Canada', ]; } function ajv_strategy_archive(array $defaults):array { return array_merge($defaults, [ 'name' => 'Brand Strategy in Canada. Made in Edmonton, Alberta.', ]); } function ajv_strategy_reference_schema(array $defaults):array { return $defaults; }