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