$many, 'singular_name' => $one, 'menu_name' => _x( 'AumNexCart', 'admin menu', 'aumnexcart' ), 'name_admin_bar' => $one, 'add_new' => _x( 'Add New', 'product', 'aumnexcart' ), /* translators: %s is the singular product label */ 'add_new_item' => sprintf( __( 'Add New %s', 'aumnexcart' ), $one ), /* translators: %s is the singular product label */ 'new_item' => sprintf( __( 'New %s', 'aumnexcart' ), $one ), /* translators: %s is the singular product label */ 'edit_item' => sprintf( __( 'Edit %s', 'aumnexcart' ), $one ), /* translators: %s is the singular product label */ 'view_item' => sprintf( __( 'View %s', 'aumnexcart' ), $one ), /* translators: %s is the plural product label */ 'all_items' => sprintf( __( 'All %s', 'aumnexcart' ), $many ), /* translators: %s is the plural product label */ 'search_items' => sprintf( __( 'Search %s', 'aumnexcart' ), $many ), /* translators: %s is the plural product label */ 'parent_item_colon' => sprintf( __( 'Parent %s:', 'aumnexcart' ), $many ), /* translators: %s is the plural product label, lower case */ 'not_found' => sprintf( __( 'No %s found.', 'aumnexcart' ), strtolower( $many ) ), /* translators: %s is the plural product label, lower case */ 'not_found_in_trash' => sprintf( __( 'No %s found in Trash.', 'aumnexcart' ), strtolower( $many ) ), 'featured_image' => __( 'Cover Image', 'aumnexcart' ), 'set_featured_image' => __( 'Set cover image', 'aumnexcart' ), 'remove_featured_image' => __( 'Remove cover image', 'aumnexcart' ), 'use_featured_image' => __( 'Use as cover image', 'aumnexcart' ), /* translators: %s is the singular product label */ 'archives' => sprintf( __( '%s Archives', 'aumnexcart' ), $one ), /* translators: %s is the plural product label, lower case */ 'filter_items_list' => sprintf( __( 'Filter %s list', 'aumnexcart' ), strtolower( $many ) ), /* translators: %s is the plural product label */ 'items_list_navigation' => sprintf( __( '%s list navigation', 'aumnexcart' ), $many ), /* translators: %s is the plural product label */ 'items_list' => sprintf( __( '%s list', 'aumnexcart' ), $many ), ); $args = array( 'labels' => $labels, 'public' => true, 'publicly_queryable' => true, 'show_ui' => true, 'show_in_menu' => true, 'show_in_rest' => true, 'query_var' => true, 'capability_type' => 'post', 'has_archive' => true, 'hierarchical' => false, 'menu_position' => 25, 'menu_icon' => 'dashicons-products', 'supports' => array( 'title', 'editor', 'thumbnail', 'excerpt' ), 'rewrite' => array( 'slug' => self::get_product_slug(), 'with_front' => false, ), ); /** * Allows third-party code to modify the CPT registration args. * * @param array $args Arguments passed to register_post_type. */ $args = apply_filters( 'aumnexcart_post_type_args', $args ); register_post_type( self::POST_TYPE, $args ); } /** * Registers the hierarchical product category taxonomy. * * Hierarchical mode supports parent/child structures, which is * required for typical B2B catalogs where categories nest several * levels deep. */ /** What a category is called on this site ("Collection", "Range", "Series"); same setting family as label(). */ public static function category_label( $plural = false ) { $key = $plural ? 'category_label_plural' : 'category_label_singular'; $v = class_exists( 'AumNexCart_Settings' ) ? (string) AumNexCart_Settings::get( $key, '' ) : ''; if ( '' !== $v ) { return $v; } return $plural ? _x( 'Product Categories', 'taxonomy general name', 'aumnexcart' ) : _x( 'Product Category', 'taxonomy singular name', 'aumnexcart' ); } public static function register_taxonomy() { $one = self::category_label( false ); $many = self::category_label( true ); $labels = array( 'name' => $many, 'singular_name' => $one, /* translators: %s is the plural category label */ 'search_items' => sprintf( __( 'Search %s', 'aumnexcart' ), $many ), /* translators: %s is the plural category label */ 'all_items' => sprintf( __( 'All %s', 'aumnexcart' ), $many ), /* translators: %s is the singular category label */ 'parent_item' => sprintf( __( 'Parent %s', 'aumnexcart' ), $one ), /* translators: %s is the singular category label */ 'parent_item_colon' => sprintf( __( 'Parent %s:', 'aumnexcart' ), $one ), /* translators: %s is the singular category label */ 'edit_item' => sprintf( __( 'Edit %s', 'aumnexcart' ), $one ), /* translators: %s is the singular category label */ 'update_item' => sprintf( __( 'Update %s', 'aumnexcart' ), $one ), /* translators: %s is the singular category label */ 'add_new_item' => sprintf( __( 'Add New %s', 'aumnexcart' ), $one ), /* translators: %s is the singular category label */ 'new_item_name' => sprintf( __( 'New %s Name', 'aumnexcart' ), $one ), 'menu_name' => $many, ); $args = array( 'labels' => $labels, 'hierarchical' => true, 'public' => true, 'show_ui' => true, 'show_admin_column' => true, 'show_in_nav_menus' => true, 'show_in_rest' => true, 'query_var' => true, 'rewrite' => array( 'slug' => self::get_category_slug(), 'with_front' => false, 'hierarchical' => true, ), ); /** * Allows third-party code to modify the taxonomy registration args. * * @param array $args Arguments passed to register_taxonomy. */ $args = apply_filters( 'aumnexcart_taxonomy_args', $args ); register_taxonomy( self::TAXONOMY, array( self::POST_TYPE ), $args ); } }