Skip to content

Commit 429aa80

Browse files
committed
Update taxonomy
1 parent 239bf8f commit 429aa80

File tree

2 files changed

+53
-44
lines changed

2 files changed

+53
-44
lines changed

templates/taxonomy.mustache

Lines changed: 46 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,46 @@
1-
register_taxonomy( '{{slug}}', [ {{post_types}} ], [
2-
'hierarchical' => false,
3-
'public' => true,
4-
'show_in_nav_menus' => true,
5-
'show_ui' => true,
6-
'show_admin_column' => false,
7-
'query_var' => true,
8-
'rewrite' => true,
9-
'capabilities' => [
10-
'manage_terms' => 'edit_posts',
11-
'edit_terms' => 'edit_posts',
12-
'delete_terms' => 'edit_posts',
13-
'assign_terms' => 'edit_posts',
14-
],
15-
'labels' => [
16-
'name' => __( '{{label_plural_ucfirst}}', '{{textdomain}}' ),
17-
'singular_name' => _x( '{{label_ucfirst}}', 'taxonomy general name', '{{textdomain}}' ),
18-
'search_items' => __( 'Search {{label_plural_ucfirst}}', '{{textdomain}}' ),
19-
'popular_items' => __( 'Popular {{label_plural_ucfirst}}', '{{textdomain}}' ),
20-
'all_items' => __( 'All {{label_plural_ucfirst}}', '{{textdomain}}' ),
21-
'parent_item' => __( 'Parent {{label_ucfirst}}', '{{textdomain}}' ),
22-
'parent_item_colon' => __( 'Parent {{label_ucfirst}}:', '{{textdomain}}' ),
23-
'edit_item' => __( 'Edit {{label_ucfirst}}', '{{textdomain}}' ),
24-
'update_item' => __( 'Update {{label_ucfirst}}', '{{textdomain}}' ),
25-
'view_item' => __( 'View {{label_ucfirst}}', '{{textdomain}}' ),
26-
'add_new_item' => __( 'Add New {{label_ucfirst}}', '{{textdomain}}' ),
27-
'new_item_name' => __( 'New {{label_ucfirst}}', '{{textdomain}}' ),
28-
'separate_items_with_commas' => __( 'Separate {{label_plural}} with commas', '{{textdomain}}' ),
29-
'add_or_remove_items' => __( 'Add or remove {{label_plural}}', '{{textdomain}}' ),
30-
'choose_from_most_used' => __( 'Choose from the most used {{label_plural}}', '{{textdomain}}' ),
31-
'not_found' => __( 'No {{label_plural}} found.', '{{textdomain}}' ),
32-
'no_terms' => __( 'No {{label_plural}}', '{{textdomain}}' ),
33-
'menu_name' => __( '{{label_plural_ucfirst}}', '{{textdomain}}' ),
34-
'items_list_navigation' => __( '{{label_plural_ucfirst}} list navigation', '{{textdomain}}' ),
35-
'items_list' => __( '{{label_plural_ucfirst}} list', '{{textdomain}}' ),
36-
'most_used' => _x( 'Most Used', '{{slug}}', '{{textdomain}}' ),
37-
'back_to_items' => __( '← Back to {{label_plural_ucfirst}}', '{{textdomain}}' ),
38-
],
39-
'show_in_rest' => true,
40-
'rest_base' => '{{slug}}',
41-
'rest_controller_class' => 'WP_REST_Terms_Controller',
42-
] );
1+
register_taxonomy(
2+
'{{slug}}',
3+
array( {{post_types}} ),
4+
array(
5+
'hierarchical' => false,
6+
'public' => true,
7+
'show_in_nav_menus' => true,
8+
'show_ui' => true,
9+
'show_admin_column' => false,
10+
'query_var' => true,
11+
'rewrite' => true,
12+
'capabilities' => array(
13+
'manage_terms' => 'edit_posts',
14+
'edit_terms' => 'edit_posts',
15+
'delete_terms' => 'edit_posts',
16+
'assign_terms' => 'edit_posts',
17+
),
18+
'labels' => array(
19+
'name' => __( '{{label_plural_ucfirst}}', '{{textdomain}}' ),
20+
'singular_name' => _x( '{{label_ucfirst}}', 'taxonomy general name', '{{textdomain}}' ),
21+
'search_items' => __( 'Search {{label_plural_ucfirst}}', '{{textdomain}}' ),
22+
'popular_items' => __( 'Popular {{label_plural_ucfirst}}', '{{textdomain}}' ),
23+
'all_items' => __( 'All {{label_plural_ucfirst}}', '{{textdomain}}' ),
24+
'parent_item' => __( 'Parent {{label_ucfirst}}', '{{textdomain}}' ),
25+
'parent_item_colon' => __( 'Parent {{label_ucfirst}}:', '{{textdomain}}' ),
26+
'edit_item' => __( 'Edit {{label_ucfirst}}', '{{textdomain}}' ),
27+
'update_item' => __( 'Update {{label_ucfirst}}', '{{textdomain}}' ),
28+
'view_item' => __( 'View {{label_ucfirst}}', '{{textdomain}}' ),
29+
'add_new_item' => __( 'Add New {{label_ucfirst}}', '{{textdomain}}' ),
30+
'new_item_name' => __( 'New {{label_ucfirst}}', '{{textdomain}}' ),
31+
'separate_items_with_commas' => __( 'Separate {{label_plural}} with commas', '{{textdomain}}' ),
32+
'add_or_remove_items' => __( 'Add or remove {{label_plural}}', '{{textdomain}}' ),
33+
'choose_from_most_used' => __( 'Choose from the most used {{label_plural}}', '{{textdomain}}' ),
34+
'not_found' => __( 'No {{label_plural}} found.', '{{textdomain}}' ),
35+
'no_terms' => __( 'No {{label_plural}}', '{{textdomain}}' ),
36+
'menu_name' => __( '{{label_plural_ucfirst}}', '{{textdomain}}' ),
37+
'items_list_navigation' => __( '{{label_plural_ucfirst}} list navigation', '{{textdomain}}' ),
38+
'items_list' => __( '{{label_plural_ucfirst}} list', '{{textdomain}}' ),
39+
'most_used' => _x( 'Most Used', '{{slug}}', '{{textdomain}}' ),
40+
'back_to_items' => __( '← Back to {{label_plural_ucfirst}}', '{{textdomain}}' ),
41+
),
42+
'show_in_rest' => true,
43+
'rest_base' => '{{slug}}',
44+
'rest_controller_class' => 'WP_REST_Terms_Controller',
45+
)
46+
);

templates/taxonomy_extended.mustache

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
<?php
2+
/**
3+
* Custom taxonomy
4+
*
5+
* @package {{prefix}}
6+
*/
27

38
/**
49
* Registers the `{{machine_name}}` taxonomy,
@@ -18,15 +23,15 @@ add_action( 'init', '{{prefix}}_init' );
1823
*/
1924
function {{prefix}}_updated_messages( $messages ) {
2025
21-
$messages['{{slug}}'] = [
26+
$messages['{{slug}}'] = array(
2227
0 => '', // Unused. Messages start at index 1.
2328
1 => __( '{{label_ucfirst}} added.', '{{textdomain}}' ),
2429
2 => __( '{{label_ucfirst}} deleted.', '{{textdomain}}' ),
2530
3 => __( '{{label_ucfirst}} updated.', '{{textdomain}}' ),
2631
4 => __( '{{label_ucfirst}} not added.', '{{textdomain}}' ),
2732
5 => __( '{{label_ucfirst}} not updated.', '{{textdomain}}' ),
2833
6 => __( '{{label_plural_ucfirst}} deleted.', '{{textdomain}}' ),
29-
];
34+
);
3035
3136
return $messages;
3237
}

0 commit comments

Comments
 (0)