-
Notifications
You must be signed in to change notification settings - Fork 0
/
food-blog-categories.php
160 lines (148 loc) · 5.58 KB
/
food-blog-categories.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<?php
/**
* Plugin Name: Food Blog Categories
* Plugin URI: http://roadwarriorcreative.com
* Description: Easily Add recipe related taxonomies to your blog posts.
* Version: 1.0.0
* Author: Road Warrior Creative
* Author URI: https://roadwarriorcreative.com
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
*/
defined( 'ABSPATH' ) or die( 'No direct file access allowed!' );
// Create meal type taxonomy
add_action( 'init', 'rwc_fbc_mealtype_tax' );
function rwc_fbc_mealtype_tax() {
$labels = array(
'name' => _x( 'Meal Types', 'taxonomy general name' ),
'singular_name' => _x( 'Meal Type', 'taxonomy singular name' ),
'search_items' => __( 'Search Meal Types' ),
'all_items' => __( 'All Meal Types' ),
'parent_item' => __( 'Parent Meal Type' ),
'parent_item_colon' => __( 'Parent Meal Type:' ),
'edit_item' => __( 'Edit Meal Type' ),
'update_item' => __( 'Update Meal Type' ),
'add_new_item' => __( 'Add New Meal Type' ),
'new_item_name' => __( 'New Meal Type' ),
'menu_name' => __( 'Meal Types' ),
);
$args = array(
'hierarchical' => true,
'labels' => $labels,
'show_ui' => true,
'show_admin_column' => true,
'show_in_rest' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'meal-type' ),
);
register_taxonomy( 'fbc_meal_type', 'post', $args);
}
// Create dish type taxonomy
add_action( 'init', 'rwc_fbc_dishtype_tax' );
function rwc_fbc_dishtype_tax() {
$labels = array(
'name' => _x( 'Dish Types', 'taxonomy general name' ),
'singular_name' => _x( 'Dish Type', 'taxonomy singular name' ),
'search_items' => __( 'Search Dish Types' ),
'all_items' => __( 'All Dish Types' ),
'parent_item' => __( 'Parent Dish Type' ),
'parent_item_colon' => __( 'Parent Dish Type:' ),
'edit_item' => __( 'Edit Dish Type' ),
'update_item' => __( 'Update Dish Type' ),
'add_new_item' => __( 'Add New Dish Type' ),
'new_item_name' => __( 'New Dish Type' ),
'menu_name' => __( 'Dish Types' ),
);
$args = array(
'hierarchical' => true,
'labels' => $labels,
'show_ui' => true,
'show_admin_column' => true,
'show_in_rest' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'dish' ),
);
register_taxonomy( 'fbc_dish_type', 'post', $args);
}
// Create diet taxonomy
add_action( 'init', 'rwc_fbc_diet_tax' );
function rwc_fbc_diet_tax() {
$labels = array(
'name' => _x( 'Diet & Cooking Styles', 'taxonomy general name' ),
'singular_name' => _x( 'Diet & Cooking Style', 'taxonomy singular name' ),
'search_items' => __( 'Search Diet & Cooking Styles' ),
'all_items' => __( 'All Diet & Cooking Styles' ),
'parent_item' => __( 'Parent Diet & Cooking Style' ),
'parent_item_colon' => __( 'Parent Diet & Cooking Style:' ),
'edit_item' => __( 'Edit Diet & Cooking Style' ),
'update_item' => __( 'Update Diet & Cooking Style' ),
'add_new_item' => __( 'Add New Diet & Cooking Style' ),
'new_item_name' => __( 'New Diet & Cooking Style' ),
'menu_name' => __( 'Diet & Cooking Styles' ),
);
$args = array(
'hierarchical' => true,
'labels' => $labels,
'show_ui' => true,
'show_admin_column' => true,
'show_in_rest' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'diet' ),
);
register_taxonomy( 'fbc_diet', 'post', $args);
}
// Create occasion taxonomy
add_action( 'init', 'rwc_fbc_occasion_tax' );
function rwc_fbc_occasion_tax() {
$labels = array(
'name' => _x( 'Occasions', 'taxonomy general name' ),
'singular_name' => _x( 'Occasion', 'taxonomy singular name' ),
'search_items' => __( 'Search Occasions' ),
'all_items' => __( 'All Occasions' ),
'parent_item' => __( 'Parent Occasion' ),
'parent_item_colon' => __( 'Parent Occasion:' ),
'edit_item' => __( 'Edit Occasion' ),
'update_item' => __( 'Update Occasion' ),
'add_new_item' => __( 'Add New Occasion' ),
'new_item_name' => __( 'New Occasion' ),
'menu_name' => __( 'Occasions' ),
);
$args = array(
'hierarchical' => true,
'labels' => $labels,
'show_ui' => true,
'show_admin_column' => true,
'show_in_rest' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'occasion' ),
);
register_taxonomy( 'fbc_occasion', 'post', $args);
}
// Create season taxonomy
add_action( 'init', 'rwc_fbc_season_tax' );
function rwc_fbc_season_tax() {
$labels = array(
'name' => _x( 'Seasons', 'taxonomy general name' ),
'singular_name' => _x( 'Season', 'taxonomy singular name' ),
'search_items' => __( 'Search Seasons' ),
'all_items' => __( 'All Seasons' ),
'parent_item' => __( 'Parent Season' ),
'parent_item_colon' => __( 'Parent Season:' ),
'edit_item' => __( 'Edit Season' ),
'update_item' => __( 'Update Season' ),
'add_new_item' => __( 'Add New Season' ),
'new_item_name' => __( 'New Season' ),
'menu_name' => __( 'Seasons' ),
);
$args = array(
'hierarchical' => true,
'labels' => $labels,
'show_ui' => true,
'show_admin_column' => true,
'show_in_rest' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'season' ),
);
register_taxonomy( 'fbc_season', 'post', $args);
}
?>