Inventory_Presser_Plugin::create_post_type()
Registers the post type that holds vehicles.
Return Return
(void)
Source Source
File: inventory-presser.php
// Exit early, this method runs often in the dashboard. if ( false !== $termlink && '/category' === substr( $termlink, 0, 9 ) ) { return $termlink; } $taxonomy = get_taxonomy( strtolower( $term->taxonomy ) ); if ( ! empty( $taxonomy->object_type ) && ! in_array( INVP::POST_TYPE, $taxonomy->object_type, true ) ) { return $termlink; } $post_type = get_post_type_object( INVP::POST_TYPE ); if ( empty( $post_type ) ) { return $termlink; } $termlink = $post_type->rewrite['slug'] . $termlink; return $termlink; } /** * Registers the post type that holds vehicles. * * @return void */ public static function create_post_type() { // creates a custom post type that will be used by this plugin. register_post_type( INVP::POST_TYPE, apply_filters( 'invp_post_type_args', array( 'capability_type' => INVP::POST_TYPE, 'map_meta_cap' => true, 'description' => __( 'Vehicles for sale', 'inventory-presser' ), 'has_archive' => true, 'hierarchical' => false, 'labels' => array( 'name' => _x( 'Vehicles', 'Post type general name', 'inventory-presser' ), 'singular_name' => _x( 'Vehicle', 'Post type singular name', 'inventory-presser' ), 'menu_name' => _x( 'Vehicles', 'Admin Menu text', 'inventory-presser' ), 'name_admin_bar' => _x( 'Vehicle', 'Add New on Toolbar', 'inventory-presser' ), 'add_new' => __( 'Add New', 'inventory-presser' ), 'add_new_item' => __( 'Add New Vehicle', 'inventory-presser' ), 'new_item' => __( 'New Vehicle', 'inventory-presser' ), 'edit_item' => __( 'Edit Vehicle', 'inventory-presser' ), 'view_item' => __( 'View Vehicle', 'inventory-presser' ), 'all_items' => __( 'All Vehicles', 'inventory-presser' ), 'search_items' => __( 'Search Vehicles', 'inventory-presser' ), 'parent_item_colon' => __( 'Parent Vehicles:', 'inventory-presser' ), 'not_found' => __( 'No vehicles found.', 'inventory-presser' ), 'not_found_in_trash' => __( 'No vehicles found in Trash.', 'inventory-presser' ), 'archives' => _x( 'Inventory', 'The post type archive label used in nav menus. Default “Post Archives”. Added in 4.4', 'inventory-presser' ), 'insert_into_item' => _x( 'Attach to vehicle', 'Overrides the “Insert into post”/”Insert into page” phrase (used when inserting media into a post). Added in 4.4', 'inventory-presser' ),
Expand full source codeCollapse full source codeView on Github