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