| | |
| | | <?php |
| | | // /taxonomies/city.php |
| | | function ajv_city():array |
| | | use JVBase\registrar\Registrar; |
| | | |
| | | if (!defined('ABSPATH')) { |
| | | exit; |
| | | } |
| | | |
| | | |
| | | add_action('plugins_loaded', 'ajv_city',1); |
| | | //Add fields later so we can verify taxonomies/post types exist |
| | | add_action('plugins_loaded', 'ajv_city_fields', 2); |
| | | |
| | | add_filter('ajv_CitySchemaDefault', 'ajv_city_schema'); |
| | | add_filter('ajv_CityMetaDefault', 'ajv_city_meta'); |
| | | add_filter('ajv_CityArchiveDefault', 'ajv_city_archive'); |
| | | |
| | | function ajv_city(){ |
| | | if (!class_exists('JVBase\registrar\Registrar')) { |
| | | return; |
| | | } |
| | | $city = Registrar::forTerm('city', 'City', 'Cities') |
| | | ->setIcon('city') |
| | | ->make([ |
| | | 'rewrite' => [ |
| | | 'slug' => 'in/city', |
| | | 'with_front' => false, |
| | | 'hierarchical' => true, |
| | | ], |
| | | 'for' => [ |
| | | 'art', |
| | | 'design', |
| | | 'development', |
| | | 'strategy', |
| | | 'writing' |
| | | ], |
| | | 'hierarchical' => true, |
| | | ]) |
| | | ->setAll([ |
| | | 'show_feed', |
| | | 'show_directory' |
| | | ]); |
| | | } |
| | | |
| | | function ajv_city_fields():void |
| | | { |
| | | if (!class_exists('JVBase\registrar\Registrar')) { |
| | | return; |
| | | } |
| | | $city = Registrar::getInstance('city'); |
| | | |
| | | //$directory = $city->getConfig('directory'); |
| | | // $breadcrumbs = $city->config('breadcrumbs'); |
| | | // $breadcrumbs->setCrumb('project'); |
| | | |
| | | $fields = $city->fields(); |
| | | $fields->addCommon('wiki'); |
| | | $fields->addField( |
| | | 'province', |
| | | [ |
| | | 'type' => 'text', |
| | | 'label' => 'Province' |
| | | ] |
| | | ); |
| | | $fields->addField( |
| | | 'country', |
| | | [ |
| | | 'type' => 'text', |
| | | 'label' => 'Country' |
| | | ] |
| | | ); |
| | | } |
| | | |
| | | |
| | | |
| | | function ajv_city_schema():array |
| | | { |
| | | return [ |
| | | 'singular' => 'City', |
| | | 'plural' => 'Cities', |
| | | 'icon' => 'city', |
| | | 'description' => [ |
| | | 'From Edmonton, yes - but also throughout Alberta.' |
| | | // 'type' => 'JVBase\managers\SEO\render\Thing\CreativeWork\CreativeWork', |
| | | 'name' => '{{name}} | Canadian City', |
| | | 'about' => [ |
| | | 'type' => 'JVBase\managers\SEO\render\Thing\Place\AdministrativeArea\City', |
| | | 'name' => '{{name}}', |
| | | ], |
| | | 'show_feed' => true, |
| | | 'show_directory' => true, |
| | | 'approve_new' => false, |
| | | 'rewrite' => [ |
| | | 'slug' => 'in', |
| | | 'with_front' => false, |
| | | 'hierarchical' => true, |
| | | ], |
| | | 'hierarchical' => true, |
| | | 'for_content' => [ |
| | | 'art', |
| | | 'design', |
| | | 'development', |
| | | 'strategy', |
| | | 'writing', |
| | | ], |
| | | 'seo' => [ |
| | | 'schema' => [ |
| | | 'type' => 'City', |
| | | 'name' => '{{term_name}}', |
| | | 'description' => '{{term_description}}', |
| | | 'containedInPlace' => '{{site_url}}/#organization', |
| | | ], |
| | | 'meta' => [ |
| | | 'title' => 'Projects in {{term_name}} | JakeVan', |
| | | 'description' => 'Art, design, development, and strategy projects in {{term_name}}.', |
| | | ], |
| | | 'archive' => [ |
| | | 'type' => 'CollectionPage', |
| | | 'name' => 'Projects in {{term_name}}', |
| | | ], |
| | | ], |
| | | 'fields' => [ |
| | | 'term_name' => [ |
| | | 'label' => 'Name', |
| | | 'type' => 'text', |
| | | 'quickEdit' => true, |
| | | ], |
| | | 'common' => [ 'wiki' ] |
| | | ] |
| | | 'description' => '{{description}}', |
| | | ]; |
| | | } |
| | | |
| | | function ajv_city_meta():array |
| | | { |
| | | return[ |
| | | 'name' => 'Projects in {{name}}', |
| | | 'description' => 'Art, Design, Development, Strategy, and Content Writing projects in {{name}}.' |
| | | ]; |
| | | } |
| | | |
| | | function ajv_city_archive(array $defaults):array |
| | | { |
| | | return array_merge($defaults, [ |
| | | 'name' => 'Projects in {{name}}', |
| | | ]); |
| | | } |
| | | |
| | | function ajv_city_reference_schema(array $defaults):array |
| | | { |
| | | return $defaults; |
| | | } |