Advertisement
riderworks

Custom taxonomy Colors

Apr 18th, 2021
354
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.66 KB | None | 0 0
  1. <?php
  2. add_action( 'init', 'irw_colors_register_taxonomy' );
  3. function irw_colors_register_taxonomy() {
  4. $labels = [
  5. 'name' => esc_html__( 'Colors', 'monicaarts' ),
  6. 'singular_name' => esc_html__( 'Color', 'monicaarts' ),
  7. 'menu_name' => esc_html__( 'Colors', 'monicaarts' ),
  8. 'search_items' => esc_html__( 'Search Colors', 'monicaarts' ),
  9. 'popular_items' => esc_html__( 'Popular Colors', 'monicaarts' ),
  10. 'all_items' => esc_html__( 'All Colors', 'monicaarts' ),
  11. 'parent_item' => esc_html__( 'Parent Color', 'monicaarts' ),
  12. 'parent_item_colon' => esc_html__( 'Parent Color', 'monicaarts' ),
  13. 'edit_item' => esc_html__( 'Edit Color', 'monicaarts' ),
  14. 'view_item' => esc_html__( 'View Color', 'monicaarts' ),
  15. 'update_item' => esc_html__( 'Update Color', 'monicaarts' ),
  16. 'add_new_item' => esc_html__( 'Add new color', 'monicaarts' ),
  17. 'new_item_name' => esc_html__( 'New color name', 'monicaarts' ),
  18. 'separate_items_with_commas' => esc_html__( 'Separate colors with commas', 'monicaarts' ),
  19. 'add_or_remove_items' => esc_html__( 'Add or remove colors', 'monicaarts' ),
  20. 'choose_from_most_used' => esc_html__( 'Choose most used colors', 'monicaarts' ),
  21. 'not_found' => esc_html__( 'No colors found', 'monicaarts' ),
  22. 'no_terms' => esc_html__( 'No colors found', 'monicaarts' ),
  23. 'items_list_navigation' => esc_html__( 'Colors list pagination', 'monicaarts' ),
  24. 'items_list' => esc_html__( 'Colors list', 'monicaarts' ),
  25. 'most_used' => esc_html__( 'Most Used', 'monicaarts' ),
  26. 'back_to_items' => esc_html__( 'Back to colors', 'monicaarts' ),
  27. 'text_domain' => esc_html__( 'monicaarts', 'monicaarts' ),
  28. ];
  29. $args = [
  30. 'label' => esc_html__( 'Colors', 'monicaarts' ),
  31. 'labels' => $labels,
  32. 'description' => '',
  33. 'public' => true,
  34. 'publicly_queryable' => true,
  35. 'hierarchical' => false,
  36. 'show_ui' => true,
  37. 'show_in_menu' => true,
  38. 'show_in_nav_menus' => true,
  39. 'meta_box_cb' => true,
  40. 'show_in_rest' => true,
  41. 'show_tagcloud' => false,
  42. 'show_in_quick_edit' => true,
  43. 'show_admin_column' => false,
  44. 'query_var' => true,
  45. 'sort' => false,
  46. 'rest_base' => '',
  47. 'rewrite' => [
  48. 'with_front' => false,
  49. 'hierarchical' => false,
  50. ],
  51. ];
  52. register_taxonomy( 'color', ['design'], $args );
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement