| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) { |
| 3 |
exit; |
| 4 |
} |
| 5 |
class WPCargo_Post_Types{ |
| 6 |
public static function init(){ |
| 7 |
add_action('init', array( __CLASS__, 'wpcargo_post_type' ), 0 ); |
| 8 |
} |
| 9 |
public static function wpcargo_post_type(){ |
| 10 |
$labels_menu = array( |
| 11 |
'name' => _x('Shipment', 'Shipment', 'wpcargo'), |
| 12 |
'singular_name' => _x('Shipment', 'Shipment', 'wpcargo'), |
| 13 |
'menu_name' => esc_html__('Shipment', 'wpcargo'), |
| 14 |
'all_items' => esc_html__('All Shipment', 'wpcargo'), |
| 15 |
'view_item' => esc_html__('View Shipment', 'wpcargo'), |
| 16 |
'add_new_item' => esc_html__('Add New Shipment', 'wpcargo'), |
| 17 |
'add_new' => esc_html__('Add Shipment', 'wpcargo'), |
| 18 |
'edit_item' => esc_html__('Edit Shipment', 'wpcargo'), |
| 19 |
'update_item' => esc_html__('Update Shipment', 'wpcargo'), |
| 20 |
'search_items' => esc_html__('Search Shipment', 'wpcargo'), |
| 21 |
'not_found' => esc_html__('Shipment Not found', 'wpcargo'), |
| 22 |
'not_found_in_trash' => esc_html__('Shipment Not found in Trash', 'wpcargo') |
| 23 |
); |
| 24 |
$wpcargo_supports = array( 'title', 'author', 'thumbnail', 'revisions' ); |
| 25 |
$args_tag = array( |
| 26 |
'label' => esc_html__('Shipment', 'wpcargo'), |
| 27 |
'description' => esc_html__('Shipment', 'wpcargo'), |
| 28 |
'labels' => $labels_menu, |
| 29 |
'supports' => $wpcargo_supports, |
| 30 |
'taxonomies' => array( 'wpcargo_shipment', 'post_tag' ), |
| 31 |
'menu_icon' => 'dashicons-location-alt', |
| 32 |
'hierarchical' => true, |
| 33 |
'public' => false, |
| 34 |
'show_ui' => true, |
| 35 |
'show_in_menu' => true, |
| 36 |
'show_in_nav_menus' => true, |
| 37 |
'show_in_admin_bar' => true, |
| 38 |
'menu_position' => 5, |
| 39 |
'can_export' => true, |
| 40 |
'has_archive' => false, |
| 41 |
'exclude_from_search' => true, |
| 42 |
'publicly_queryable' => false, |
| 43 |
'capability_type' => 'post' |
| 44 |
); |
| 45 |
register_post_type('wpcargo_shipment', $args_tag); |
| 46 |
$labels_cat = array( |
| 47 |
'name' => _x('Category', 'Category', 'wpcargo'), |
| 48 |
'singular_name' => _x('Category', 'Category', 'wpcargo'), |
| 49 |
'search_items' => esc_html__('Search Category', 'wpcargo'), |
| 50 |
'all_items' => esc_html__('All Category', 'wpcargo'), |
| 51 |
'parent_item' => esc_html__('Parent Category', 'wpcargo'), |
| 52 |
'parent_item_colon' => esc_html__('Parent Category:', 'wpcargo'), |
| 53 |
'edit_item' => esc_html__('Edit Category', 'wpcargo'), |
| 54 |
'update_item' => esc_html__('Update Category', 'wpcargo'), |
| 55 |
'add_new_item' => esc_html__('Add New Category', 'wpcargo'), |
| 56 |
'new_item_name' => esc_html__('New Category Name', 'wpcargo'), |
| 57 |
'menu_name' => esc_html__('Category', 'wpcargo') |
| 58 |
); |
| 59 |
$args_cat = array( |
| 60 |
'hierarchical' => true, |
| 61 |
'labels' => $labels_cat, |
| 62 |
'show_ui' => true, |
| 63 |
'show_admin_column' => true, |
| 64 |
'query_var' => true |
| 65 |
); |
| 66 |
register_taxonomy('wpcargo_shipment_cat', array( 'wpcargo_shipment' ), $args_cat, 20); |
| 67 |
} |
| 68 |
} |
| 69 |
WPCargo_Post_Types::init(); |
| 70 |
|