@@ -8,371 +8,371 @@ |
||
8 | 8 | */ |
9 | 9 | class Meal { |
10 | 10 | |
11 | - /** |
|
12 | - * Holds class instance |
|
13 | - * |
|
14 | - * @since 1.0.0 |
|
15 | - * |
|
16 | - * @var object \lsx_health_plan\classes\Meal() |
|
17 | - */ |
|
18 | - protected static $instance = null; |
|
11 | + /** |
|
12 | + * Holds class instance |
|
13 | + * |
|
14 | + * @since 1.0.0 |
|
15 | + * |
|
16 | + * @var object \lsx_health_plan\classes\Meal() |
|
17 | + */ |
|
18 | + protected static $instance = null; |
|
19 | 19 | |
20 | - /** |
|
21 | - * Holds post_type slug used as an index |
|
22 | - * |
|
23 | - * @since 1.0.0 |
|
24 | - * |
|
25 | - * @var string |
|
26 | - */ |
|
27 | - public $slug = 'meal'; |
|
20 | + /** |
|
21 | + * Holds post_type slug used as an index |
|
22 | + * |
|
23 | + * @since 1.0.0 |
|
24 | + * |
|
25 | + * @var string |
|
26 | + */ |
|
27 | + public $slug = 'meal'; |
|
28 | 28 | |
29 | - /** |
|
30 | - * Contructor |
|
31 | - */ |
|
32 | - public function __construct() { |
|
33 | - add_action( 'init', array( $this, 'register_post_type' ) ); |
|
34 | - add_action( 'init', array( $this, 'taxonomy_setup' ) ); |
|
35 | - add_filter( 'lsx_health_plan_single_template', array( $this, 'enable_post_type' ), 10, 1 ); |
|
36 | - add_filter( 'lsx_health_plan_connections', array( $this, 'enable_connections' ), 10, 1 ); |
|
37 | - add_action( 'cmb2_admin_init', array( $this, 'featured_metabox' ), 5 ); |
|
38 | - add_action( 'cmb2_admin_init', array( $this, 'details_metaboxes' ) ); |
|
39 | - } |
|
29 | + /** |
|
30 | + * Contructor |
|
31 | + */ |
|
32 | + public function __construct() { |
|
33 | + add_action( 'init', array( $this, 'register_post_type' ) ); |
|
34 | + add_action( 'init', array( $this, 'taxonomy_setup' ) ); |
|
35 | + add_filter( 'lsx_health_plan_single_template', array( $this, 'enable_post_type' ), 10, 1 ); |
|
36 | + add_filter( 'lsx_health_plan_connections', array( $this, 'enable_connections' ), 10, 1 ); |
|
37 | + add_action( 'cmb2_admin_init', array( $this, 'featured_metabox' ), 5 ); |
|
38 | + add_action( 'cmb2_admin_init', array( $this, 'details_metaboxes' ) ); |
|
39 | + } |
|
40 | 40 | |
41 | - /** |
|
42 | - * Return an instance of this class. |
|
43 | - * |
|
44 | - * @since 1.0.0 |
|
45 | - * |
|
46 | - * @return object \lsx_health_plan\classes\Day() A single instance of this class. |
|
47 | - */ |
|
48 | - public static function get_instance() { |
|
49 | - // If the single instance hasn't been set, set it now. |
|
50 | - if ( null === self::$instance ) { |
|
51 | - self::$instance = new self(); |
|
52 | - } |
|
53 | - return self::$instance; |
|
54 | - } |
|
55 | - /** |
|
56 | - * Register the post type. |
|
57 | - */ |
|
58 | - public function register_post_type() { |
|
59 | - $labels = array( |
|
60 | - 'name' => esc_html__( 'Meals', 'lsx-health-plan' ), |
|
61 | - 'singular_name' => esc_html__( 'Meal', 'lsx-health-plan' ), |
|
62 | - 'add_new' => esc_html_x( 'Add New', 'post type general name', 'lsx-health-plan' ), |
|
63 | - 'add_new_item' => esc_html__( 'Add New', 'lsx-health-plan' ), |
|
64 | - 'edit_item' => esc_html__( 'Edit', 'lsx-health-plan' ), |
|
65 | - 'new_item' => esc_html__( 'New', 'lsx-health-plan' ), |
|
66 | - 'all_items' => esc_html__( 'All Meals', 'lsx-health-plan' ), |
|
67 | - 'view_item' => esc_html__( 'View', 'lsx-health-plan' ), |
|
68 | - 'search_items' => esc_html__( 'Search', 'lsx-health-plan' ), |
|
69 | - 'not_found' => esc_html__( 'None found', 'lsx-health-plan' ), |
|
70 | - 'not_found_in_trash' => esc_html__( 'None found in Trash', 'lsx-health-plan' ), |
|
71 | - 'parent_item_colon' => '', |
|
72 | - 'menu_name' => esc_html__( 'Meals', 'lsx-health-plan' ), |
|
73 | - ); |
|
74 | - $args = array( |
|
75 | - 'labels' => $labels, |
|
76 | - 'public' => true, |
|
77 | - 'publicly_queryable' => true, |
|
78 | - 'show_ui' => true, |
|
79 | - 'show_in_menu' => true, |
|
80 | - 'show_in_rest' => true, |
|
81 | - 'menu_icon' => 'dashicons-carrot', |
|
82 | - 'query_var' => true, |
|
83 | - 'rewrite' => array( |
|
84 | - 'slug' => \lsx_health_plan\functions\get_option( 'meal_single_slug', 'meal' ), |
|
85 | - ), |
|
86 | - 'capability_type' => 'post', |
|
87 | - 'has_archive' => \lsx_health_plan\functions\get_option( 'endpoint_meal_archive', 'meals' ), |
|
88 | - 'hierarchical' => true, |
|
89 | - 'menu_position' => null, |
|
90 | - 'supports' => array( |
|
91 | - 'title', |
|
92 | - 'editor', |
|
93 | - 'thumbnail', |
|
94 | - 'page-attributes', |
|
95 | - 'custom-fields', |
|
96 | - ), |
|
97 | - ); |
|
98 | - register_post_type( 'meal', $args ); |
|
99 | - } |
|
41 | + /** |
|
42 | + * Return an instance of this class. |
|
43 | + * |
|
44 | + * @since 1.0.0 |
|
45 | + * |
|
46 | + * @return object \lsx_health_plan\classes\Day() A single instance of this class. |
|
47 | + */ |
|
48 | + public static function get_instance() { |
|
49 | + // If the single instance hasn't been set, set it now. |
|
50 | + if ( null === self::$instance ) { |
|
51 | + self::$instance = new self(); |
|
52 | + } |
|
53 | + return self::$instance; |
|
54 | + } |
|
55 | + /** |
|
56 | + * Register the post type. |
|
57 | + */ |
|
58 | + public function register_post_type() { |
|
59 | + $labels = array( |
|
60 | + 'name' => esc_html__( 'Meals', 'lsx-health-plan' ), |
|
61 | + 'singular_name' => esc_html__( 'Meal', 'lsx-health-plan' ), |
|
62 | + 'add_new' => esc_html_x( 'Add New', 'post type general name', 'lsx-health-plan' ), |
|
63 | + 'add_new_item' => esc_html__( 'Add New', 'lsx-health-plan' ), |
|
64 | + 'edit_item' => esc_html__( 'Edit', 'lsx-health-plan' ), |
|
65 | + 'new_item' => esc_html__( 'New', 'lsx-health-plan' ), |
|
66 | + 'all_items' => esc_html__( 'All Meals', 'lsx-health-plan' ), |
|
67 | + 'view_item' => esc_html__( 'View', 'lsx-health-plan' ), |
|
68 | + 'search_items' => esc_html__( 'Search', 'lsx-health-plan' ), |
|
69 | + 'not_found' => esc_html__( 'None found', 'lsx-health-plan' ), |
|
70 | + 'not_found_in_trash' => esc_html__( 'None found in Trash', 'lsx-health-plan' ), |
|
71 | + 'parent_item_colon' => '', |
|
72 | + 'menu_name' => esc_html__( 'Meals', 'lsx-health-plan' ), |
|
73 | + ); |
|
74 | + $args = array( |
|
75 | + 'labels' => $labels, |
|
76 | + 'public' => true, |
|
77 | + 'publicly_queryable' => true, |
|
78 | + 'show_ui' => true, |
|
79 | + 'show_in_menu' => true, |
|
80 | + 'show_in_rest' => true, |
|
81 | + 'menu_icon' => 'dashicons-carrot', |
|
82 | + 'query_var' => true, |
|
83 | + 'rewrite' => array( |
|
84 | + 'slug' => \lsx_health_plan\functions\get_option( 'meal_single_slug', 'meal' ), |
|
85 | + ), |
|
86 | + 'capability_type' => 'post', |
|
87 | + 'has_archive' => \lsx_health_plan\functions\get_option( 'endpoint_meal_archive', 'meals' ), |
|
88 | + 'hierarchical' => true, |
|
89 | + 'menu_position' => null, |
|
90 | + 'supports' => array( |
|
91 | + 'title', |
|
92 | + 'editor', |
|
93 | + 'thumbnail', |
|
94 | + 'page-attributes', |
|
95 | + 'custom-fields', |
|
96 | + ), |
|
97 | + ); |
|
98 | + register_post_type( 'meal', $args ); |
|
99 | + } |
|
100 | 100 | |
101 | - /** |
|
102 | - * Register the Week taxonomy. |
|
103 | - */ |
|
104 | - public function taxonomy_setup() { |
|
105 | - $labels = array( |
|
106 | - 'name' => esc_html_x( 'Meal Type', 'taxonomy general name', 'lsx-health-plan' ), |
|
107 | - 'singular_name' => esc_html_x( 'Meal Types', 'taxonomy singular name', 'lsx-health-plan' ), |
|
108 | - 'search_items' => esc_html__( 'Search', 'lsx-health-plan' ), |
|
109 | - 'all_items' => esc_html__( 'All', 'lsx-health-plan' ), |
|
110 | - 'parent_item' => esc_html__( 'Parent', 'lsx-health-plan' ), |
|
111 | - 'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ), |
|
112 | - 'edit_item' => esc_html__( 'Edit', 'lsx-health-plan' ), |
|
113 | - 'update_item' => esc_html__( 'Update', 'lsx-health-plan' ), |
|
114 | - 'add_new_item' => esc_html__( 'Add New', 'lsx-health-plan' ), |
|
115 | - 'new_item_name' => esc_html__( 'New Name', 'lsx-health-plan' ), |
|
116 | - 'menu_name' => esc_html__( 'Meal Types', 'lsx-health-plan' ), |
|
117 | - ); |
|
118 | - $args = array( |
|
119 | - 'hierarchical' => true, |
|
120 | - 'labels' => $labels, |
|
121 | - 'show_ui' => true, |
|
122 | - 'show_in_menu' => 'edit.php?post_type=meal', |
|
123 | - 'show_admin_column' => true, |
|
124 | - 'query_var' => true, |
|
125 | - 'rewrite' => array( |
|
126 | - 'slug' => 'meal-type', |
|
127 | - ), |
|
128 | - ); |
|
129 | - register_taxonomy( 'meal-type', array( $this->slug ), $args ); |
|
130 | - } |
|
101 | + /** |
|
102 | + * Register the Week taxonomy. |
|
103 | + */ |
|
104 | + public function taxonomy_setup() { |
|
105 | + $labels = array( |
|
106 | + 'name' => esc_html_x( 'Meal Type', 'taxonomy general name', 'lsx-health-plan' ), |
|
107 | + 'singular_name' => esc_html_x( 'Meal Types', 'taxonomy singular name', 'lsx-health-plan' ), |
|
108 | + 'search_items' => esc_html__( 'Search', 'lsx-health-plan' ), |
|
109 | + 'all_items' => esc_html__( 'All', 'lsx-health-plan' ), |
|
110 | + 'parent_item' => esc_html__( 'Parent', 'lsx-health-plan' ), |
|
111 | + 'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ), |
|
112 | + 'edit_item' => esc_html__( 'Edit', 'lsx-health-plan' ), |
|
113 | + 'update_item' => esc_html__( 'Update', 'lsx-health-plan' ), |
|
114 | + 'add_new_item' => esc_html__( 'Add New', 'lsx-health-plan' ), |
|
115 | + 'new_item_name' => esc_html__( 'New Name', 'lsx-health-plan' ), |
|
116 | + 'menu_name' => esc_html__( 'Meal Types', 'lsx-health-plan' ), |
|
117 | + ); |
|
118 | + $args = array( |
|
119 | + 'hierarchical' => true, |
|
120 | + 'labels' => $labels, |
|
121 | + 'show_ui' => true, |
|
122 | + 'show_in_menu' => 'edit.php?post_type=meal', |
|
123 | + 'show_admin_column' => true, |
|
124 | + 'query_var' => true, |
|
125 | + 'rewrite' => array( |
|
126 | + 'slug' => 'meal-type', |
|
127 | + ), |
|
128 | + ); |
|
129 | + register_taxonomy( 'meal-type', array( $this->slug ), $args ); |
|
130 | + } |
|
131 | 131 | |
132 | - /** |
|
133 | - * Adds the post type to the different arrays. |
|
134 | - * |
|
135 | - * @param array $post_types |
|
136 | - * @return array |
|
137 | - */ |
|
138 | - public function enable_post_type( $post_types = array() ) { |
|
139 | - $post_types[] = $this->slug; |
|
140 | - return $post_types; |
|
141 | - } |
|
132 | + /** |
|
133 | + * Adds the post type to the different arrays. |
|
134 | + * |
|
135 | + * @param array $post_types |
|
136 | + * @return array |
|
137 | + */ |
|
138 | + public function enable_post_type( $post_types = array() ) { |
|
139 | + $post_types[] = $this->slug; |
|
140 | + return $post_types; |
|
141 | + } |
|
142 | 142 | |
143 | - /** |
|
144 | - * Enables the Bi Directional relationships |
|
145 | - * |
|
146 | - * @param array $connections |
|
147 | - * @return void |
|
148 | - */ |
|
149 | - public function enable_connections( $connections = array() ) { |
|
150 | - $connections['meal']['connected_plans'] = 'connected_meals'; |
|
151 | - $connections['plan']['connected_meals'] = 'connected_plans'; |
|
152 | - return $connections; |
|
153 | - } |
|
143 | + /** |
|
144 | + * Enables the Bi Directional relationships |
|
145 | + * |
|
146 | + * @param array $connections |
|
147 | + * @return void |
|
148 | + */ |
|
149 | + public function enable_connections( $connections = array() ) { |
|
150 | + $connections['meal']['connected_plans'] = 'connected_meals'; |
|
151 | + $connections['plan']['connected_meals'] = 'connected_plans'; |
|
152 | + return $connections; |
|
153 | + } |
|
154 | 154 | |
155 | - /** |
|
156 | - * Define the metabox and field configurations. |
|
157 | - */ |
|
158 | - public function featured_metabox() { |
|
159 | - $cmb = new_cmb2_box( |
|
160 | - array( |
|
161 | - 'id' => $this->slug . '_featured_metabox_meal', |
|
162 | - 'title' => __( 'Featured Meal', 'lsx-health-plan' ), |
|
163 | - 'object_types' => array( $this->slug ), // Post type |
|
164 | - 'context' => 'side', |
|
165 | - 'priority' => 'high', |
|
166 | - 'show_names' => true, |
|
167 | - ) |
|
168 | - ); |
|
169 | - $cmb->add_field( |
|
170 | - array( |
|
171 | - 'name' => __( 'Featured Meal', 'lsx-health-plan' ), |
|
172 | - 'desc' => __( 'Enable a featured meal' ), |
|
173 | - 'id' => $this->slug . '_featured_meal', |
|
174 | - 'type' => 'checkbox', |
|
175 | - 'show_on_cb' => 'cmb2_hide_if_no_cats', |
|
176 | - ) |
|
177 | - ); |
|
178 | - } |
|
155 | + /** |
|
156 | + * Define the metabox and field configurations. |
|
157 | + */ |
|
158 | + public function featured_metabox() { |
|
159 | + $cmb = new_cmb2_box( |
|
160 | + array( |
|
161 | + 'id' => $this->slug . '_featured_metabox_meal', |
|
162 | + 'title' => __( 'Featured Meal', 'lsx-health-plan' ), |
|
163 | + 'object_types' => array( $this->slug ), // Post type |
|
164 | + 'context' => 'side', |
|
165 | + 'priority' => 'high', |
|
166 | + 'show_names' => true, |
|
167 | + ) |
|
168 | + ); |
|
169 | + $cmb->add_field( |
|
170 | + array( |
|
171 | + 'name' => __( 'Featured Meal', 'lsx-health-plan' ), |
|
172 | + 'desc' => __( 'Enable a featured meal' ), |
|
173 | + 'id' => $this->slug . '_featured_meal', |
|
174 | + 'type' => 'checkbox', |
|
175 | + 'show_on_cb' => 'cmb2_hide_if_no_cats', |
|
176 | + ) |
|
177 | + ); |
|
178 | + } |
|
179 | 179 | |
180 | - /** |
|
181 | - * Define the metabox and field configurations. |
|
182 | - */ |
|
183 | - public function details_metaboxes() { |
|
184 | - $cmb = new_cmb2_box( array( |
|
185 | - 'id' => $this->slug . '_shopping_list_metabox', |
|
186 | - 'title' => __( 'Shopping List', 'lsx-health-plan' ), |
|
187 | - 'object_types' => array( $this->slug ), // Post type |
|
188 | - 'context' => 'normal', |
|
189 | - 'priority' => 'high', |
|
190 | - 'show_names' => true, |
|
191 | - ) ); |
|
192 | - $cmb->add_field( array( |
|
193 | - 'name' => __( 'Shopping List', 'lsx-health-plan' ), |
|
194 | - 'desc' => __( 'Connect the shopping list page that applies to this meal by entering the name of the page in the field provided.' ), |
|
195 | - 'id' => $this->slug . '_shopping_list', |
|
196 | - 'type' => 'post_search_ajax', |
|
197 | - // Optional : |
|
198 | - 'limit' => 1, // Limit selection to X items only (default 1) |
|
199 | - 'sortable' => true, // Allow selected items to be sortable (default false) |
|
200 | - 'query_args' => array( |
|
201 | - 'post_type' => array( 'page' ), |
|
202 | - 'post_status' => array( 'publish' ), |
|
203 | - 'posts_per_page' => -1, |
|
204 | - ), |
|
205 | - ) ); |
|
206 | - $cmb = new_cmb2_box( array( |
|
207 | - 'id' => $this->slug . '_details_metabox', |
|
208 | - 'title' => __( 'Meal Details', 'lsx-health-plan' ), |
|
209 | - 'object_types' => array( $this->slug ), // Post type |
|
210 | - 'context' => 'normal', |
|
211 | - 'priority' => 'high', |
|
212 | - 'show_names' => true, |
|
213 | - ) ); |
|
180 | + /** |
|
181 | + * Define the metabox and field configurations. |
|
182 | + */ |
|
183 | + public function details_metaboxes() { |
|
184 | + $cmb = new_cmb2_box( array( |
|
185 | + 'id' => $this->slug . '_shopping_list_metabox', |
|
186 | + 'title' => __( 'Shopping List', 'lsx-health-plan' ), |
|
187 | + 'object_types' => array( $this->slug ), // Post type |
|
188 | + 'context' => 'normal', |
|
189 | + 'priority' => 'high', |
|
190 | + 'show_names' => true, |
|
191 | + ) ); |
|
192 | + $cmb->add_field( array( |
|
193 | + 'name' => __( 'Shopping List', 'lsx-health-plan' ), |
|
194 | + 'desc' => __( 'Connect the shopping list page that applies to this meal by entering the name of the page in the field provided.' ), |
|
195 | + 'id' => $this->slug . '_shopping_list', |
|
196 | + 'type' => 'post_search_ajax', |
|
197 | + // Optional : |
|
198 | + 'limit' => 1, // Limit selection to X items only (default 1) |
|
199 | + 'sortable' => true, // Allow selected items to be sortable (default false) |
|
200 | + 'query_args' => array( |
|
201 | + 'post_type' => array( 'page' ), |
|
202 | + 'post_status' => array( 'publish' ), |
|
203 | + 'posts_per_page' => -1, |
|
204 | + ), |
|
205 | + ) ); |
|
206 | + $cmb = new_cmb2_box( array( |
|
207 | + 'id' => $this->slug . '_details_metabox', |
|
208 | + 'title' => __( 'Meal Details', 'lsx-health-plan' ), |
|
209 | + 'object_types' => array( $this->slug ), // Post type |
|
210 | + 'context' => 'normal', |
|
211 | + 'priority' => 'high', |
|
212 | + 'show_names' => true, |
|
213 | + ) ); |
|
214 | 214 | |
215 | - $cmb->add_field( array( |
|
216 | - 'name' => __( 'Meal Short Description', 'lsx-health-plan' ), |
|
217 | - 'id' => $this->slug . '_short_description', |
|
218 | - 'type' => 'textarea_small', |
|
219 | - 'desc' => __( 'Add a small description for this meal (optional)', 'lsx-health-plan' ), |
|
220 | - ) ); |
|
215 | + $cmb->add_field( array( |
|
216 | + 'name' => __( 'Meal Short Description', 'lsx-health-plan' ), |
|
217 | + 'id' => $this->slug . '_short_description', |
|
218 | + 'type' => 'textarea_small', |
|
219 | + 'desc' => __( 'Add a small description for this meal (optional)', 'lsx-health-plan' ), |
|
220 | + ) ); |
|
221 | 221 | |
222 | - $cmb->add_field( array( |
|
223 | - 'name' => __( 'Pre Breakfast Snack', 'lsx-health-plan' ), |
|
224 | - 'id' => $this->slug . '_pre_breakfast_snack', |
|
225 | - 'type' => 'wysiwyg', |
|
226 | - 'show_on_cb' => 'cmb2_hide_if_no_cats', |
|
227 | - 'options' => array( |
|
228 | - 'textarea_rows' => 5, |
|
229 | - ), |
|
230 | - ) ); |
|
231 | - $cmb->add_field( array( |
|
232 | - 'name' => __( 'Breakfast', 'lsx-health-plan' ), |
|
233 | - 'id' => $this->slug . '_breakfast', |
|
234 | - 'type' => 'wysiwyg', |
|
235 | - 'show_on_cb' => 'cmb2_hide_if_no_cats', |
|
236 | - 'options' => array( |
|
237 | - 'textarea_rows' => 5, |
|
238 | - ), |
|
239 | - ) ); |
|
222 | + $cmb->add_field( array( |
|
223 | + 'name' => __( 'Pre Breakfast Snack', 'lsx-health-plan' ), |
|
224 | + 'id' => $this->slug . '_pre_breakfast_snack', |
|
225 | + 'type' => 'wysiwyg', |
|
226 | + 'show_on_cb' => 'cmb2_hide_if_no_cats', |
|
227 | + 'options' => array( |
|
228 | + 'textarea_rows' => 5, |
|
229 | + ), |
|
230 | + ) ); |
|
231 | + $cmb->add_field( array( |
|
232 | + 'name' => __( 'Breakfast', 'lsx-health-plan' ), |
|
233 | + 'id' => $this->slug . '_breakfast', |
|
234 | + 'type' => 'wysiwyg', |
|
235 | + 'show_on_cb' => 'cmb2_hide_if_no_cats', |
|
236 | + 'options' => array( |
|
237 | + 'textarea_rows' => 5, |
|
238 | + ), |
|
239 | + ) ); |
|
240 | 240 | |
241 | - $cmb->add_field( |
|
242 | - array( |
|
243 | - 'name' => __( 'Post Breakfast Snack', 'lsx-health-plan' ), |
|
244 | - 'id' => $this->slug . '_breakfast_snack', |
|
245 | - 'type' => 'wysiwyg', |
|
246 | - 'show_on_cb' => 'cmb2_hide_if_no_cats', |
|
247 | - 'options' => array( |
|
248 | - 'textarea_rows' => 5, |
|
249 | - ), |
|
250 | - ) |
|
251 | - ); |
|
241 | + $cmb->add_field( |
|
242 | + array( |
|
243 | + 'name' => __( 'Post Breakfast Snack', 'lsx-health-plan' ), |
|
244 | + 'id' => $this->slug . '_breakfast_snack', |
|
245 | + 'type' => 'wysiwyg', |
|
246 | + 'show_on_cb' => 'cmb2_hide_if_no_cats', |
|
247 | + 'options' => array( |
|
248 | + 'textarea_rows' => 5, |
|
249 | + ), |
|
250 | + ) |
|
251 | + ); |
|
252 | 252 | |
253 | - if ( post_type_exists( 'recipe' ) ) { |
|
254 | - $cmb->add_field( |
|
255 | - array( |
|
256 | - 'name' => __( 'Breakfast Recipes', 'lsx-health-plan' ), |
|
257 | - 'desc' => __( 'Connect additional recipes options for breakfast.', 'lsx-health-plan' ), |
|
258 | - 'id' => 'breakfast_recipes', |
|
259 | - 'type' => 'post_search_ajax', |
|
260 | - // Optional : |
|
261 | - 'limit' => 15, // Limit selection to X items only (default 1) |
|
262 | - 'sortable' => true, // Allow selected items to be sortable (default false) |
|
263 | - 'query_args' => array( |
|
264 | - 'post_type' => array( 'recipe' ), |
|
265 | - 'post_status' => array( 'publish' ), |
|
266 | - 'posts_per_page' => -1, |
|
267 | - ), |
|
268 | - ) |
|
269 | - ); |
|
270 | - } |
|
253 | + if ( post_type_exists( 'recipe' ) ) { |
|
254 | + $cmb->add_field( |
|
255 | + array( |
|
256 | + 'name' => __( 'Breakfast Recipes', 'lsx-health-plan' ), |
|
257 | + 'desc' => __( 'Connect additional recipes options for breakfast.', 'lsx-health-plan' ), |
|
258 | + 'id' => 'breakfast_recipes', |
|
259 | + 'type' => 'post_search_ajax', |
|
260 | + // Optional : |
|
261 | + 'limit' => 15, // Limit selection to X items only (default 1) |
|
262 | + 'sortable' => true, // Allow selected items to be sortable (default false) |
|
263 | + 'query_args' => array( |
|
264 | + 'post_type' => array( 'recipe' ), |
|
265 | + 'post_status' => array( 'publish' ), |
|
266 | + 'posts_per_page' => -1, |
|
267 | + ), |
|
268 | + ) |
|
269 | + ); |
|
270 | + } |
|
271 | 271 | |
272 | - $cmb->add_field( |
|
273 | - array( |
|
274 | - 'name' => __( 'Pre Lunch Snack', 'lsx-health-plan' ), |
|
275 | - 'id' => $this->slug . '_pre_lunch_snack', |
|
276 | - 'type' => 'wysiwyg', |
|
277 | - 'show_on_cb' => 'cmb2_hide_if_no_cats', |
|
278 | - 'options' => array( |
|
279 | - 'textarea_rows' => 5, |
|
280 | - ), |
|
281 | - ) |
|
282 | - ); |
|
283 | - $cmb->add_field( |
|
284 | - array( |
|
285 | - 'name' => __( 'Lunch', 'lsx-health-plan' ), |
|
286 | - 'id' => $this->slug . '_lunch', |
|
287 | - 'type' => 'wysiwyg', |
|
288 | - 'show_on_cb' => 'cmb2_hide_if_no_cats', |
|
289 | - 'options' => array( |
|
290 | - 'textarea_rows' => 5, |
|
291 | - ), |
|
292 | - ) |
|
293 | - ); |
|
294 | - $cmb->add_field( |
|
295 | - array( |
|
296 | - 'name' => __( 'Post Lunch Snack', 'lsx-health-plan' ), |
|
297 | - 'id' => $this->slug . '_lunch_snack', |
|
298 | - 'type' => 'wysiwyg', |
|
299 | - 'show_on_cb' => 'cmb2_hide_if_no_cats', |
|
300 | - 'options' => array( |
|
301 | - 'textarea_rows' => 5, |
|
302 | - ), |
|
303 | - ) |
|
304 | - ); |
|
272 | + $cmb->add_field( |
|
273 | + array( |
|
274 | + 'name' => __( 'Pre Lunch Snack', 'lsx-health-plan' ), |
|
275 | + 'id' => $this->slug . '_pre_lunch_snack', |
|
276 | + 'type' => 'wysiwyg', |
|
277 | + 'show_on_cb' => 'cmb2_hide_if_no_cats', |
|
278 | + 'options' => array( |
|
279 | + 'textarea_rows' => 5, |
|
280 | + ), |
|
281 | + ) |
|
282 | + ); |
|
283 | + $cmb->add_field( |
|
284 | + array( |
|
285 | + 'name' => __( 'Lunch', 'lsx-health-plan' ), |
|
286 | + 'id' => $this->slug . '_lunch', |
|
287 | + 'type' => 'wysiwyg', |
|
288 | + 'show_on_cb' => 'cmb2_hide_if_no_cats', |
|
289 | + 'options' => array( |
|
290 | + 'textarea_rows' => 5, |
|
291 | + ), |
|
292 | + ) |
|
293 | + ); |
|
294 | + $cmb->add_field( |
|
295 | + array( |
|
296 | + 'name' => __( 'Post Lunch Snack', 'lsx-health-plan' ), |
|
297 | + 'id' => $this->slug . '_lunch_snack', |
|
298 | + 'type' => 'wysiwyg', |
|
299 | + 'show_on_cb' => 'cmb2_hide_if_no_cats', |
|
300 | + 'options' => array( |
|
301 | + 'textarea_rows' => 5, |
|
302 | + ), |
|
303 | + ) |
|
304 | + ); |
|
305 | 305 | |
306 | - if ( post_type_exists( 'recipe' ) ) { |
|
307 | - $cmb->add_field( |
|
308 | - array( |
|
309 | - 'name' => __( 'Lunch Recipes', 'lsx-health-plan' ), |
|
310 | - 'desc' => __( 'Connect additional recipes options for lunch.', 'lsx-health-plan' ), |
|
311 | - 'id' => 'lunch_recipes', |
|
312 | - 'type' => 'post_search_ajax', |
|
313 | - // Optional : |
|
314 | - 'limit' => 15, // Limit selection to X items only (default 1) |
|
315 | - 'sortable' => true, // Allow selected items to be sortable (default false) |
|
316 | - 'query_args' => array( |
|
317 | - 'post_type' => array( 'recipe' ), |
|
318 | - 'post_status' => array( 'publish' ), |
|
319 | - 'posts_per_page' => -1, |
|
320 | - ), |
|
321 | - ) |
|
322 | - ); |
|
323 | - } |
|
306 | + if ( post_type_exists( 'recipe' ) ) { |
|
307 | + $cmb->add_field( |
|
308 | + array( |
|
309 | + 'name' => __( 'Lunch Recipes', 'lsx-health-plan' ), |
|
310 | + 'desc' => __( 'Connect additional recipes options for lunch.', 'lsx-health-plan' ), |
|
311 | + 'id' => 'lunch_recipes', |
|
312 | + 'type' => 'post_search_ajax', |
|
313 | + // Optional : |
|
314 | + 'limit' => 15, // Limit selection to X items only (default 1) |
|
315 | + 'sortable' => true, // Allow selected items to be sortable (default false) |
|
316 | + 'query_args' => array( |
|
317 | + 'post_type' => array( 'recipe' ), |
|
318 | + 'post_status' => array( 'publish' ), |
|
319 | + 'posts_per_page' => -1, |
|
320 | + ), |
|
321 | + ) |
|
322 | + ); |
|
323 | + } |
|
324 | 324 | |
325 | - $cmb->add_field( |
|
326 | - array( |
|
327 | - 'name' => __( 'Pre Dinner Snack', 'lsx-health-plan' ), |
|
328 | - 'id' => $this->slug . '_pre_dinner_snack', |
|
329 | - 'type' => 'wysiwyg', |
|
330 | - 'show_on_cb' => 'cmb2_hide_if_no_cats', |
|
331 | - 'options' => array( |
|
332 | - 'textarea_rows' => 5, |
|
333 | - ), |
|
334 | - ) |
|
335 | - ); |
|
336 | - $cmb->add_field( |
|
337 | - array( |
|
338 | - 'name' => __( 'Dinner', 'lsx-health-plan' ), |
|
339 | - 'id' => $this->slug . '_dinner', |
|
340 | - 'type' => 'wysiwyg', |
|
341 | - 'show_on_cb' => 'cmb2_hide_if_no_cats', |
|
342 | - 'options' => array( |
|
343 | - 'textarea_rows' => 5, |
|
344 | - ), |
|
345 | - ) |
|
346 | - ); |
|
347 | - $cmb->add_field( |
|
348 | - array( |
|
349 | - 'name' => __( 'Post Dinner Snack', 'lsx-health-plan' ), |
|
350 | - 'id' => $this->slug . '_dinner_snack', |
|
351 | - 'type' => 'wysiwyg', |
|
352 | - 'show_on_cb' => 'cmb2_hide_if_no_cats', |
|
353 | - 'options' => array( |
|
354 | - 'textarea_rows' => 5, |
|
355 | - ), |
|
356 | - ) |
|
357 | - ); |
|
325 | + $cmb->add_field( |
|
326 | + array( |
|
327 | + 'name' => __( 'Pre Dinner Snack', 'lsx-health-plan' ), |
|
328 | + 'id' => $this->slug . '_pre_dinner_snack', |
|
329 | + 'type' => 'wysiwyg', |
|
330 | + 'show_on_cb' => 'cmb2_hide_if_no_cats', |
|
331 | + 'options' => array( |
|
332 | + 'textarea_rows' => 5, |
|
333 | + ), |
|
334 | + ) |
|
335 | + ); |
|
336 | + $cmb->add_field( |
|
337 | + array( |
|
338 | + 'name' => __( 'Dinner', 'lsx-health-plan' ), |
|
339 | + 'id' => $this->slug . '_dinner', |
|
340 | + 'type' => 'wysiwyg', |
|
341 | + 'show_on_cb' => 'cmb2_hide_if_no_cats', |
|
342 | + 'options' => array( |
|
343 | + 'textarea_rows' => 5, |
|
344 | + ), |
|
345 | + ) |
|
346 | + ); |
|
347 | + $cmb->add_field( |
|
348 | + array( |
|
349 | + 'name' => __( 'Post Dinner Snack', 'lsx-health-plan' ), |
|
350 | + 'id' => $this->slug . '_dinner_snack', |
|
351 | + 'type' => 'wysiwyg', |
|
352 | + 'show_on_cb' => 'cmb2_hide_if_no_cats', |
|
353 | + 'options' => array( |
|
354 | + 'textarea_rows' => 5, |
|
355 | + ), |
|
356 | + ) |
|
357 | + ); |
|
358 | 358 | |
359 | - if ( post_type_exists( 'recipe' ) ) { |
|
360 | - $cmb->add_field( |
|
361 | - array( |
|
362 | - 'name' => __( 'Dinner Recipes', 'lsx-health-plan' ), |
|
363 | - 'desc' => __( 'Connect additional recipes options for dinner.', 'lsx-health-plan' ), |
|
364 | - 'id' => 'dinner_recipes', |
|
365 | - 'type' => 'post_search_ajax', |
|
366 | - // Optional : |
|
367 | - 'limit' => 15, // Limit selection to X items only (default 1) |
|
368 | - 'sortable' => true, // Allow selected items to be sortable (default false) |
|
369 | - 'query_args' => array( |
|
370 | - 'post_type' => array( 'recipe' ), |
|
371 | - 'post_status' => array( 'publish' ), |
|
372 | - 'posts_per_page' => -1, |
|
373 | - ), |
|
374 | - ) |
|
375 | - ); |
|
376 | - } |
|
377 | - } |
|
359 | + if ( post_type_exists( 'recipe' ) ) { |
|
360 | + $cmb->add_field( |
|
361 | + array( |
|
362 | + 'name' => __( 'Dinner Recipes', 'lsx-health-plan' ), |
|
363 | + 'desc' => __( 'Connect additional recipes options for dinner.', 'lsx-health-plan' ), |
|
364 | + 'id' => 'dinner_recipes', |
|
365 | + 'type' => 'post_search_ajax', |
|
366 | + // Optional : |
|
367 | + 'limit' => 15, // Limit selection to X items only (default 1) |
|
368 | + 'sortable' => true, // Allow selected items to be sortable (default false) |
|
369 | + 'query_args' => array( |
|
370 | + 'post_type' => array( 'recipe' ), |
|
371 | + 'post_status' => array( 'publish' ), |
|
372 | + 'posts_per_page' => -1, |
|
373 | + ), |
|
374 | + ) |
|
375 | + ); |
|
376 | + } |
|
377 | + } |
|
378 | 378 | } |
@@ -30,12 +30,12 @@ discard block |
||
30 | 30 | * Contructor |
31 | 31 | */ |
32 | 32 | public function __construct() { |
33 | - add_action( 'init', array( $this, 'register_post_type' ) ); |
|
34 | - add_action( 'init', array( $this, 'taxonomy_setup' ) ); |
|
35 | - add_filter( 'lsx_health_plan_single_template', array( $this, 'enable_post_type' ), 10, 1 ); |
|
36 | - add_filter( 'lsx_health_plan_connections', array( $this, 'enable_connections' ), 10, 1 ); |
|
37 | - add_action( 'cmb2_admin_init', array( $this, 'featured_metabox' ), 5 ); |
|
38 | - add_action( 'cmb2_admin_init', array( $this, 'details_metaboxes' ) ); |
|
33 | + add_action('init', array($this, 'register_post_type')); |
|
34 | + add_action('init', array($this, 'taxonomy_setup')); |
|
35 | + add_filter('lsx_health_plan_single_template', array($this, 'enable_post_type'), 10, 1); |
|
36 | + add_filter('lsx_health_plan_connections', array($this, 'enable_connections'), 10, 1); |
|
37 | + add_action('cmb2_admin_init', array($this, 'featured_metabox'), 5); |
|
38 | + add_action('cmb2_admin_init', array($this, 'details_metaboxes')); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | /** |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | */ |
48 | 48 | public static function get_instance() { |
49 | 49 | // If the single instance hasn't been set, set it now. |
50 | - if ( null === self::$instance ) { |
|
50 | + if (null === self::$instance) { |
|
51 | 51 | self::$instance = new self(); |
52 | 52 | } |
53 | 53 | return self::$instance; |
@@ -57,21 +57,21 @@ discard block |
||
57 | 57 | */ |
58 | 58 | public function register_post_type() { |
59 | 59 | $labels = array( |
60 | - 'name' => esc_html__( 'Meals', 'lsx-health-plan' ), |
|
61 | - 'singular_name' => esc_html__( 'Meal', 'lsx-health-plan' ), |
|
62 | - 'add_new' => esc_html_x( 'Add New', 'post type general name', 'lsx-health-plan' ), |
|
63 | - 'add_new_item' => esc_html__( 'Add New', 'lsx-health-plan' ), |
|
64 | - 'edit_item' => esc_html__( 'Edit', 'lsx-health-plan' ), |
|
65 | - 'new_item' => esc_html__( 'New', 'lsx-health-plan' ), |
|
66 | - 'all_items' => esc_html__( 'All Meals', 'lsx-health-plan' ), |
|
67 | - 'view_item' => esc_html__( 'View', 'lsx-health-plan' ), |
|
68 | - 'search_items' => esc_html__( 'Search', 'lsx-health-plan' ), |
|
69 | - 'not_found' => esc_html__( 'None found', 'lsx-health-plan' ), |
|
70 | - 'not_found_in_trash' => esc_html__( 'None found in Trash', 'lsx-health-plan' ), |
|
60 | + 'name' => esc_html__('Meals', 'lsx-health-plan'), |
|
61 | + 'singular_name' => esc_html__('Meal', 'lsx-health-plan'), |
|
62 | + 'add_new' => esc_html_x('Add New', 'post type general name', 'lsx-health-plan'), |
|
63 | + 'add_new_item' => esc_html__('Add New', 'lsx-health-plan'), |
|
64 | + 'edit_item' => esc_html__('Edit', 'lsx-health-plan'), |
|
65 | + 'new_item' => esc_html__('New', 'lsx-health-plan'), |
|
66 | + 'all_items' => esc_html__('All Meals', 'lsx-health-plan'), |
|
67 | + 'view_item' => esc_html__('View', 'lsx-health-plan'), |
|
68 | + 'search_items' => esc_html__('Search', 'lsx-health-plan'), |
|
69 | + 'not_found' => esc_html__('None found', 'lsx-health-plan'), |
|
70 | + 'not_found_in_trash' => esc_html__('None found in Trash', 'lsx-health-plan'), |
|
71 | 71 | 'parent_item_colon' => '', |
72 | - 'menu_name' => esc_html__( 'Meals', 'lsx-health-plan' ), |
|
72 | + 'menu_name' => esc_html__('Meals', 'lsx-health-plan'), |
|
73 | 73 | ); |
74 | - $args = array( |
|
74 | + $args = array( |
|
75 | 75 | 'labels' => $labels, |
76 | 76 | 'public' => true, |
77 | 77 | 'publicly_queryable' => true, |
@@ -81,10 +81,10 @@ discard block |
||
81 | 81 | 'menu_icon' => 'dashicons-carrot', |
82 | 82 | 'query_var' => true, |
83 | 83 | 'rewrite' => array( |
84 | - 'slug' => \lsx_health_plan\functions\get_option( 'meal_single_slug', 'meal' ), |
|
84 | + 'slug' => \lsx_health_plan\functions\get_option('meal_single_slug', 'meal'), |
|
85 | 85 | ), |
86 | 86 | 'capability_type' => 'post', |
87 | - 'has_archive' => \lsx_health_plan\functions\get_option( 'endpoint_meal_archive', 'meals' ), |
|
87 | + 'has_archive' => \lsx_health_plan\functions\get_option('endpoint_meal_archive', 'meals'), |
|
88 | 88 | 'hierarchical' => true, |
89 | 89 | 'menu_position' => null, |
90 | 90 | 'supports' => array( |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | 'custom-fields', |
96 | 96 | ), |
97 | 97 | ); |
98 | - register_post_type( 'meal', $args ); |
|
98 | + register_post_type('meal', $args); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | /** |
@@ -103,19 +103,19 @@ discard block |
||
103 | 103 | */ |
104 | 104 | public function taxonomy_setup() { |
105 | 105 | $labels = array( |
106 | - 'name' => esc_html_x( 'Meal Type', 'taxonomy general name', 'lsx-health-plan' ), |
|
107 | - 'singular_name' => esc_html_x( 'Meal Types', 'taxonomy singular name', 'lsx-health-plan' ), |
|
108 | - 'search_items' => esc_html__( 'Search', 'lsx-health-plan' ), |
|
109 | - 'all_items' => esc_html__( 'All', 'lsx-health-plan' ), |
|
110 | - 'parent_item' => esc_html__( 'Parent', 'lsx-health-plan' ), |
|
111 | - 'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ), |
|
112 | - 'edit_item' => esc_html__( 'Edit', 'lsx-health-plan' ), |
|
113 | - 'update_item' => esc_html__( 'Update', 'lsx-health-plan' ), |
|
114 | - 'add_new_item' => esc_html__( 'Add New', 'lsx-health-plan' ), |
|
115 | - 'new_item_name' => esc_html__( 'New Name', 'lsx-health-plan' ), |
|
116 | - 'menu_name' => esc_html__( 'Meal Types', 'lsx-health-plan' ), |
|
106 | + 'name' => esc_html_x('Meal Type', 'taxonomy general name', 'lsx-health-plan'), |
|
107 | + 'singular_name' => esc_html_x('Meal Types', 'taxonomy singular name', 'lsx-health-plan'), |
|
108 | + 'search_items' => esc_html__('Search', 'lsx-health-plan'), |
|
109 | + 'all_items' => esc_html__('All', 'lsx-health-plan'), |
|
110 | + 'parent_item' => esc_html__('Parent', 'lsx-health-plan'), |
|
111 | + 'parent_item_colon' => esc_html__('Parent:', 'lsx-health-plan'), |
|
112 | + 'edit_item' => esc_html__('Edit', 'lsx-health-plan'), |
|
113 | + 'update_item' => esc_html__('Update', 'lsx-health-plan'), |
|
114 | + 'add_new_item' => esc_html__('Add New', 'lsx-health-plan'), |
|
115 | + 'new_item_name' => esc_html__('New Name', 'lsx-health-plan'), |
|
116 | + 'menu_name' => esc_html__('Meal Types', 'lsx-health-plan'), |
|
117 | 117 | ); |
118 | - $args = array( |
|
118 | + $args = array( |
|
119 | 119 | 'hierarchical' => true, |
120 | 120 | 'labels' => $labels, |
121 | 121 | 'show_ui' => true, |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | 'slug' => 'meal-type', |
127 | 127 | ), |
128 | 128 | ); |
129 | - register_taxonomy( 'meal-type', array( $this->slug ), $args ); |
|
129 | + register_taxonomy('meal-type', array($this->slug), $args); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | /** |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | * @param array $post_types |
136 | 136 | * @return array |
137 | 137 | */ |
138 | - public function enable_post_type( $post_types = array() ) { |
|
138 | + public function enable_post_type($post_types = array()) { |
|
139 | 139 | $post_types[] = $this->slug; |
140 | 140 | return $post_types; |
141 | 141 | } |
@@ -146,7 +146,7 @@ discard block |
||
146 | 146 | * @param array $connections |
147 | 147 | * @return void |
148 | 148 | */ |
149 | - public function enable_connections( $connections = array() ) { |
|
149 | + public function enable_connections($connections = array()) { |
|
150 | 150 | $connections['meal']['connected_plans'] = 'connected_meals'; |
151 | 151 | $connections['plan']['connected_meals'] = 'connected_plans'; |
152 | 152 | return $connections; |
@@ -159,8 +159,8 @@ discard block |
||
159 | 159 | $cmb = new_cmb2_box( |
160 | 160 | array( |
161 | 161 | 'id' => $this->slug . '_featured_metabox_meal', |
162 | - 'title' => __( 'Featured Meal', 'lsx-health-plan' ), |
|
163 | - 'object_types' => array( $this->slug ), // Post type |
|
162 | + 'title' => __('Featured Meal', 'lsx-health-plan'), |
|
163 | + 'object_types' => array($this->slug), // Post type |
|
164 | 164 | 'context' => 'side', |
165 | 165 | 'priority' => 'high', |
166 | 166 | 'show_names' => true, |
@@ -168,8 +168,8 @@ discard block |
||
168 | 168 | ); |
169 | 169 | $cmb->add_field( |
170 | 170 | array( |
171 | - 'name' => __( 'Featured Meal', 'lsx-health-plan' ), |
|
172 | - 'desc' => __( 'Enable a featured meal' ), |
|
171 | + 'name' => __('Featured Meal', 'lsx-health-plan'), |
|
172 | + 'desc' => __('Enable a featured meal'), |
|
173 | 173 | 'id' => $this->slug . '_featured_meal', |
174 | 174 | 'type' => 'checkbox', |
175 | 175 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
@@ -181,66 +181,66 @@ discard block |
||
181 | 181 | * Define the metabox and field configurations. |
182 | 182 | */ |
183 | 183 | public function details_metaboxes() { |
184 | - $cmb = new_cmb2_box( array( |
|
184 | + $cmb = new_cmb2_box(array( |
|
185 | 185 | 'id' => $this->slug . '_shopping_list_metabox', |
186 | - 'title' => __( 'Shopping List', 'lsx-health-plan' ), |
|
187 | - 'object_types' => array( $this->slug ), // Post type |
|
186 | + 'title' => __('Shopping List', 'lsx-health-plan'), |
|
187 | + 'object_types' => array($this->slug), // Post type |
|
188 | 188 | 'context' => 'normal', |
189 | 189 | 'priority' => 'high', |
190 | 190 | 'show_names' => true, |
191 | - ) ); |
|
192 | - $cmb->add_field( array( |
|
193 | - 'name' => __( 'Shopping List', 'lsx-health-plan' ), |
|
194 | - 'desc' => __( 'Connect the shopping list page that applies to this meal by entering the name of the page in the field provided.' ), |
|
191 | + )); |
|
192 | + $cmb->add_field(array( |
|
193 | + 'name' => __('Shopping List', 'lsx-health-plan'), |
|
194 | + 'desc' => __('Connect the shopping list page that applies to this meal by entering the name of the page in the field provided.'), |
|
195 | 195 | 'id' => $this->slug . '_shopping_list', |
196 | 196 | 'type' => 'post_search_ajax', |
197 | 197 | // Optional : |
198 | - 'limit' => 1, // Limit selection to X items only (default 1) |
|
198 | + 'limit' => 1, // Limit selection to X items only (default 1) |
|
199 | 199 | 'sortable' => true, // Allow selected items to be sortable (default false) |
200 | 200 | 'query_args' => array( |
201 | - 'post_type' => array( 'page' ), |
|
202 | - 'post_status' => array( 'publish' ), |
|
201 | + 'post_type' => array('page'), |
|
202 | + 'post_status' => array('publish'), |
|
203 | 203 | 'posts_per_page' => -1, |
204 | 204 | ), |
205 | - ) ); |
|
206 | - $cmb = new_cmb2_box( array( |
|
205 | + )); |
|
206 | + $cmb = new_cmb2_box(array( |
|
207 | 207 | 'id' => $this->slug . '_details_metabox', |
208 | - 'title' => __( 'Meal Details', 'lsx-health-plan' ), |
|
209 | - 'object_types' => array( $this->slug ), // Post type |
|
208 | + 'title' => __('Meal Details', 'lsx-health-plan'), |
|
209 | + 'object_types' => array($this->slug), // Post type |
|
210 | 210 | 'context' => 'normal', |
211 | 211 | 'priority' => 'high', |
212 | 212 | 'show_names' => true, |
213 | - ) ); |
|
213 | + )); |
|
214 | 214 | |
215 | - $cmb->add_field( array( |
|
216 | - 'name' => __( 'Meal Short Description', 'lsx-health-plan' ), |
|
215 | + $cmb->add_field(array( |
|
216 | + 'name' => __('Meal Short Description', 'lsx-health-plan'), |
|
217 | 217 | 'id' => $this->slug . '_short_description', |
218 | 218 | 'type' => 'textarea_small', |
219 | - 'desc' => __( 'Add a small description for this meal (optional)', 'lsx-health-plan' ), |
|
220 | - ) ); |
|
219 | + 'desc' => __('Add a small description for this meal (optional)', 'lsx-health-plan'), |
|
220 | + )); |
|
221 | 221 | |
222 | - $cmb->add_field( array( |
|
223 | - 'name' => __( 'Pre Breakfast Snack', 'lsx-health-plan' ), |
|
222 | + $cmb->add_field(array( |
|
223 | + 'name' => __('Pre Breakfast Snack', 'lsx-health-plan'), |
|
224 | 224 | 'id' => $this->slug . '_pre_breakfast_snack', |
225 | 225 | 'type' => 'wysiwyg', |
226 | 226 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
227 | 227 | 'options' => array( |
228 | 228 | 'textarea_rows' => 5, |
229 | 229 | ), |
230 | - ) ); |
|
231 | - $cmb->add_field( array( |
|
232 | - 'name' => __( 'Breakfast', 'lsx-health-plan' ), |
|
230 | + )); |
|
231 | + $cmb->add_field(array( |
|
232 | + 'name' => __('Breakfast', 'lsx-health-plan'), |
|
233 | 233 | 'id' => $this->slug . '_breakfast', |
234 | 234 | 'type' => 'wysiwyg', |
235 | 235 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
236 | 236 | 'options' => array( |
237 | 237 | 'textarea_rows' => 5, |
238 | 238 | ), |
239 | - ) ); |
|
239 | + )); |
|
240 | 240 | |
241 | 241 | $cmb->add_field( |
242 | 242 | array( |
243 | - 'name' => __( 'Post Breakfast Snack', 'lsx-health-plan' ), |
|
243 | + 'name' => __('Post Breakfast Snack', 'lsx-health-plan'), |
|
244 | 244 | 'id' => $this->slug . '_breakfast_snack', |
245 | 245 | 'type' => 'wysiwyg', |
246 | 246 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
@@ -250,19 +250,19 @@ discard block |
||
250 | 250 | ) |
251 | 251 | ); |
252 | 252 | |
253 | - if ( post_type_exists( 'recipe' ) ) { |
|
253 | + if (post_type_exists('recipe')) { |
|
254 | 254 | $cmb->add_field( |
255 | 255 | array( |
256 | - 'name' => __( 'Breakfast Recipes', 'lsx-health-plan' ), |
|
257 | - 'desc' => __( 'Connect additional recipes options for breakfast.', 'lsx-health-plan' ), |
|
256 | + 'name' => __('Breakfast Recipes', 'lsx-health-plan'), |
|
257 | + 'desc' => __('Connect additional recipes options for breakfast.', 'lsx-health-plan'), |
|
258 | 258 | 'id' => 'breakfast_recipes', |
259 | 259 | 'type' => 'post_search_ajax', |
260 | 260 | // Optional : |
261 | - 'limit' => 15, // Limit selection to X items only (default 1) |
|
261 | + 'limit' => 15, // Limit selection to X items only (default 1) |
|
262 | 262 | 'sortable' => true, // Allow selected items to be sortable (default false) |
263 | 263 | 'query_args' => array( |
264 | - 'post_type' => array( 'recipe' ), |
|
265 | - 'post_status' => array( 'publish' ), |
|
264 | + 'post_type' => array('recipe'), |
|
265 | + 'post_status' => array('publish'), |
|
266 | 266 | 'posts_per_page' => -1, |
267 | 267 | ), |
268 | 268 | ) |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | |
272 | 272 | $cmb->add_field( |
273 | 273 | array( |
274 | - 'name' => __( 'Pre Lunch Snack', 'lsx-health-plan' ), |
|
274 | + 'name' => __('Pre Lunch Snack', 'lsx-health-plan'), |
|
275 | 275 | 'id' => $this->slug . '_pre_lunch_snack', |
276 | 276 | 'type' => 'wysiwyg', |
277 | 277 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
@@ -282,7 +282,7 @@ discard block |
||
282 | 282 | ); |
283 | 283 | $cmb->add_field( |
284 | 284 | array( |
285 | - 'name' => __( 'Lunch', 'lsx-health-plan' ), |
|
285 | + 'name' => __('Lunch', 'lsx-health-plan'), |
|
286 | 286 | 'id' => $this->slug . '_lunch', |
287 | 287 | 'type' => 'wysiwyg', |
288 | 288 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | ); |
294 | 294 | $cmb->add_field( |
295 | 295 | array( |
296 | - 'name' => __( 'Post Lunch Snack', 'lsx-health-plan' ), |
|
296 | + 'name' => __('Post Lunch Snack', 'lsx-health-plan'), |
|
297 | 297 | 'id' => $this->slug . '_lunch_snack', |
298 | 298 | 'type' => 'wysiwyg', |
299 | 299 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
@@ -303,19 +303,19 @@ discard block |
||
303 | 303 | ) |
304 | 304 | ); |
305 | 305 | |
306 | - if ( post_type_exists( 'recipe' ) ) { |
|
306 | + if (post_type_exists('recipe')) { |
|
307 | 307 | $cmb->add_field( |
308 | 308 | array( |
309 | - 'name' => __( 'Lunch Recipes', 'lsx-health-plan' ), |
|
310 | - 'desc' => __( 'Connect additional recipes options for lunch.', 'lsx-health-plan' ), |
|
309 | + 'name' => __('Lunch Recipes', 'lsx-health-plan'), |
|
310 | + 'desc' => __('Connect additional recipes options for lunch.', 'lsx-health-plan'), |
|
311 | 311 | 'id' => 'lunch_recipes', |
312 | 312 | 'type' => 'post_search_ajax', |
313 | 313 | // Optional : |
314 | - 'limit' => 15, // Limit selection to X items only (default 1) |
|
314 | + 'limit' => 15, // Limit selection to X items only (default 1) |
|
315 | 315 | 'sortable' => true, // Allow selected items to be sortable (default false) |
316 | 316 | 'query_args' => array( |
317 | - 'post_type' => array( 'recipe' ), |
|
318 | - 'post_status' => array( 'publish' ), |
|
317 | + 'post_type' => array('recipe'), |
|
318 | + 'post_status' => array('publish'), |
|
319 | 319 | 'posts_per_page' => -1, |
320 | 320 | ), |
321 | 321 | ) |
@@ -324,7 +324,7 @@ discard block |
||
324 | 324 | |
325 | 325 | $cmb->add_field( |
326 | 326 | array( |
327 | - 'name' => __( 'Pre Dinner Snack', 'lsx-health-plan' ), |
|
327 | + 'name' => __('Pre Dinner Snack', 'lsx-health-plan'), |
|
328 | 328 | 'id' => $this->slug . '_pre_dinner_snack', |
329 | 329 | 'type' => 'wysiwyg', |
330 | 330 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
@@ -335,7 +335,7 @@ discard block |
||
335 | 335 | ); |
336 | 336 | $cmb->add_field( |
337 | 337 | array( |
338 | - 'name' => __( 'Dinner', 'lsx-health-plan' ), |
|
338 | + 'name' => __('Dinner', 'lsx-health-plan'), |
|
339 | 339 | 'id' => $this->slug . '_dinner', |
340 | 340 | 'type' => 'wysiwyg', |
341 | 341 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
@@ -346,7 +346,7 @@ discard block |
||
346 | 346 | ); |
347 | 347 | $cmb->add_field( |
348 | 348 | array( |
349 | - 'name' => __( 'Post Dinner Snack', 'lsx-health-plan' ), |
|
349 | + 'name' => __('Post Dinner Snack', 'lsx-health-plan'), |
|
350 | 350 | 'id' => $this->slug . '_dinner_snack', |
351 | 351 | 'type' => 'wysiwyg', |
352 | 352 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
@@ -356,19 +356,19 @@ discard block |
||
356 | 356 | ) |
357 | 357 | ); |
358 | 358 | |
359 | - if ( post_type_exists( 'recipe' ) ) { |
|
359 | + if (post_type_exists('recipe')) { |
|
360 | 360 | $cmb->add_field( |
361 | 361 | array( |
362 | - 'name' => __( 'Dinner Recipes', 'lsx-health-plan' ), |
|
363 | - 'desc' => __( 'Connect additional recipes options for dinner.', 'lsx-health-plan' ), |
|
362 | + 'name' => __('Dinner Recipes', 'lsx-health-plan'), |
|
363 | + 'desc' => __('Connect additional recipes options for dinner.', 'lsx-health-plan'), |
|
364 | 364 | 'id' => 'dinner_recipes', |
365 | 365 | 'type' => 'post_search_ajax', |
366 | 366 | // Optional : |
367 | - 'limit' => 15, // Limit selection to X items only (default 1) |
|
367 | + 'limit' => 15, // Limit selection to X items only (default 1) |
|
368 | 368 | 'sortable' => true, // Allow selected items to be sortable (default false) |
369 | 369 | 'query_args' => array( |
370 | - 'post_type' => array( 'recipe' ), |
|
371 | - 'post_status' => array( 'publish' ), |
|
370 | + 'post_type' => array('recipe'), |
|
371 | + 'post_status' => array('publish'), |
|
372 | 372 | 'posts_per_page' => -1, |
373 | 373 | ), |
374 | 374 | ) |