get_label_name( $singular_name, $plural_name ), 'public' => false, 'show_ui' => true, 'rewrite' => false, 'hierarchical' => true, 'show_admin_column' => true, ); if ( $taxonomy_name == 'coupon-store' ) { $args['meta_box_cb'] = __NAMESPACE__.'\cp_term_radio_listing'; } register_taxonomy( $taxonomy_name, $post_type, $args ); } /** * Custom Taxonomy Label Generator * * @since 1.0.0 * * @param string $singular_name display singular name of taxonomy * @param string $plural_name display plural name of taxonomy * * @return array $labels */ function get_label_name( $singular_name, $plural_name ) { $labels = array( 'name' => _x( $plural_name, 'taxonomy general name', 'affiliate-coupon-lite'), 'singular_name' => _x( $singular_name, 'taxonomy singular name', 'affiliate-coupon-lite'), 'search_items' => __( "Search {$plural_name}", 'affiliate-coupon-lite'), 'popular_items' => __( "Popular {$plural_name}", 'affiliate-coupon-lite'), 'all_items' => __( "All {$plural_name}", 'affiliate-coupon-lite'), 'parent_item' => null, 'parent_item_colon' => null, 'edit_item' => __( "Edit {$singular_name}", 'affiliate-coupon-lite'), 'view_item' => __( "View {$singular_name}", 'affiliate-coupon-lite'), 'update_item' => __( "Update {$singular_name}", 'affiliate-coupon-lite'), 'add_new_item' => __( "Add New {$singular_name}", 'affiliate-coupon-lite'), 'new_item_name' => __( "New {$singular_name} Name", 'affiliate-coupon-lite'), 'separate_items_with_commas' => __( "Separate {$plural_name} with commas", 'affiliate-coupon-lite'), 'add_or_remove_items' => __( "Add or remove {$plural_name}", 'affiliate-coupon-lite'), 'choose_from_most_used' => __( "Choose from the most used {$plural_name}", 'affiliate-coupon-lite'), 'not_found' => __( "No {$plural_name} found.", 'affiliate-coupon-lite'), 'menu_name' => __( "{$singular_name}", 'affiliate-coupon-lite'), ); return $labels; } /** * Custom Taxonomy Store Listing Change into Radio * * @since 1.0.0 * * @param object $post post object for the current edit screen * @param array $box addition data as array * * @return void */ function cp_term_radio_listing( $post, $box ) { $terms = get_terms( 'coupon-store', array( 'hide_empty' => false ) ); $stores = wp_get_object_terms( $post->ID, 'coupon-store', array( 'orderby' => 'term_id', 'order' => 'ASC' ) ); $name = ''; if ( ! is_wp_error( $stores ) ) { if ( isset( $stores[0] ) && isset( $stores[0]->name ) ) { $name = $stores[0]->name; } } ?>