diff options
Created class for Custom Metaboxes
4 files changed, 55 insertions, 11 deletions
| -rw-r--r-- | wp-content/plugins/dx-cars/class.taxonomies.hierarchical.php | 28 | ||||
| -rw-r--r-- | wp-content/plugins/dx-cars/class.taxonomies.non-hierarchical.php | 11 | ||||
| -rw-r--r-- | wp-content/plugins/dx-users/class.cm.php | 15 | ||||
| -rw-r--r-- | wp-content/plugins/dx-users/dx-users.php | 12 |
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 @@ +<?php +class Users { + function init() { + add_action( 'add_meta_boxes', array( $this, 'add_custom_box_user' ) ); + } + function add_custom_box_user() { + $screen = 'user'; + add_meta_box( + 'wporg_box_id', // Unique ID + 'Phone Number', // Box title + 'wporg_custom_box_html', // Content callback, must be of type callable + $screen // Post type + ); + } +} diff --git a/wp-content/plugins/dx-users/dx-users.php b/wp-content/plugins/dx-users/dx-users.php new file mode 100644 index 0000000..a16ab0f --- /dev/null +++ b/wp-content/plugins/dx-users/dx-users.php @@ -0,0 +1,12 @@ +<?php +/** + * Plugin Name: DX Users + * Plugin URI: https://devrix.com + * Description: Plugin for custom user metaboxes + * Version: 0.1 + * Author: DevriX-interns-2020 + * Author URI: https://devrix.com + * Text Domain: dx-users + */ + +defined( 'ABSPATH' ) or die( 'No script kiddies please!' ); |
