From 586d0d23dd5dbd9bc906544eb7b8aeabe643cee5 Mon Sep 17 00:00:00 2001 From: pgmatev Date: Fri, 3 Jul 2020 15:47:50 +0300 Subject: Changed Types to Categories; Added Non-hierarchical Types --- .../dx-cars/class.taxonomies.hierarchical.php | 26 +++++++++++----------- .../dx-cars/class.taxonomies.non-hierarchical.php | 22 +++++++++--------- 2 files changed, 25 insertions(+), 23 deletions(-) (limited to 'wp-content/plugins') diff --git a/wp-content/plugins/dx-cars/class.taxonomies.hierarchical.php b/wp-content/plugins/dx-cars/class.taxonomies.hierarchical.php index 22293ec..45f07ac 100644 --- a/wp-content/plugins/dx-cars/class.taxonomies.hierarchical.php +++ b/wp-content/plugins/dx-cars/class.taxonomies.hierarchical.php @@ -7,23 +7,23 @@ class TaxonomiesHierarchical { } public function labels() { $arr = array ( - 'name' => _x( 'Types', 'taxonomy general name' ), - 'singular_name' => _x( 'Type', 'taxonomy singular name' ), - 'search_items' => __( 'Search Types', 'textdomain' ), - 'all_items' => __( 'All Types', 'textdomain' ), - 'parent_item' => __( 'Parent Type', 'textdomain' ), - 'parent_item_colon' => __( 'Parent Type:', 'textdomain' ), - 'edit_item' => __( 'Edit Type' ), - 'update_item' => __( 'Update Type' ), - 'add_new_item' => __( 'Add New Type' ), - 'new_item_name' => __( 'New Type Name' ), - 'menu_name' => __( 'Types' ), + 'name' => _x( 'Categories', 'taxonomy general name' ), + 'singular_name' => _x( 'Category', 'taxonomy singular name' ), + 'search_items' => __( 'Search Category', 'textdomain' ), + 'all_items' => __( 'All Category', 'textdomain' ), + 'parent_item' => __( 'Parent Category', 'textdomain' ), + 'parent_item_colon' => __( 'Parent Category:', 'textdomain' ), + 'edit_item' => __( 'Edit Category' ), + 'update_item' => __( 'Update Category' ), + 'add_new_item' => __( 'Add New Category' ), + 'new_item_name' => __( 'New Category Name' ), + 'menu_name' => __( 'Category' ), ); return $arr; } public function tax_create(){ - register_taxonomy( 'vehicle-type', 'vehicles', array( + register_taxonomy( 'vehicle-category', 'vehicles', array( 'hierarchical' => true, 'labels' => $this->labels(), 'show_ui' => true, @@ -31,7 +31,7 @@ class TaxonomiesHierarchical { 'show_in_rest' => true, 'update_count_callback' => '_update_post_term_count', 'query_var' => true, - 'rewrite' => array( 'slug' => 'vehicle-type' ), + 'rewrite' => array( 'slug' => 'vehicle-category' ), ) ); } diff --git a/wp-content/plugins/dx-cars/class.taxonomies.non-hierarchical.php b/wp-content/plugins/dx-cars/class.taxonomies.non-hierarchical.php index d851422..901a0bd 100644 --- a/wp-content/plugins/dx-cars/class.taxonomies.non-hierarchical.php +++ b/wp-content/plugins/dx-cars/class.taxonomies.non-hierarchical.php @@ -5,6 +5,7 @@ class Taxonomies { function init() { add_action( 'init', array( $this, 'tax_create' ) , 999 ); } + public function labels($name) { $arr = array ( 'name' => _x( $name.'s', 'taxonomy general name' ), @@ -67,15 +68,16 @@ class Taxonomies { 'rewrite' => array( 'slug' => 'fuel' ), ) ); - // register_taxonomy( 'type', 'vehicles', array( - // 'hierarchical' => false, - // 'labels' => $this->labels(), - // 'show_ui' => true, - // 'show_admin_column' => true, - // 'update_count_callback' => '_update_post_term_count', - // 'query_var' => true, - // 'rewrite' => array( 'slug' => 'type' ), - // ) - // ) + register_taxonomy( 'car-type', 'vehicles', array( + 'hierarchical' => false, + 'labels' => $this->labels('Type'), + 'show_ui' => true, + 'show_admin_column' => true, + 'show_in_rest' => true, + 'update_count_callback' => '_update_post_term_count', + 'query_var' => true, + 'rewrite' => array( 'slug' => 'car-type' ), + ) + ); } } \ No newline at end of file -- cgit v1.3.1-26-gb76a