From d8295fa518a976e5491eb77a61676e33cfcabb7c Mon Sep 17 00:00:00 2001 From: pgmatev Date: Fri, 3 Jul 2020 17:31:45 +0300 Subject: Created class for Custom Metaboxes --- .../dx-cars/class.taxonomies.hierarchical.php | 28 ++++++++++++++++++++++ .../dx-cars/class.taxonomies.non-hierarchical.php | 11 --------- wp-content/plugins/dx-users/class.cm.php | 15 ++++++++++++ wp-content/plugins/dx-users/dx-users.php | 12 ++++++++++ 4 files changed, 55 insertions(+), 11 deletions(-) create mode 100644 wp-content/plugins/dx-users/class.cm.php create mode 100644 wp-content/plugins/dx-users/dx-users.php (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 45f07ac..6ad44aa 100644 --- a/wp-content/plugins/dx-cars/class.taxonomies.hierarchical.php +++ b/wp-content/plugins/dx-cars/class.taxonomies.hierarchical.php @@ -22,6 +22,23 @@ class TaxonomiesHierarchical { return $arr; } + public function labels_types() { + $arr = array ( + 'name' => _x( 'Types', 'taxonomy general name' ), + 'singular_name' => _x( 'Type', 'taxonomy singular name' ), + 'search_items' => __( 'Search Type', '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' => __( 'Type' ), + ); + return $arr; + } + public function tax_create(){ register_taxonomy( 'vehicle-category', 'vehicles', array( 'hierarchical' => true, @@ -34,5 +51,16 @@ class TaxonomiesHierarchical { 'rewrite' => array( 'slug' => 'vehicle-category' ), ) ); + register_taxonomy( 'car-type', 'vehicles', array( + 'hierarchical' => true, + 'labels' => $this->labels_types(), + '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 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 901a0bd..bcb24f5 100644 --- a/wp-content/plugins/dx-cars/class.taxonomies.non-hierarchical.php +++ b/wp-content/plugins/dx-cars/class.taxonomies.non-hierarchical.php @@ -68,16 +68,5 @@ class Taxonomies { 'rewrite' => array( 'slug' => 'fuel' ), ) ); - 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 diff --git a/wp-content/plugins/dx-users/class.cm.php b/wp-content/plugins/dx-users/class.cm.php new file mode 100644 index 0000000..df2e61a --- /dev/null +++ b/wp-content/plugins/dx-users/class.cm.php @@ -0,0 +1,15 @@ +