@@ -39,24 +39,24 @@ discard block |
||
| 39 | 39 | * Constructor |
| 40 | 40 | */ |
| 41 | 41 | public function __construct() { |
| 42 | - add_action( 'init', array( $this, 'register_post_type' ) ); |
|
| 43 | - add_action( 'init', array( $this, 'taxonomy_setup' ) ); |
|
| 44 | - add_action( 'admin_menu', array( $this, 'register_menus' ) ); |
|
| 42 | + add_action('init', array($this, 'register_post_type')); |
|
| 43 | + add_action('init', array($this, 'taxonomy_setup')); |
|
| 44 | + add_action('admin_menu', array($this, 'register_menus')); |
|
| 45 | 45 | |
| 46 | 46 | // Frontend Actions and Filters. |
| 47 | - add_action( 'wp_head', array( $this, 'remove_archive_original_header' ), 99 ); |
|
| 48 | - add_action( 'lsx_content_wrap_before', array( $this, 'hp_lsx_archive_header' ) ); |
|
| 47 | + add_action('wp_head', array($this, 'remove_archive_original_header'), 99); |
|
| 48 | + add_action('lsx_content_wrap_before', array($this, 'hp_lsx_archive_header')); |
|
| 49 | 49 | |
| 50 | - add_filter( 'lsx_health_plan_archive_template', array( $this, 'enable_post_type' ), 10, 1 ); |
|
| 51 | - add_filter( 'lsx_health_plan_single_template', array( $this, 'enable_post_type' ), 10, 1 ); |
|
| 52 | - add_filter( 'lsx_health_plan_connections', array( $this, 'enable_connections' ), 10, 1 ); |
|
| 53 | - add_filter( 'get_the_archive_title', array( $this, 'get_the_archive_title' ), 100 ); |
|
| 54 | - add_filter( 'lsx_display_global_header_description', array( $this, 'disable_global_header_description' ), 100 ); |
|
| 55 | - add_filter( 'woocommerce_get_breadcrumb', array( $this, 'recipes_breadcrumb_filter' ), 30, 1 ); |
|
| 50 | + add_filter('lsx_health_plan_archive_template', array($this, 'enable_post_type'), 10, 1); |
|
| 51 | + add_filter('lsx_health_plan_single_template', array($this, 'enable_post_type'), 10, 1); |
|
| 52 | + add_filter('lsx_health_plan_connections', array($this, 'enable_connections'), 10, 1); |
|
| 53 | + add_filter('get_the_archive_title', array($this, 'get_the_archive_title'), 100); |
|
| 54 | + add_filter('lsx_display_global_header_description', array($this, 'disable_global_header_description'), 100); |
|
| 55 | + add_filter('woocommerce_get_breadcrumb', array($this, 'recipes_breadcrumb_filter'), 30, 1); |
|
| 56 | 56 | |
| 57 | 57 | // Backend Actions and Filters. |
| 58 | - add_action( 'cmb2_admin_init', array( $this, 'featured_metabox' ) ); |
|
| 59 | - add_action( 'cmb2_admin_init', array( $this, 'details_metaboxes' ) ); |
|
| 58 | + add_action('cmb2_admin_init', array($this, 'featured_metabox')); |
|
| 59 | + add_action('cmb2_admin_init', array($this, 'details_metaboxes')); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | /** |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | public static function get_instance() { |
| 70 | 70 | |
| 71 | 71 | // If the single instance hasn't been set, set it now. |
| 72 | - if ( null === self::$instance ) { |
|
| 72 | + if (null === self::$instance) { |
|
| 73 | 73 | self::$instance = new self(); |
| 74 | 74 | } |
| 75 | 75 | |
@@ -82,21 +82,21 @@ discard block |
||
| 82 | 82 | */ |
| 83 | 83 | public function register_post_type() { |
| 84 | 84 | $this->labels = array( |
| 85 | - 'name' => esc_html__( 'Recipes', 'lsx-health-plan' ), |
|
| 86 | - 'singular_name' => esc_html__( 'Recipe', 'lsx-health-plan' ), |
|
| 87 | - 'add_new' => esc_html_x( 'Add New', 'post type general name', 'lsx-health-plan' ), |
|
| 88 | - 'add_new_item' => esc_html__( 'Add New', 'lsx-health-plan' ), |
|
| 89 | - 'edit_item' => esc_html__( 'Edit', 'lsx-health-plan' ), |
|
| 90 | - 'new_item' => esc_html__( 'New', 'lsx-health-plan' ), |
|
| 91 | - 'all_items' => esc_html__( 'All Recipes', 'lsx-health-plan' ), |
|
| 92 | - 'view_item' => esc_html__( 'View', 'lsx-health-plan' ), |
|
| 93 | - 'search_items' => esc_html__( 'Search', 'lsx-health-plan' ), |
|
| 94 | - 'not_found' => esc_html__( 'None found', 'lsx-health-plan' ), |
|
| 95 | - 'not_found_in_trash' => esc_html__( 'None found in Trash', 'lsx-health-plan' ), |
|
| 85 | + 'name' => esc_html__('Recipes', 'lsx-health-plan'), |
|
| 86 | + 'singular_name' => esc_html__('Recipe', 'lsx-health-plan'), |
|
| 87 | + 'add_new' => esc_html_x('Add New', 'post type general name', 'lsx-health-plan'), |
|
| 88 | + 'add_new_item' => esc_html__('Add New', 'lsx-health-plan'), |
|
| 89 | + 'edit_item' => esc_html__('Edit', 'lsx-health-plan'), |
|
| 90 | + 'new_item' => esc_html__('New', 'lsx-health-plan'), |
|
| 91 | + 'all_items' => esc_html__('All Recipes', 'lsx-health-plan'), |
|
| 92 | + 'view_item' => esc_html__('View', 'lsx-health-plan'), |
|
| 93 | + 'search_items' => esc_html__('Search', 'lsx-health-plan'), |
|
| 94 | + 'not_found' => esc_html__('None found', 'lsx-health-plan'), |
|
| 95 | + 'not_found_in_trash' => esc_html__('None found in Trash', 'lsx-health-plan'), |
|
| 96 | 96 | 'parent_item_colon' => '', |
| 97 | - 'menu_name' => esc_html__( 'Recipes', 'lsx-health-plan' ), |
|
| 97 | + 'menu_name' => esc_html__('Recipes', 'lsx-health-plan'), |
|
| 98 | 98 | ); |
| 99 | - $args = array( |
|
| 99 | + $args = array( |
|
| 100 | 100 | 'labels' => $this->labels, |
| 101 | 101 | 'public' => true, |
| 102 | 102 | 'publicly_queryable' => true, |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | 'custom-fields', |
| 120 | 120 | ), |
| 121 | 121 | ); |
| 122 | - register_post_type( 'recipe', $args ); |
|
| 122 | + register_post_type('recipe', $args); |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | /** |
@@ -128,9 +128,9 @@ discard block |
||
| 128 | 128 | * @return void |
| 129 | 129 | */ |
| 130 | 130 | public function register_menus() { |
| 131 | - add_submenu_page( 'edit.php?post_type=meal', esc_html__( 'Recipes', 'lsx-health-plan' ), esc_html__( 'Recipes', 'lsx-health-plan' ), 'edit_posts', 'edit.php?post_type=recipe' ); |
|
| 132 | - add_submenu_page( 'edit.php?post_type=meal', esc_html__( 'Recipe Types', 'lsx-health-plan' ), esc_html__( 'Recipe Types', 'lsx-health-plan' ), 'edit_posts', 'edit-tags.php?taxonomy=recipe-type&post_type=recipe' ); |
|
| 133 | - add_submenu_page( 'edit.php?post_type=meal', esc_html__( 'Cuisines', 'lsx-health-plan' ), esc_html__( 'Cuisines', 'lsx-health-plan' ), 'edit_posts', 'edit-tags.php?taxonomy=recipe-cuisine&post_type=recipe' ); |
|
| 131 | + add_submenu_page('edit.php?post_type=meal', esc_html__('Recipes', 'lsx-health-plan'), esc_html__('Recipes', 'lsx-health-plan'), 'edit_posts', 'edit.php?post_type=recipe'); |
|
| 132 | + add_submenu_page('edit.php?post_type=meal', esc_html__('Recipe Types', 'lsx-health-plan'), esc_html__('Recipe Types', 'lsx-health-plan'), 'edit_posts', 'edit-tags.php?taxonomy=recipe-type&post_type=recipe'); |
|
| 133 | + add_submenu_page('edit.php?post_type=meal', esc_html__('Cuisines', 'lsx-health-plan'), esc_html__('Cuisines', 'lsx-health-plan'), 'edit_posts', 'edit-tags.php?taxonomy=recipe-cuisine&post_type=recipe'); |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | /** |
@@ -138,19 +138,19 @@ discard block |
||
| 138 | 138 | */ |
| 139 | 139 | public function taxonomy_setup() { |
| 140 | 140 | $labels = array( |
| 141 | - 'name' => esc_html_x( 'Cuisine', 'taxonomy general name', 'lsx-health-plan' ), |
|
| 142 | - 'singular_name' => esc_html_x( 'Cuisines', 'taxonomy singular name', 'lsx-health-plan' ), |
|
| 143 | - 'search_items' => esc_html__( 'Search', 'lsx-health-plan' ), |
|
| 144 | - 'all_items' => esc_html__( 'All', 'lsx-health-plan' ), |
|
| 145 | - 'parent_item' => esc_html__( 'Parent', 'lsx-health-plan' ), |
|
| 146 | - 'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ), |
|
| 147 | - 'edit_item' => esc_html__( 'Edit', 'lsx-health-plan' ), |
|
| 148 | - 'update_item' => esc_html__( 'Update', 'lsx-health-plan' ), |
|
| 149 | - 'add_new_item' => esc_html__( 'Add New', 'lsx-health-plan' ), |
|
| 150 | - 'new_item_name' => esc_html__( 'New Name', 'lsx-health-plan' ), |
|
| 151 | - 'menu_name' => esc_html__( 'Cuisines', 'lsx-health-plan' ), |
|
| 141 | + 'name' => esc_html_x('Cuisine', 'taxonomy general name', 'lsx-health-plan'), |
|
| 142 | + 'singular_name' => esc_html_x('Cuisines', 'taxonomy singular name', 'lsx-health-plan'), |
|
| 143 | + 'search_items' => esc_html__('Search', 'lsx-health-plan'), |
|
| 144 | + 'all_items' => esc_html__('All', 'lsx-health-plan'), |
|
| 145 | + 'parent_item' => esc_html__('Parent', 'lsx-health-plan'), |
|
| 146 | + 'parent_item_colon' => esc_html__('Parent:', 'lsx-health-plan'), |
|
| 147 | + 'edit_item' => esc_html__('Edit', 'lsx-health-plan'), |
|
| 148 | + 'update_item' => esc_html__('Update', 'lsx-health-plan'), |
|
| 149 | + 'add_new_item' => esc_html__('Add New', 'lsx-health-plan'), |
|
| 150 | + 'new_item_name' => esc_html__('New Name', 'lsx-health-plan'), |
|
| 151 | + 'menu_name' => esc_html__('Cuisines', 'lsx-health-plan'), |
|
| 152 | 152 | ); |
| 153 | - $args = array( |
|
| 153 | + $args = array( |
|
| 154 | 154 | 'hierarchical' => true, |
| 155 | 155 | 'labels' => $labels, |
| 156 | 156 | 'show_ui' => true, |
@@ -161,22 +161,22 @@ discard block |
||
| 161 | 161 | 'slug' => 'recipe-cuisine', |
| 162 | 162 | ), |
| 163 | 163 | ); |
| 164 | - register_taxonomy( 'recipe-cuisine', array( $this->slug ), $args ); |
|
| 164 | + register_taxonomy('recipe-cuisine', array($this->slug), $args); |
|
| 165 | 165 | |
| 166 | 166 | $labels = array( |
| 167 | - 'name' => esc_html_x( 'Recipe Type', 'taxonomy general name', 'lsx-health-plan' ), |
|
| 168 | - 'singular_name' => esc_html_x( 'Recipe Types', 'taxonomy singular name', 'lsx-health-plan' ), |
|
| 169 | - 'search_items' => esc_html__( 'Search', 'lsx-health-plan' ), |
|
| 170 | - 'all_items' => esc_html__( 'All', 'lsx-health-plan' ), |
|
| 171 | - 'parent_item' => esc_html__( 'Parent', 'lsx-health-plan' ), |
|
| 172 | - 'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ), |
|
| 173 | - 'edit_item' => esc_html__( 'Edit', 'lsx-health-plan' ), |
|
| 174 | - 'update_item' => esc_html__( 'Update', 'lsx-health-plan' ), |
|
| 175 | - 'add_new_item' => esc_html__( 'Add New', 'lsx-health-plan' ), |
|
| 176 | - 'new_item_name' => esc_html__( 'New Name', 'lsx-health-plan' ), |
|
| 177 | - 'menu_name' => esc_html__( 'Types', 'lsx-health-plan' ), |
|
| 167 | + 'name' => esc_html_x('Recipe Type', 'taxonomy general name', 'lsx-health-plan'), |
|
| 168 | + 'singular_name' => esc_html_x('Recipe Types', 'taxonomy singular name', 'lsx-health-plan'), |
|
| 169 | + 'search_items' => esc_html__('Search', 'lsx-health-plan'), |
|
| 170 | + 'all_items' => esc_html__('All', 'lsx-health-plan'), |
|
| 171 | + 'parent_item' => esc_html__('Parent', 'lsx-health-plan'), |
|
| 172 | + 'parent_item_colon' => esc_html__('Parent:', 'lsx-health-plan'), |
|
| 173 | + 'edit_item' => esc_html__('Edit', 'lsx-health-plan'), |
|
| 174 | + 'update_item' => esc_html__('Update', 'lsx-health-plan'), |
|
| 175 | + 'add_new_item' => esc_html__('Add New', 'lsx-health-plan'), |
|
| 176 | + 'new_item_name' => esc_html__('New Name', 'lsx-health-plan'), |
|
| 177 | + 'menu_name' => esc_html__('Types', 'lsx-health-plan'), |
|
| 178 | 178 | ); |
| 179 | - $args = array( |
|
| 179 | + $args = array( |
|
| 180 | 180 | 'hierarchical' => true, |
| 181 | 181 | 'labels' => $labels, |
| 182 | 182 | 'show_ui' => true, |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | 'slug' => 'recipe-type', |
| 188 | 188 | ), |
| 189 | 189 | ); |
| 190 | - register_taxonomy( 'recipe-type', array( $this->slug ), $args ); |
|
| 190 | + register_taxonomy('recipe-type', array($this->slug), $args); |
|
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | /** |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | * @param array $post_types |
| 197 | 197 | * @return array |
| 198 | 198 | */ |
| 199 | - public function enable_post_type( $post_types = array() ) { |
|
| 199 | + public function enable_post_type($post_types = array()) { |
|
| 200 | 200 | $post_types[] = $this->slug; |
| 201 | 201 | return $post_types; |
| 202 | 202 | } |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | * @param array $connections |
| 208 | 208 | * @return void |
| 209 | 209 | */ |
| 210 | - public function enable_connections( $connections = array() ) { |
|
| 210 | + public function enable_connections($connections = array()) { |
|
| 211 | 211 | $connections['recipe']['connected_plans'] = 'connected_recipes'; |
| 212 | 212 | $connections['plan']['connected_recipes'] = 'connected_plans'; |
| 213 | 213 | return $connections; |
@@ -219,42 +219,42 @@ discard block |
||
| 219 | 219 | * @param string $title the term title. |
| 220 | 220 | * @return string |
| 221 | 221 | */ |
| 222 | - public function get_the_archive_title( $title ) { |
|
| 223 | - if ( is_post_type_archive( 'recipe' ) ) { |
|
| 224 | - $title = __( 'Recipes', 'lsx-health-plan' ); |
|
| 222 | + public function get_the_archive_title($title) { |
|
| 223 | + if (is_post_type_archive('recipe')) { |
|
| 224 | + $title = __('Recipes', 'lsx-health-plan'); |
|
| 225 | 225 | } |
| 226 | - if ( is_post_type_archive( 'exercise' ) ) { |
|
| 227 | - $title = __( 'Exercises', 'lsx-health-plan' ); |
|
| 226 | + if (is_post_type_archive('exercise')) { |
|
| 227 | + $title = __('Exercises', 'lsx-health-plan'); |
|
| 228 | 228 | } |
| 229 | - if ( is_tax( 'recipe-type' ) ) { |
|
| 229 | + if (is_tax('recipe-type')) { |
|
| 230 | 230 | $queried_object = get_queried_object(); |
| 231 | - if ( isset( $queried_object->name ) ) { |
|
| 232 | - $title = $queried_object->name . ' ' . __( 'Recipes', 'lsx-health-plan' ); |
|
| 231 | + if (isset($queried_object->name)) { |
|
| 232 | + $title = $queried_object->name . ' ' . __('Recipes', 'lsx-health-plan'); |
|
| 233 | 233 | } |
| 234 | 234 | } |
| 235 | 235 | return $title; |
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | public function remove_archive_original_header() { |
| 239 | - if ( is_post_type_archive( 'recipe' ) || is_post_type_archive( 'exercise' ) ) { |
|
| 240 | - remove_action( 'lsx_content_wrap_before', 'lsx_global_header' ); |
|
| 239 | + if (is_post_type_archive('recipe') || is_post_type_archive('exercise')) { |
|
| 240 | + remove_action('lsx_content_wrap_before', 'lsx_global_header'); |
|
| 241 | 241 | } |
| 242 | - if ( ! is_post_type_archive() ) { |
|
| 243 | - add_action( 'lsx_content_wrap_before', 'lsx_health_plan_recipe_archive_description', 11 ); |
|
| 242 | + if ( ! is_post_type_archive()) { |
|
| 243 | + add_action('lsx_content_wrap_before', 'lsx_health_plan_recipe_archive_description', 11); |
|
| 244 | 244 | } |
| 245 | 245 | } |
| 246 | 246 | |
| 247 | 247 | public function hp_lsx_archive_header() { |
| 248 | - if ( is_post_type_archive( 'recipe' ) || is_post_type_archive( 'exercise' ) ) { |
|
| 248 | + if (is_post_type_archive('recipe') || is_post_type_archive('exercise')) { |
|
| 249 | 249 | ?> |
| 250 | 250 | <div class="archive-header-wrapper banner-archive"> |
| 251 | 251 | <?php lsx_global_header_inner_bottom(); ?> |
| 252 | 252 | <header class="archive-header"> |
| 253 | 253 | <h1 class="archive-title"> |
| 254 | - <?php if ( has_post_format() && ! is_category() && ! is_tag() && ! is_date() && ! is_tax( 'post_format' ) ) { ?> |
|
| 255 | - <?php the_archive_title( esc_html__( 'Type:', 'lsx' ) ); ?> |
|
| 254 | + <?php if (has_post_format() && ! is_category() && ! is_tag() && ! is_date() && ! is_tax('post_format')) { ?> |
|
| 255 | + <?php the_archive_title(esc_html__('Type:', 'lsx')); ?> |
|
| 256 | 256 | <?php } else { ?> |
| 257 | - <?php echo wp_kses_post( apply_filters( 'lsx_global_header_title', get_the_archive_title() ) ); ?> |
|
| 257 | + <?php echo wp_kses_post(apply_filters('lsx_global_header_title', get_the_archive_title())); ?> |
|
| 258 | 258 | <?php } ?> |
| 259 | 259 | </h1> |
| 260 | 260 | |
@@ -273,8 +273,8 @@ discard block |
||
| 273 | 273 | * @param boolean $disable |
| 274 | 274 | * @return boolean |
| 275 | 275 | */ |
| 276 | - public function disable_global_header_description( $disable ) { |
|
| 277 | - if ( is_tax( 'recipe-type' ) ) { |
|
| 276 | + public function disable_global_header_description($disable) { |
|
| 277 | + if (is_tax('recipe-type')) { |
|
| 278 | 278 | $disable = true; |
| 279 | 279 | } |
| 280 | 280 | return $disable; |
@@ -286,16 +286,16 @@ discard block |
||
| 286 | 286 | * @var array $crumbs |
| 287 | 287 | * @return array |
| 288 | 288 | */ |
| 289 | - public function recipes_breadcrumb_filter( $crumbs ) { |
|
| 290 | - $recipe = \lsx_health_plan\functions\get_option( 'endpoint_recipe', 'recipe' ); |
|
| 291 | - $recipes = \lsx_health_plan\functions\get_option( 'endpoint_recipe_archive', 'recipes' ); |
|
| 292 | - $url = get_post_type_archive_link( 'recipe' ); |
|
| 289 | + public function recipes_breadcrumb_filter($crumbs) { |
|
| 290 | + $recipe = \lsx_health_plan\functions\get_option('endpoint_recipe', 'recipe'); |
|
| 291 | + $recipes = \lsx_health_plan\functions\get_option('endpoint_recipe_archive', 'recipes'); |
|
| 292 | + $url = get_post_type_archive_link('recipe'); |
|
| 293 | 293 | |
| 294 | - if ( is_singular( 'recipe' ) ) { |
|
| 294 | + if (is_singular('recipe')) { |
|
| 295 | 295 | $recipe_name = get_the_title(); |
| 296 | - $term_obj_list = get_the_terms( get_the_ID(), 'recipe-type' ); |
|
| 296 | + $term_obj_list = get_the_terms(get_the_ID(), 'recipe-type'); |
|
| 297 | 297 | $recipe_type = $term_obj_list[0]->name; |
| 298 | - $recipe_type_url = get_term_link( $term_obj_list[0]->term_id ); |
|
| 298 | + $recipe_type_url = get_term_link($term_obj_list[0]->term_id); |
|
| 299 | 299 | |
| 300 | 300 | $crumbs[1] = array( |
| 301 | 301 | 0 => $recipes, |
@@ -309,10 +309,10 @@ discard block |
||
| 309 | 309 | 0 => $recipe_name, |
| 310 | 310 | ); |
| 311 | 311 | } |
| 312 | - if ( is_tax( 'recipe-type' ) || is_tax( 'recipe-cuisine' ) ) { |
|
| 313 | - $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); |
|
| 312 | + if (is_tax('recipe-type') || is_tax('recipe-cuisine')) { |
|
| 313 | + $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy')); |
|
| 314 | 314 | |
| 315 | - $single_term_title = str_replace( '-', ' ', $term->taxonomy ) . ': ' . $term->name; |
|
| 315 | + $single_term_title = str_replace('-', ' ', $term->taxonomy) . ': ' . $term->name; |
|
| 316 | 316 | |
| 317 | 317 | $crumbs[1] = array( |
| 318 | 318 | 0 => $recipes, |
@@ -332,8 +332,8 @@ discard block |
||
| 332 | 332 | $cmb = new_cmb2_box( |
| 333 | 333 | array( |
| 334 | 334 | 'id' => $this->slug . '_featured_metabox', |
| 335 | - 'title' => __( 'Featured', 'lsx-health-plan' ), |
|
| 336 | - 'object_types' => array( $this->slug ), |
|
| 335 | + 'title' => __('Featured', 'lsx-health-plan'), |
|
| 336 | + 'object_types' => array($this->slug), |
|
| 337 | 337 | 'context' => 'side', |
| 338 | 338 | 'priority' => 'high', |
| 339 | 339 | 'show_names' => true, |
@@ -341,8 +341,8 @@ discard block |
||
| 341 | 341 | ); |
| 342 | 342 | $cmb->add_field( |
| 343 | 343 | array( |
| 344 | - 'name' => __( 'Featured', 'lsx-health-plan' ), |
|
| 345 | - 'desc' => __( 'Enable the checkbox to feature this recipe, featured recipes display in any page that has the recipe shortcode: [lsx_health_plan_featured_recipes_block]', 'lsx-health-plan' ), |
|
| 344 | + 'name' => __('Featured', 'lsx-health-plan'), |
|
| 345 | + 'desc' => __('Enable the checkbox to feature this recipe, featured recipes display in any page that has the recipe shortcode: [lsx_health_plan_featured_recipes_block]', 'lsx-health-plan'), |
|
| 346 | 346 | 'id' => $this->slug . '_featured', |
| 347 | 347 | 'type' => 'checkbox', |
| 348 | 348 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
@@ -357,8 +357,8 @@ discard block |
||
| 357 | 357 | $cmb = new_cmb2_box( |
| 358 | 358 | array( |
| 359 | 359 | 'id' => $this->slug . '_details_metabox', |
| 360 | - 'title' => __( 'Cooking Info', 'lsx-health-plan' ), |
|
| 361 | - 'object_types' => array( $this->slug ), // Post type |
|
| 360 | + 'title' => __('Cooking Info', 'lsx-health-plan'), |
|
| 361 | + 'object_types' => array($this->slug), // Post type |
|
| 362 | 362 | 'context' => 'normal', |
| 363 | 363 | 'priority' => 'high', |
| 364 | 364 | 'show_names' => true, |
@@ -366,27 +366,27 @@ discard block |
||
| 366 | 366 | ); |
| 367 | 367 | $cmb->add_field( |
| 368 | 368 | array( |
| 369 | - 'name' => __( 'Prep Time', 'lsx-health-plan' ), |
|
| 369 | + 'name' => __('Prep Time', 'lsx-health-plan'), |
|
| 370 | 370 | 'id' => $this->slug . '_prep_time', |
| 371 | - 'desc' => __( 'Add the preparation time for the entire meal i.e: 25 mins', 'lsx-health-plan' ), |
|
| 371 | + 'desc' => __('Add the preparation time for the entire meal i.e: 25 mins', 'lsx-health-plan'), |
|
| 372 | 372 | 'type' => 'text', |
| 373 | 373 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
| 374 | 374 | ) |
| 375 | 375 | ); |
| 376 | 376 | $cmb->add_field( |
| 377 | 377 | array( |
| 378 | - 'name' => __( 'Cooking Time', 'lsx-health-plan' ), |
|
| 378 | + 'name' => __('Cooking Time', 'lsx-health-plan'), |
|
| 379 | 379 | 'id' => $this->slug . '_cooking_time', |
| 380 | - 'desc' => __( 'Add the cooking time i.e: 15 mins', 'lsx-health-plan' ), |
|
| 380 | + 'desc' => __('Add the cooking time i.e: 15 mins', 'lsx-health-plan'), |
|
| 381 | 381 | 'type' => 'text', |
| 382 | 382 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
| 383 | 383 | ) |
| 384 | 384 | ); |
| 385 | 385 | $cmb->add_field( |
| 386 | 386 | array( |
| 387 | - 'name' => __( 'Serves', 'lsx-health-plan' ), |
|
| 387 | + 'name' => __('Serves', 'lsx-health-plan'), |
|
| 388 | 388 | 'id' => $this->slug . '_serves', |
| 389 | - 'desc' => __( 'Add the recommended serving size i.e: 6', 'lsx-health-plan' ), |
|
| 389 | + 'desc' => __('Add the recommended serving size i.e: 6', 'lsx-health-plan'), |
|
| 390 | 390 | 'type' => 'text', |
| 391 | 391 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
| 392 | 392 | 'attributes' => array( |
@@ -397,8 +397,8 @@ discard block |
||
| 397 | 397 | ); |
| 398 | 398 | $cmb->add_field( |
| 399 | 399 | array( |
| 400 | - 'name' => __( 'Portion', 'lsx-health-plan' ), |
|
| 401 | - 'desc' => __( 'Add the recommended portion size i.e: 200mg', 'lsx-health-plan' ), |
|
| 400 | + 'name' => __('Portion', 'lsx-health-plan'), |
|
| 401 | + 'desc' => __('Add the recommended portion size i.e: 200mg', 'lsx-health-plan'), |
|
| 402 | 402 | 'id' => $this->slug . '_portion', |
| 403 | 403 | 'type' => 'text', |
| 404 | 404 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
@@ -407,8 +407,8 @@ discard block |
||
| 407 | 407 | $cmb = new_cmb2_box( |
| 408 | 408 | array( |
| 409 | 409 | 'id' => $this->slug . '_nutritional_metabox', |
| 410 | - 'title' => __( 'Nutritional Info', 'lsx-health-plan' ), |
|
| 411 | - 'object_types' => array( $this->slug ), // Post type |
|
| 410 | + 'title' => __('Nutritional Info', 'lsx-health-plan'), |
|
| 411 | + 'object_types' => array($this->slug), // Post type |
|
| 412 | 412 | 'context' => 'normal', |
| 413 | 413 | 'priority' => 'high', |
| 414 | 414 | 'show_names' => true, |
@@ -416,45 +416,45 @@ discard block |
||
| 416 | 416 | ); |
| 417 | 417 | $cmb->add_field( |
| 418 | 418 | array( |
| 419 | - 'name' => __( 'Energy', 'lsx-health-plan' ), |
|
| 419 | + 'name' => __('Energy', 'lsx-health-plan'), |
|
| 420 | 420 | 'id' => $this->slug . '_energy', |
| 421 | - 'desc' => __( 'Add the energy amount for the entire meal i.e: 700 kj', 'lsx-health-plan' ), |
|
| 421 | + 'desc' => __('Add the energy amount for the entire meal i.e: 700 kj', 'lsx-health-plan'), |
|
| 422 | 422 | 'type' => 'text', |
| 423 | 423 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
| 424 | 424 | ) |
| 425 | 425 | ); |
| 426 | 426 | $cmb->add_field( |
| 427 | 427 | array( |
| 428 | - 'name' => __( 'Protein', 'lsx-health-plan' ), |
|
| 428 | + 'name' => __('Protein', 'lsx-health-plan'), |
|
| 429 | 429 | 'id' => $this->slug . '_protein', |
| 430 | - 'desc' => __( 'Add the protein amount for the entire meal i.e: 50 g', 'lsx-health-plan' ), |
|
| 430 | + 'desc' => __('Add the protein amount for the entire meal i.e: 50 g', 'lsx-health-plan'), |
|
| 431 | 431 | 'type' => 'text', |
| 432 | 432 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
| 433 | 433 | ) |
| 434 | 434 | ); |
| 435 | 435 | $cmb->add_field( |
| 436 | 436 | array( |
| 437 | - 'name' => __( 'Carbohydrates', 'lsx-health-plan' ), |
|
| 437 | + 'name' => __('Carbohydrates', 'lsx-health-plan'), |
|
| 438 | 438 | 'id' => $this->slug . '_carbohydrates', |
| 439 | - 'desc' => __( 'Add the carbohydrates amount for the entire meal i.e: 5 g', 'lsx-health-plan' ), |
|
| 439 | + 'desc' => __('Add the carbohydrates amount for the entire meal i.e: 5 g', 'lsx-health-plan'), |
|
| 440 | 440 | 'type' => 'text', |
| 441 | 441 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
| 442 | 442 | ) |
| 443 | 443 | ); |
| 444 | 444 | $cmb->add_field( |
| 445 | 445 | array( |
| 446 | - 'name' => __( 'Fibre', 'lsx-health-plan' ), |
|
| 446 | + 'name' => __('Fibre', 'lsx-health-plan'), |
|
| 447 | 447 | 'id' => $this->slug . '_fibre', |
| 448 | - 'desc' => __( 'Add the fibre amount for the entire meal i.e: 5 g', 'lsx-health-plan' ), |
|
| 448 | + 'desc' => __('Add the fibre amount for the entire meal i.e: 5 g', 'lsx-health-plan'), |
|
| 449 | 449 | 'type' => 'text', |
| 450 | 450 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
| 451 | 451 | ) |
| 452 | 452 | ); |
| 453 | 453 | $cmb->add_field( |
| 454 | 454 | array( |
| 455 | - 'name' => __( 'Fat', 'lsx-health-plan' ), |
|
| 455 | + 'name' => __('Fat', 'lsx-health-plan'), |
|
| 456 | 456 | 'id' => $this->slug . '_fat', |
| 457 | - 'desc' => __( 'Add the fat amount for the entire meal i.e: 20 g', 'lsx-health-plan' ), |
|
| 457 | + 'desc' => __('Add the fat amount for the entire meal i.e: 20 g', 'lsx-health-plan'), |
|
| 458 | 458 | 'type' => 'text', |
| 459 | 459 | 'show_on_cb' => 'cmb2_hide_if_no_cats', |
| 460 | 460 | ) |
@@ -8,245 +8,245 @@ discard block |
||
| 8 | 8 | */ |
| 9 | 9 | class Recipe { |
| 10 | 10 | |
| 11 | - /** |
|
| 12 | - * Holds class instance |
|
| 13 | - * |
|
| 14 | - * @since 1.0.0 |
|
| 15 | - * |
|
| 16 | - * @var object \lsx_health_plan\classes\Recipe() |
|
| 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\Recipe() |
|
| 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 = 'recipe'; |
|
| 20 | + /** |
|
| 21 | + * Holds post_type slug used as an index |
|
| 22 | + * |
|
| 23 | + * @since 1.0.0 |
|
| 24 | + * |
|
| 25 | + * @var string |
|
| 26 | + */ |
|
| 27 | + public $slug = 'recipe'; |
|
| 28 | 28 | |
| 29 | - /** |
|
| 30 | - * Holds post_type labels |
|
| 31 | - * |
|
| 32 | - * @since 1.0.0 |
|
| 33 | - * |
|
| 34 | - * @var string |
|
| 35 | - */ |
|
| 36 | - public $labels = array(); |
|
| 29 | + /** |
|
| 30 | + * Holds post_type labels |
|
| 31 | + * |
|
| 32 | + * @since 1.0.0 |
|
| 33 | + * |
|
| 34 | + * @var string |
|
| 35 | + */ |
|
| 36 | + public $labels = array(); |
|
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * Constructor |
|
| 40 | - */ |
|
| 41 | - public function __construct() { |
|
| 42 | - add_action( 'init', array( $this, 'register_post_type' ) ); |
|
| 43 | - add_action( 'init', array( $this, 'taxonomy_setup' ) ); |
|
| 44 | - add_action( 'admin_menu', array( $this, 'register_menus' ) ); |
|
| 38 | + /** |
|
| 39 | + * Constructor |
|
| 40 | + */ |
|
| 41 | + public function __construct() { |
|
| 42 | + add_action( 'init', array( $this, 'register_post_type' ) ); |
|
| 43 | + add_action( 'init', array( $this, 'taxonomy_setup' ) ); |
|
| 44 | + add_action( 'admin_menu', array( $this, 'register_menus' ) ); |
|
| 45 | 45 | |
| 46 | - // Frontend Actions and Filters. |
|
| 47 | - add_action( 'wp_head', array( $this, 'remove_archive_original_header' ), 99 ); |
|
| 48 | - add_action( 'lsx_content_wrap_before', array( $this, 'hp_lsx_archive_header' ) ); |
|
| 46 | + // Frontend Actions and Filters. |
|
| 47 | + add_action( 'wp_head', array( $this, 'remove_archive_original_header' ), 99 ); |
|
| 48 | + add_action( 'lsx_content_wrap_before', array( $this, 'hp_lsx_archive_header' ) ); |
|
| 49 | 49 | |
| 50 | - add_filter( 'lsx_health_plan_archive_template', array( $this, 'enable_post_type' ), 10, 1 ); |
|
| 51 | - add_filter( 'lsx_health_plan_single_template', array( $this, 'enable_post_type' ), 10, 1 ); |
|
| 52 | - add_filter( 'lsx_health_plan_connections', array( $this, 'enable_connections' ), 10, 1 ); |
|
| 53 | - add_filter( 'get_the_archive_title', array( $this, 'get_the_archive_title' ), 100 ); |
|
| 54 | - add_filter( 'lsx_display_global_header_description', array( $this, 'disable_global_header_description' ), 100 ); |
|
| 55 | - add_filter( 'woocommerce_get_breadcrumb', array( $this, 'recipes_breadcrumb_filter' ), 30, 1 ); |
|
| 50 | + add_filter( 'lsx_health_plan_archive_template', array( $this, 'enable_post_type' ), 10, 1 ); |
|
| 51 | + add_filter( 'lsx_health_plan_single_template', array( $this, 'enable_post_type' ), 10, 1 ); |
|
| 52 | + add_filter( 'lsx_health_plan_connections', array( $this, 'enable_connections' ), 10, 1 ); |
|
| 53 | + add_filter( 'get_the_archive_title', array( $this, 'get_the_archive_title' ), 100 ); |
|
| 54 | + add_filter( 'lsx_display_global_header_description', array( $this, 'disable_global_header_description' ), 100 ); |
|
| 55 | + add_filter( 'woocommerce_get_breadcrumb', array( $this, 'recipes_breadcrumb_filter' ), 30, 1 ); |
|
| 56 | 56 | |
| 57 | - // Backend Actions and Filters. |
|
| 58 | - add_action( 'cmb2_admin_init', array( $this, 'featured_metabox' ) ); |
|
| 59 | - add_action( 'cmb2_admin_init', array( $this, 'details_metaboxes' ) ); |
|
| 60 | - } |
|
| 57 | + // Backend Actions and Filters. |
|
| 58 | + add_action( 'cmb2_admin_init', array( $this, 'featured_metabox' ) ); |
|
| 59 | + add_action( 'cmb2_admin_init', array( $this, 'details_metaboxes' ) ); |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | - /** |
|
| 63 | - * Return an instance of this class. |
|
| 64 | - * |
|
| 65 | - * @since 1.0.0 |
|
| 66 | - * |
|
| 67 | - * @return object \lsx_health_plan\classes\Recipe() A single instance of this class. |
|
| 68 | - */ |
|
| 69 | - public static function get_instance() { |
|
| 62 | + /** |
|
| 63 | + * Return an instance of this class. |
|
| 64 | + * |
|
| 65 | + * @since 1.0.0 |
|
| 66 | + * |
|
| 67 | + * @return object \lsx_health_plan\classes\Recipe() A single instance of this class. |
|
| 68 | + */ |
|
| 69 | + public static function get_instance() { |
|
| 70 | 70 | |
| 71 | - // If the single instance hasn't been set, set it now. |
|
| 72 | - if ( null === self::$instance ) { |
|
| 73 | - self::$instance = new self(); |
|
| 74 | - } |
|
| 71 | + // If the single instance hasn't been set, set it now. |
|
| 72 | + if ( null === self::$instance ) { |
|
| 73 | + self::$instance = new self(); |
|
| 74 | + } |
|
| 75 | 75 | |
| 76 | - return self::$instance; |
|
| 76 | + return self::$instance; |
|
| 77 | 77 | |
| 78 | - } |
|
| 78 | + } |
|
| 79 | 79 | |
| 80 | - /** |
|
| 81 | - * Register the post type. |
|
| 82 | - */ |
|
| 83 | - public function register_post_type() { |
|
| 84 | - $this->labels = array( |
|
| 85 | - 'name' => esc_html__( 'Recipes', 'lsx-health-plan' ), |
|
| 86 | - 'singular_name' => esc_html__( 'Recipe', 'lsx-health-plan' ), |
|
| 87 | - 'add_new' => esc_html_x( 'Add New', 'post type general name', 'lsx-health-plan' ), |
|
| 88 | - 'add_new_item' => esc_html__( 'Add New', 'lsx-health-plan' ), |
|
| 89 | - 'edit_item' => esc_html__( 'Edit', 'lsx-health-plan' ), |
|
| 90 | - 'new_item' => esc_html__( 'New', 'lsx-health-plan' ), |
|
| 91 | - 'all_items' => esc_html__( 'All Recipes', 'lsx-health-plan' ), |
|
| 92 | - 'view_item' => esc_html__( 'View', 'lsx-health-plan' ), |
|
| 93 | - 'search_items' => esc_html__( 'Search', 'lsx-health-plan' ), |
|
| 94 | - 'not_found' => esc_html__( 'None found', 'lsx-health-plan' ), |
|
| 95 | - 'not_found_in_trash' => esc_html__( 'None found in Trash', 'lsx-health-plan' ), |
|
| 96 | - 'parent_item_colon' => '', |
|
| 97 | - 'menu_name' => esc_html__( 'Recipes', 'lsx-health-plan' ), |
|
| 98 | - ); |
|
| 99 | - $args = array( |
|
| 100 | - 'labels' => $this->labels, |
|
| 101 | - 'public' => true, |
|
| 102 | - 'publicly_queryable' => true, |
|
| 103 | - 'show_ui' => true, |
|
| 104 | - 'show_in_menu' => false, |
|
| 105 | - 'show_in_rest' => true, |
|
| 106 | - 'menu_icon' => 'dashicons-editor-ul', |
|
| 107 | - 'query_var' => true, |
|
| 108 | - 'rewrite' => array( |
|
| 109 | - 'slug' => 'recipe', |
|
| 110 | - ), |
|
| 111 | - 'capability_type' => 'post', |
|
| 112 | - 'has_archive' => 'recipes', |
|
| 113 | - 'hierarchical' => false, |
|
| 114 | - 'menu_position' => null, |
|
| 115 | - 'supports' => array( |
|
| 116 | - 'title', |
|
| 117 | - 'editor', |
|
| 118 | - 'thumbnail', |
|
| 119 | - 'custom-fields', |
|
| 120 | - ), |
|
| 121 | - ); |
|
| 122 | - register_post_type( 'recipe', $args ); |
|
| 123 | - } |
|
| 80 | + /** |
|
| 81 | + * Register the post type. |
|
| 82 | + */ |
|
| 83 | + public function register_post_type() { |
|
| 84 | + $this->labels = array( |
|
| 85 | + 'name' => esc_html__( 'Recipes', 'lsx-health-plan' ), |
|
| 86 | + 'singular_name' => esc_html__( 'Recipe', 'lsx-health-plan' ), |
|
| 87 | + 'add_new' => esc_html_x( 'Add New', 'post type general name', 'lsx-health-plan' ), |
|
| 88 | + 'add_new_item' => esc_html__( 'Add New', 'lsx-health-plan' ), |
|
| 89 | + 'edit_item' => esc_html__( 'Edit', 'lsx-health-plan' ), |
|
| 90 | + 'new_item' => esc_html__( 'New', 'lsx-health-plan' ), |
|
| 91 | + 'all_items' => esc_html__( 'All Recipes', 'lsx-health-plan' ), |
|
| 92 | + 'view_item' => esc_html__( 'View', 'lsx-health-plan' ), |
|
| 93 | + 'search_items' => esc_html__( 'Search', 'lsx-health-plan' ), |
|
| 94 | + 'not_found' => esc_html__( 'None found', 'lsx-health-plan' ), |
|
| 95 | + 'not_found_in_trash' => esc_html__( 'None found in Trash', 'lsx-health-plan' ), |
|
| 96 | + 'parent_item_colon' => '', |
|
| 97 | + 'menu_name' => esc_html__( 'Recipes', 'lsx-health-plan' ), |
|
| 98 | + ); |
|
| 99 | + $args = array( |
|
| 100 | + 'labels' => $this->labels, |
|
| 101 | + 'public' => true, |
|
| 102 | + 'publicly_queryable' => true, |
|
| 103 | + 'show_ui' => true, |
|
| 104 | + 'show_in_menu' => false, |
|
| 105 | + 'show_in_rest' => true, |
|
| 106 | + 'menu_icon' => 'dashicons-editor-ul', |
|
| 107 | + 'query_var' => true, |
|
| 108 | + 'rewrite' => array( |
|
| 109 | + 'slug' => 'recipe', |
|
| 110 | + ), |
|
| 111 | + 'capability_type' => 'post', |
|
| 112 | + 'has_archive' => 'recipes', |
|
| 113 | + 'hierarchical' => false, |
|
| 114 | + 'menu_position' => null, |
|
| 115 | + 'supports' => array( |
|
| 116 | + 'title', |
|
| 117 | + 'editor', |
|
| 118 | + 'thumbnail', |
|
| 119 | + 'custom-fields', |
|
| 120 | + ), |
|
| 121 | + ); |
|
| 122 | + register_post_type( 'recipe', $args ); |
|
| 123 | + } |
|
| 124 | 124 | |
| 125 | - /** |
|
| 126 | - * Registers the Recipes under the Meals Post type menu. |
|
| 127 | - * |
|
| 128 | - * @return void |
|
| 129 | - */ |
|
| 130 | - public function register_menus() { |
|
| 131 | - add_submenu_page( 'edit.php?post_type=meal', esc_html__( 'Recipes', 'lsx-health-plan' ), esc_html__( 'Recipes', 'lsx-health-plan' ), 'edit_posts', 'edit.php?post_type=recipe' ); |
|
| 132 | - add_submenu_page( 'edit.php?post_type=meal', esc_html__( 'Recipe Types', 'lsx-health-plan' ), esc_html__( 'Recipe Types', 'lsx-health-plan' ), 'edit_posts', 'edit-tags.php?taxonomy=recipe-type&post_type=recipe' ); |
|
| 133 | - add_submenu_page( 'edit.php?post_type=meal', esc_html__( 'Cuisines', 'lsx-health-plan' ), esc_html__( 'Cuisines', 'lsx-health-plan' ), 'edit_posts', 'edit-tags.php?taxonomy=recipe-cuisine&post_type=recipe' ); |
|
| 134 | - } |
|
| 125 | + /** |
|
| 126 | + * Registers the Recipes under the Meals Post type menu. |
|
| 127 | + * |
|
| 128 | + * @return void |
|
| 129 | + */ |
|
| 130 | + public function register_menus() { |
|
| 131 | + add_submenu_page( 'edit.php?post_type=meal', esc_html__( 'Recipes', 'lsx-health-plan' ), esc_html__( 'Recipes', 'lsx-health-plan' ), 'edit_posts', 'edit.php?post_type=recipe' ); |
|
| 132 | + add_submenu_page( 'edit.php?post_type=meal', esc_html__( 'Recipe Types', 'lsx-health-plan' ), esc_html__( 'Recipe Types', 'lsx-health-plan' ), 'edit_posts', 'edit-tags.php?taxonomy=recipe-type&post_type=recipe' ); |
|
| 133 | + add_submenu_page( 'edit.php?post_type=meal', esc_html__( 'Cuisines', 'lsx-health-plan' ), esc_html__( 'Cuisines', 'lsx-health-plan' ), 'edit_posts', 'edit-tags.php?taxonomy=recipe-cuisine&post_type=recipe' ); |
|
| 134 | + } |
|
| 135 | 135 | |
| 136 | - /** |
|
| 137 | - * Register the Cuisine taxonomy. |
|
| 138 | - */ |
|
| 139 | - public function taxonomy_setup() { |
|
| 140 | - $labels = array( |
|
| 141 | - 'name' => esc_html_x( 'Cuisine', 'taxonomy general name', 'lsx-health-plan' ), |
|
| 142 | - 'singular_name' => esc_html_x( 'Cuisines', 'taxonomy singular name', 'lsx-health-plan' ), |
|
| 143 | - 'search_items' => esc_html__( 'Search', 'lsx-health-plan' ), |
|
| 144 | - 'all_items' => esc_html__( 'All', 'lsx-health-plan' ), |
|
| 145 | - 'parent_item' => esc_html__( 'Parent', 'lsx-health-plan' ), |
|
| 146 | - 'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ), |
|
| 147 | - 'edit_item' => esc_html__( 'Edit', 'lsx-health-plan' ), |
|
| 148 | - 'update_item' => esc_html__( 'Update', 'lsx-health-plan' ), |
|
| 149 | - 'add_new_item' => esc_html__( 'Add New', 'lsx-health-plan' ), |
|
| 150 | - 'new_item_name' => esc_html__( 'New Name', 'lsx-health-plan' ), |
|
| 151 | - 'menu_name' => esc_html__( 'Cuisines', 'lsx-health-plan' ), |
|
| 152 | - ); |
|
| 153 | - $args = array( |
|
| 154 | - 'hierarchical' => true, |
|
| 155 | - 'labels' => $labels, |
|
| 156 | - 'show_ui' => true, |
|
| 157 | - 'show_admin_column' => true, |
|
| 158 | - 'show_in_menu' => 'edit.php?post_type=meal', |
|
| 159 | - 'query_var' => true, |
|
| 160 | - 'rewrite' => array( |
|
| 161 | - 'slug' => 'recipe-cuisine', |
|
| 162 | - ), |
|
| 163 | - ); |
|
| 164 | - register_taxonomy( 'recipe-cuisine', array( $this->slug ), $args ); |
|
| 136 | + /** |
|
| 137 | + * Register the Cuisine taxonomy. |
|
| 138 | + */ |
|
| 139 | + public function taxonomy_setup() { |
|
| 140 | + $labels = array( |
|
| 141 | + 'name' => esc_html_x( 'Cuisine', 'taxonomy general name', 'lsx-health-plan' ), |
|
| 142 | + 'singular_name' => esc_html_x( 'Cuisines', 'taxonomy singular name', 'lsx-health-plan' ), |
|
| 143 | + 'search_items' => esc_html__( 'Search', 'lsx-health-plan' ), |
|
| 144 | + 'all_items' => esc_html__( 'All', 'lsx-health-plan' ), |
|
| 145 | + 'parent_item' => esc_html__( 'Parent', 'lsx-health-plan' ), |
|
| 146 | + 'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ), |
|
| 147 | + 'edit_item' => esc_html__( 'Edit', 'lsx-health-plan' ), |
|
| 148 | + 'update_item' => esc_html__( 'Update', 'lsx-health-plan' ), |
|
| 149 | + 'add_new_item' => esc_html__( 'Add New', 'lsx-health-plan' ), |
|
| 150 | + 'new_item_name' => esc_html__( 'New Name', 'lsx-health-plan' ), |
|
| 151 | + 'menu_name' => esc_html__( 'Cuisines', 'lsx-health-plan' ), |
|
| 152 | + ); |
|
| 153 | + $args = array( |
|
| 154 | + 'hierarchical' => true, |
|
| 155 | + 'labels' => $labels, |
|
| 156 | + 'show_ui' => true, |
|
| 157 | + 'show_admin_column' => true, |
|
| 158 | + 'show_in_menu' => 'edit.php?post_type=meal', |
|
| 159 | + 'query_var' => true, |
|
| 160 | + 'rewrite' => array( |
|
| 161 | + 'slug' => 'recipe-cuisine', |
|
| 162 | + ), |
|
| 163 | + ); |
|
| 164 | + register_taxonomy( 'recipe-cuisine', array( $this->slug ), $args ); |
|
| 165 | 165 | |
| 166 | - $labels = array( |
|
| 167 | - 'name' => esc_html_x( 'Recipe Type', 'taxonomy general name', 'lsx-health-plan' ), |
|
| 168 | - 'singular_name' => esc_html_x( 'Recipe Types', 'taxonomy singular name', 'lsx-health-plan' ), |
|
| 169 | - 'search_items' => esc_html__( 'Search', 'lsx-health-plan' ), |
|
| 170 | - 'all_items' => esc_html__( 'All', 'lsx-health-plan' ), |
|
| 171 | - 'parent_item' => esc_html__( 'Parent', 'lsx-health-plan' ), |
|
| 172 | - 'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ), |
|
| 173 | - 'edit_item' => esc_html__( 'Edit', 'lsx-health-plan' ), |
|
| 174 | - 'update_item' => esc_html__( 'Update', 'lsx-health-plan' ), |
|
| 175 | - 'add_new_item' => esc_html__( 'Add New', 'lsx-health-plan' ), |
|
| 176 | - 'new_item_name' => esc_html__( 'New Name', 'lsx-health-plan' ), |
|
| 177 | - 'menu_name' => esc_html__( 'Types', 'lsx-health-plan' ), |
|
| 178 | - ); |
|
| 179 | - $args = array( |
|
| 180 | - 'hierarchical' => true, |
|
| 181 | - 'labels' => $labels, |
|
| 182 | - 'show_ui' => true, |
|
| 183 | - 'show_in_menu' => 'edit.php?post_type=meal', |
|
| 184 | - 'show_admin_column' => true, |
|
| 185 | - 'query_var' => true, |
|
| 186 | - 'rewrite' => array( |
|
| 187 | - 'slug' => 'recipe-type', |
|
| 188 | - ), |
|
| 189 | - ); |
|
| 190 | - register_taxonomy( 'recipe-type', array( $this->slug ), $args ); |
|
| 191 | - } |
|
| 166 | + $labels = array( |
|
| 167 | + 'name' => esc_html_x( 'Recipe Type', 'taxonomy general name', 'lsx-health-plan' ), |
|
| 168 | + 'singular_name' => esc_html_x( 'Recipe Types', 'taxonomy singular name', 'lsx-health-plan' ), |
|
| 169 | + 'search_items' => esc_html__( 'Search', 'lsx-health-plan' ), |
|
| 170 | + 'all_items' => esc_html__( 'All', 'lsx-health-plan' ), |
|
| 171 | + 'parent_item' => esc_html__( 'Parent', 'lsx-health-plan' ), |
|
| 172 | + 'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ), |
|
| 173 | + 'edit_item' => esc_html__( 'Edit', 'lsx-health-plan' ), |
|
| 174 | + 'update_item' => esc_html__( 'Update', 'lsx-health-plan' ), |
|
| 175 | + 'add_new_item' => esc_html__( 'Add New', 'lsx-health-plan' ), |
|
| 176 | + 'new_item_name' => esc_html__( 'New Name', 'lsx-health-plan' ), |
|
| 177 | + 'menu_name' => esc_html__( 'Types', 'lsx-health-plan' ), |
|
| 178 | + ); |
|
| 179 | + $args = array( |
|
| 180 | + 'hierarchical' => true, |
|
| 181 | + 'labels' => $labels, |
|
| 182 | + 'show_ui' => true, |
|
| 183 | + 'show_in_menu' => 'edit.php?post_type=meal', |
|
| 184 | + 'show_admin_column' => true, |
|
| 185 | + 'query_var' => true, |
|
| 186 | + 'rewrite' => array( |
|
| 187 | + 'slug' => 'recipe-type', |
|
| 188 | + ), |
|
| 189 | + ); |
|
| 190 | + register_taxonomy( 'recipe-type', array( $this->slug ), $args ); |
|
| 191 | + } |
|
| 192 | 192 | |
| 193 | - /** |
|
| 194 | - * Adds the post type to the different arrays. |
|
| 195 | - * |
|
| 196 | - * @param array $post_types |
|
| 197 | - * @return array |
|
| 198 | - */ |
|
| 199 | - public function enable_post_type( $post_types = array() ) { |
|
| 200 | - $post_types[] = $this->slug; |
|
| 201 | - return $post_types; |
|
| 202 | - } |
|
| 193 | + /** |
|
| 194 | + * Adds the post type to the different arrays. |
|
| 195 | + * |
|
| 196 | + * @param array $post_types |
|
| 197 | + * @return array |
|
| 198 | + */ |
|
| 199 | + public function enable_post_type( $post_types = array() ) { |
|
| 200 | + $post_types[] = $this->slug; |
|
| 201 | + return $post_types; |
|
| 202 | + } |
|
| 203 | 203 | |
| 204 | - /** |
|
| 205 | - * Enables the Bi Directional relationships |
|
| 206 | - * |
|
| 207 | - * @param array $connections |
|
| 208 | - * @return void |
|
| 209 | - */ |
|
| 210 | - public function enable_connections( $connections = array() ) { |
|
| 211 | - $connections['recipe']['connected_plans'] = 'connected_recipes'; |
|
| 212 | - $connections['plan']['connected_recipes'] = 'connected_plans'; |
|
| 213 | - return $connections; |
|
| 214 | - } |
|
| 204 | + /** |
|
| 205 | + * Enables the Bi Directional relationships |
|
| 206 | + * |
|
| 207 | + * @param array $connections |
|
| 208 | + * @return void |
|
| 209 | + */ |
|
| 210 | + public function enable_connections( $connections = array() ) { |
|
| 211 | + $connections['recipe']['connected_plans'] = 'connected_recipes'; |
|
| 212 | + $connections['plan']['connected_recipes'] = 'connected_plans'; |
|
| 213 | + return $connections; |
|
| 214 | + } |
|
| 215 | 215 | |
| 216 | - /** |
|
| 217 | - * Remove the "Archives:" from the post type recipes. |
|
| 218 | - * |
|
| 219 | - * @param string $title the term title. |
|
| 220 | - * @return string |
|
| 221 | - */ |
|
| 222 | - public function get_the_archive_title( $title ) { |
|
| 223 | - if ( is_post_type_archive( 'recipe' ) ) { |
|
| 224 | - $title = __( 'Recipes', 'lsx-health-plan' ); |
|
| 225 | - } |
|
| 226 | - if ( is_post_type_archive( 'exercise' ) ) { |
|
| 227 | - $title = __( 'Exercises', 'lsx-health-plan' ); |
|
| 228 | - } |
|
| 229 | - if ( is_tax( 'recipe-type' ) ) { |
|
| 230 | - $queried_object = get_queried_object(); |
|
| 231 | - if ( isset( $queried_object->name ) ) { |
|
| 232 | - $title = $queried_object->name . ' ' . __( 'Recipes', 'lsx-health-plan' ); |
|
| 233 | - } |
|
| 234 | - } |
|
| 235 | - return $title; |
|
| 236 | - } |
|
| 216 | + /** |
|
| 217 | + * Remove the "Archives:" from the post type recipes. |
|
| 218 | + * |
|
| 219 | + * @param string $title the term title. |
|
| 220 | + * @return string |
|
| 221 | + */ |
|
| 222 | + public function get_the_archive_title( $title ) { |
|
| 223 | + if ( is_post_type_archive( 'recipe' ) ) { |
|
| 224 | + $title = __( 'Recipes', 'lsx-health-plan' ); |
|
| 225 | + } |
|
| 226 | + if ( is_post_type_archive( 'exercise' ) ) { |
|
| 227 | + $title = __( 'Exercises', 'lsx-health-plan' ); |
|
| 228 | + } |
|
| 229 | + if ( is_tax( 'recipe-type' ) ) { |
|
| 230 | + $queried_object = get_queried_object(); |
|
| 231 | + if ( isset( $queried_object->name ) ) { |
|
| 232 | + $title = $queried_object->name . ' ' . __( 'Recipes', 'lsx-health-plan' ); |
|
| 233 | + } |
|
| 234 | + } |
|
| 235 | + return $title; |
|
| 236 | + } |
|
| 237 | 237 | |
| 238 | - public function remove_archive_original_header() { |
|
| 239 | - if ( is_post_type_archive( 'recipe' ) || is_post_type_archive( 'exercise' ) ) { |
|
| 240 | - remove_action( 'lsx_content_wrap_before', 'lsx_global_header' ); |
|
| 241 | - } |
|
| 242 | - if ( ! is_post_type_archive() ) { |
|
| 243 | - add_action( 'lsx_content_wrap_before', 'lsx_health_plan_recipe_archive_description', 11 ); |
|
| 244 | - } |
|
| 245 | - } |
|
| 238 | + public function remove_archive_original_header() { |
|
| 239 | + if ( is_post_type_archive( 'recipe' ) || is_post_type_archive( 'exercise' ) ) { |
|
| 240 | + remove_action( 'lsx_content_wrap_before', 'lsx_global_header' ); |
|
| 241 | + } |
|
| 242 | + if ( ! is_post_type_archive() ) { |
|
| 243 | + add_action( 'lsx_content_wrap_before', 'lsx_health_plan_recipe_archive_description', 11 ); |
|
| 244 | + } |
|
| 245 | + } |
|
| 246 | 246 | |
| 247 | - public function hp_lsx_archive_header() { |
|
| 248 | - if ( is_post_type_archive( 'recipe' ) || is_post_type_archive( 'exercise' ) ) { |
|
| 249 | - ?> |
|
| 247 | + public function hp_lsx_archive_header() { |
|
| 248 | + if ( is_post_type_archive( 'recipe' ) || is_post_type_archive( 'exercise' ) ) { |
|
| 249 | + ?> |
|
| 250 | 250 | <div class="archive-header-wrapper banner-archive"> |
| 251 | 251 | <?php lsx_global_header_inner_bottom(); ?> |
| 252 | 252 | <header class="archive-header"> |
@@ -259,205 +259,205 @@ discard block |
||
| 259 | 259 | </h1> |
| 260 | 260 | |
| 261 | 261 | <?php |
| 262 | - lsx_health_plan_recipe_archive_description(); |
|
| 263 | - ?> |
|
| 262 | + lsx_health_plan_recipe_archive_description(); |
|
| 263 | + ?> |
|
| 264 | 264 | </header> |
| 265 | 265 | </div> |
| 266 | 266 | <?php |
| 267 | - } |
|
| 268 | - } |
|
| 267 | + } |
|
| 268 | + } |
|
| 269 | 269 | |
| 270 | - /** |
|
| 271 | - * Disables the global header description |
|
| 272 | - * |
|
| 273 | - * @param boolean $disable |
|
| 274 | - * @return boolean |
|
| 275 | - */ |
|
| 276 | - public function disable_global_header_description( $disable ) { |
|
| 277 | - if ( is_tax( 'recipe-type' ) ) { |
|
| 278 | - $disable = true; |
|
| 279 | - } |
|
| 280 | - return $disable; |
|
| 281 | - } |
|
| 270 | + /** |
|
| 271 | + * Disables the global header description |
|
| 272 | + * |
|
| 273 | + * @param boolean $disable |
|
| 274 | + * @return boolean |
|
| 275 | + */ |
|
| 276 | + public function disable_global_header_description( $disable ) { |
|
| 277 | + if ( is_tax( 'recipe-type' ) ) { |
|
| 278 | + $disable = true; |
|
| 279 | + } |
|
| 280 | + return $disable; |
|
| 281 | + } |
|
| 282 | 282 | |
| 283 | - /** |
|
| 284 | - * Holds the array for the breadcrumbs. |
|
| 285 | - * |
|
| 286 | - * @var array $crumbs |
|
| 287 | - * @return array |
|
| 288 | - */ |
|
| 289 | - public function recipes_breadcrumb_filter( $crumbs ) { |
|
| 290 | - $recipe = \lsx_health_plan\functions\get_option( 'endpoint_recipe', 'recipe' ); |
|
| 291 | - $recipes = \lsx_health_plan\functions\get_option( 'endpoint_recipe_archive', 'recipes' ); |
|
| 292 | - $url = get_post_type_archive_link( 'recipe' ); |
|
| 283 | + /** |
|
| 284 | + * Holds the array for the breadcrumbs. |
|
| 285 | + * |
|
| 286 | + * @var array $crumbs |
|
| 287 | + * @return array |
|
| 288 | + */ |
|
| 289 | + public function recipes_breadcrumb_filter( $crumbs ) { |
|
| 290 | + $recipe = \lsx_health_plan\functions\get_option( 'endpoint_recipe', 'recipe' ); |
|
| 291 | + $recipes = \lsx_health_plan\functions\get_option( 'endpoint_recipe_archive', 'recipes' ); |
|
| 292 | + $url = get_post_type_archive_link( 'recipe' ); |
|
| 293 | 293 | |
| 294 | - if ( is_singular( 'recipe' ) ) { |
|
| 295 | - $recipe_name = get_the_title(); |
|
| 296 | - $term_obj_list = get_the_terms( get_the_ID(), 'recipe-type' ); |
|
| 297 | - $recipe_type = $term_obj_list[0]->name; |
|
| 298 | - $recipe_type_url = get_term_link( $term_obj_list[0]->term_id ); |
|
| 294 | + if ( is_singular( 'recipe' ) ) { |
|
| 295 | + $recipe_name = get_the_title(); |
|
| 296 | + $term_obj_list = get_the_terms( get_the_ID(), 'recipe-type' ); |
|
| 297 | + $recipe_type = $term_obj_list[0]->name; |
|
| 298 | + $recipe_type_url = get_term_link( $term_obj_list[0]->term_id ); |
|
| 299 | 299 | |
| 300 | - $crumbs[1] = array( |
|
| 301 | - 0 => $recipes, |
|
| 302 | - 1 => $url, |
|
| 303 | - ); |
|
| 304 | - $crumbs[2] = array( |
|
| 305 | - 0 => $recipe_type, |
|
| 306 | - 1 => $recipe_type_url, |
|
| 307 | - ); |
|
| 308 | - $crumbs[3] = array( |
|
| 309 | - 0 => $recipe_name, |
|
| 310 | - ); |
|
| 311 | - } |
|
| 312 | - if ( is_tax( 'recipe-type' ) || is_tax( 'recipe-cuisine' ) ) { |
|
| 313 | - $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); |
|
| 300 | + $crumbs[1] = array( |
|
| 301 | + 0 => $recipes, |
|
| 302 | + 1 => $url, |
|
| 303 | + ); |
|
| 304 | + $crumbs[2] = array( |
|
| 305 | + 0 => $recipe_type, |
|
| 306 | + 1 => $recipe_type_url, |
|
| 307 | + ); |
|
| 308 | + $crumbs[3] = array( |
|
| 309 | + 0 => $recipe_name, |
|
| 310 | + ); |
|
| 311 | + } |
|
| 312 | + if ( is_tax( 'recipe-type' ) || is_tax( 'recipe-cuisine' ) ) { |
|
| 313 | + $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); |
|
| 314 | 314 | |
| 315 | - $single_term_title = str_replace( '-', ' ', $term->taxonomy ) . ': ' . $term->name; |
|
| 315 | + $single_term_title = str_replace( '-', ' ', $term->taxonomy ) . ': ' . $term->name; |
|
| 316 | 316 | |
| 317 | - $crumbs[1] = array( |
|
| 318 | - 0 => $recipes, |
|
| 319 | - 1 => $url, |
|
| 320 | - ); |
|
| 321 | - $crumbs[2] = array( |
|
| 322 | - 0 => $single_term_title, |
|
| 323 | - ); |
|
| 324 | - } |
|
| 325 | - return $crumbs; |
|
| 326 | - } |
|
| 317 | + $crumbs[1] = array( |
|
| 318 | + 0 => $recipes, |
|
| 319 | + 1 => $url, |
|
| 320 | + ); |
|
| 321 | + $crumbs[2] = array( |
|
| 322 | + 0 => $single_term_title, |
|
| 323 | + ); |
|
| 324 | + } |
|
| 325 | + return $crumbs; |
|
| 326 | + } |
|
| 327 | 327 | |
| 328 | - /** |
|
| 329 | - * Define the metabox and field configurations. |
|
| 330 | - */ |
|
| 331 | - public function featured_metabox() { |
|
| 332 | - $cmb = new_cmb2_box( |
|
| 333 | - array( |
|
| 334 | - 'id' => $this->slug . '_featured_metabox', |
|
| 335 | - 'title' => __( 'Featured', 'lsx-health-plan' ), |
|
| 336 | - 'object_types' => array( $this->slug ), |
|
| 337 | - 'context' => 'side', |
|
| 338 | - 'priority' => 'high', |
|
| 339 | - 'show_names' => true, |
|
| 340 | - ) |
|
| 341 | - ); |
|
| 342 | - $cmb->add_field( |
|
| 343 | - array( |
|
| 344 | - 'name' => __( 'Featured', 'lsx-health-plan' ), |
|
| 345 | - 'desc' => __( 'Enable the checkbox to feature this recipe, featured recipes display in any page that has the recipe shortcode: [lsx_health_plan_featured_recipes_block]', 'lsx-health-plan' ), |
|
| 346 | - 'id' => $this->slug . '_featured', |
|
| 347 | - 'type' => 'checkbox', |
|
| 348 | - 'show_on_cb' => 'cmb2_hide_if_no_cats', |
|
| 349 | - ) |
|
| 350 | - ); |
|
| 351 | - } |
|
| 328 | + /** |
|
| 329 | + * Define the metabox and field configurations. |
|
| 330 | + */ |
|
| 331 | + public function featured_metabox() { |
|
| 332 | + $cmb = new_cmb2_box( |
|
| 333 | + array( |
|
| 334 | + 'id' => $this->slug . '_featured_metabox', |
|
| 335 | + 'title' => __( 'Featured', 'lsx-health-plan' ), |
|
| 336 | + 'object_types' => array( $this->slug ), |
|
| 337 | + 'context' => 'side', |
|
| 338 | + 'priority' => 'high', |
|
| 339 | + 'show_names' => true, |
|
| 340 | + ) |
|
| 341 | + ); |
|
| 342 | + $cmb->add_field( |
|
| 343 | + array( |
|
| 344 | + 'name' => __( 'Featured', 'lsx-health-plan' ), |
|
| 345 | + 'desc' => __( 'Enable the checkbox to feature this recipe, featured recipes display in any page that has the recipe shortcode: [lsx_health_plan_featured_recipes_block]', 'lsx-health-plan' ), |
|
| 346 | + 'id' => $this->slug . '_featured', |
|
| 347 | + 'type' => 'checkbox', |
|
| 348 | + 'show_on_cb' => 'cmb2_hide_if_no_cats', |
|
| 349 | + ) |
|
| 350 | + ); |
|
| 351 | + } |
|
| 352 | 352 | |
| 353 | - /** |
|
| 354 | - * Define the metabox and field configurations. |
|
| 355 | - */ |
|
| 356 | - public function details_metaboxes() { |
|
| 357 | - $cmb = new_cmb2_box( |
|
| 358 | - array( |
|
| 359 | - 'id' => $this->slug . '_details_metabox', |
|
| 360 | - 'title' => __( 'Cooking Info', 'lsx-health-plan' ), |
|
| 361 | - 'object_types' => array( $this->slug ), // Post type |
|
| 362 | - 'context' => 'normal', |
|
| 363 | - 'priority' => 'high', |
|
| 364 | - 'show_names' => true, |
|
| 365 | - ) |
|
| 366 | - ); |
|
| 367 | - $cmb->add_field( |
|
| 368 | - array( |
|
| 369 | - 'name' => __( 'Prep Time', 'lsx-health-plan' ), |
|
| 370 | - 'id' => $this->slug . '_prep_time', |
|
| 371 | - 'desc' => __( 'Add the preparation time for the entire meal i.e: 25 mins', 'lsx-health-plan' ), |
|
| 372 | - 'type' => 'text', |
|
| 373 | - 'show_on_cb' => 'cmb2_hide_if_no_cats', |
|
| 374 | - ) |
|
| 375 | - ); |
|
| 376 | - $cmb->add_field( |
|
| 377 | - array( |
|
| 378 | - 'name' => __( 'Cooking Time', 'lsx-health-plan' ), |
|
| 379 | - 'id' => $this->slug . '_cooking_time', |
|
| 380 | - 'desc' => __( 'Add the cooking time i.e: 15 mins', 'lsx-health-plan' ), |
|
| 381 | - 'type' => 'text', |
|
| 382 | - 'show_on_cb' => 'cmb2_hide_if_no_cats', |
|
| 383 | - ) |
|
| 384 | - ); |
|
| 385 | - $cmb->add_field( |
|
| 386 | - array( |
|
| 387 | - 'name' => __( 'Serves', 'lsx-health-plan' ), |
|
| 388 | - 'id' => $this->slug . '_serves', |
|
| 389 | - 'desc' => __( 'Add the recommended serving size i.e: 6', 'lsx-health-plan' ), |
|
| 390 | - 'type' => 'text', |
|
| 391 | - 'show_on_cb' => 'cmb2_hide_if_no_cats', |
|
| 392 | - 'attributes' => array( |
|
| 393 | - 'type' => 'number', |
|
| 394 | - 'pattern' => '\d*', |
|
| 395 | - ), |
|
| 396 | - ) |
|
| 397 | - ); |
|
| 398 | - $cmb->add_field( |
|
| 399 | - array( |
|
| 400 | - 'name' => __( 'Portion', 'lsx-health-plan' ), |
|
| 401 | - 'desc' => __( 'Add the recommended portion size i.e: 200mg', 'lsx-health-plan' ), |
|
| 402 | - 'id' => $this->slug . '_portion', |
|
| 403 | - 'type' => 'text', |
|
| 404 | - 'show_on_cb' => 'cmb2_hide_if_no_cats', |
|
| 405 | - ) |
|
| 406 | - ); |
|
| 407 | - $cmb = new_cmb2_box( |
|
| 408 | - array( |
|
| 409 | - 'id' => $this->slug . '_nutritional_metabox', |
|
| 410 | - 'title' => __( 'Nutritional Info', 'lsx-health-plan' ), |
|
| 411 | - 'object_types' => array( $this->slug ), // Post type |
|
| 412 | - 'context' => 'normal', |
|
| 413 | - 'priority' => 'high', |
|
| 414 | - 'show_names' => true, |
|
| 415 | - ) |
|
| 416 | - ); |
|
| 417 | - $cmb->add_field( |
|
| 418 | - array( |
|
| 419 | - 'name' => __( 'Energy', 'lsx-health-plan' ), |
|
| 420 | - 'id' => $this->slug . '_energy', |
|
| 421 | - 'desc' => __( 'Add the energy amount for the entire meal i.e: 700 kj', 'lsx-health-plan' ), |
|
| 422 | - 'type' => 'text', |
|
| 423 | - 'show_on_cb' => 'cmb2_hide_if_no_cats', |
|
| 424 | - ) |
|
| 425 | - ); |
|
| 426 | - $cmb->add_field( |
|
| 427 | - array( |
|
| 428 | - 'name' => __( 'Protein', 'lsx-health-plan' ), |
|
| 429 | - 'id' => $this->slug . '_protein', |
|
| 430 | - 'desc' => __( 'Add the protein amount for the entire meal i.e: 50 g', 'lsx-health-plan' ), |
|
| 431 | - 'type' => 'text', |
|
| 432 | - 'show_on_cb' => 'cmb2_hide_if_no_cats', |
|
| 433 | - ) |
|
| 434 | - ); |
|
| 435 | - $cmb->add_field( |
|
| 436 | - array( |
|
| 437 | - 'name' => __( 'Carbohydrates', 'lsx-health-plan' ), |
|
| 438 | - 'id' => $this->slug . '_carbohydrates', |
|
| 439 | - 'desc' => __( 'Add the carbohydrates amount for the entire meal i.e: 5 g', 'lsx-health-plan' ), |
|
| 440 | - 'type' => 'text', |
|
| 441 | - 'show_on_cb' => 'cmb2_hide_if_no_cats', |
|
| 442 | - ) |
|
| 443 | - ); |
|
| 444 | - $cmb->add_field( |
|
| 445 | - array( |
|
| 446 | - 'name' => __( 'Fibre', 'lsx-health-plan' ), |
|
| 447 | - 'id' => $this->slug . '_fibre', |
|
| 448 | - 'desc' => __( 'Add the fibre amount for the entire meal i.e: 5 g', 'lsx-health-plan' ), |
|
| 449 | - 'type' => 'text', |
|
| 450 | - 'show_on_cb' => 'cmb2_hide_if_no_cats', |
|
| 451 | - ) |
|
| 452 | - ); |
|
| 453 | - $cmb->add_field( |
|
| 454 | - array( |
|
| 455 | - 'name' => __( 'Fat', 'lsx-health-plan' ), |
|
| 456 | - 'id' => $this->slug . '_fat', |
|
| 457 | - 'desc' => __( 'Add the fat amount for the entire meal i.e: 20 g', 'lsx-health-plan' ), |
|
| 458 | - 'type' => 'text', |
|
| 459 | - 'show_on_cb' => 'cmb2_hide_if_no_cats', |
|
| 460 | - ) |
|
| 461 | - ); |
|
| 462 | - } |
|
| 353 | + /** |
|
| 354 | + * Define the metabox and field configurations. |
|
| 355 | + */ |
|
| 356 | + public function details_metaboxes() { |
|
| 357 | + $cmb = new_cmb2_box( |
|
| 358 | + array( |
|
| 359 | + 'id' => $this->slug . '_details_metabox', |
|
| 360 | + 'title' => __( 'Cooking Info', 'lsx-health-plan' ), |
|
| 361 | + 'object_types' => array( $this->slug ), // Post type |
|
| 362 | + 'context' => 'normal', |
|
| 363 | + 'priority' => 'high', |
|
| 364 | + 'show_names' => true, |
|
| 365 | + ) |
|
| 366 | + ); |
|
| 367 | + $cmb->add_field( |
|
| 368 | + array( |
|
| 369 | + 'name' => __( 'Prep Time', 'lsx-health-plan' ), |
|
| 370 | + 'id' => $this->slug . '_prep_time', |
|
| 371 | + 'desc' => __( 'Add the preparation time for the entire meal i.e: 25 mins', 'lsx-health-plan' ), |
|
| 372 | + 'type' => 'text', |
|
| 373 | + 'show_on_cb' => 'cmb2_hide_if_no_cats', |
|
| 374 | + ) |
|
| 375 | + ); |
|
| 376 | + $cmb->add_field( |
|
| 377 | + array( |
|
| 378 | + 'name' => __( 'Cooking Time', 'lsx-health-plan' ), |
|
| 379 | + 'id' => $this->slug . '_cooking_time', |
|
| 380 | + 'desc' => __( 'Add the cooking time i.e: 15 mins', 'lsx-health-plan' ), |
|
| 381 | + 'type' => 'text', |
|
| 382 | + 'show_on_cb' => 'cmb2_hide_if_no_cats', |
|
| 383 | + ) |
|
| 384 | + ); |
|
| 385 | + $cmb->add_field( |
|
| 386 | + array( |
|
| 387 | + 'name' => __( 'Serves', 'lsx-health-plan' ), |
|
| 388 | + 'id' => $this->slug . '_serves', |
|
| 389 | + 'desc' => __( 'Add the recommended serving size i.e: 6', 'lsx-health-plan' ), |
|
| 390 | + 'type' => 'text', |
|
| 391 | + 'show_on_cb' => 'cmb2_hide_if_no_cats', |
|
| 392 | + 'attributes' => array( |
|
| 393 | + 'type' => 'number', |
|
| 394 | + 'pattern' => '\d*', |
|
| 395 | + ), |
|
| 396 | + ) |
|
| 397 | + ); |
|
| 398 | + $cmb->add_field( |
|
| 399 | + array( |
|
| 400 | + 'name' => __( 'Portion', 'lsx-health-plan' ), |
|
| 401 | + 'desc' => __( 'Add the recommended portion size i.e: 200mg', 'lsx-health-plan' ), |
|
| 402 | + 'id' => $this->slug . '_portion', |
|
| 403 | + 'type' => 'text', |
|
| 404 | + 'show_on_cb' => 'cmb2_hide_if_no_cats', |
|
| 405 | + ) |
|
| 406 | + ); |
|
| 407 | + $cmb = new_cmb2_box( |
|
| 408 | + array( |
|
| 409 | + 'id' => $this->slug . '_nutritional_metabox', |
|
| 410 | + 'title' => __( 'Nutritional Info', 'lsx-health-plan' ), |
|
| 411 | + 'object_types' => array( $this->slug ), // Post type |
|
| 412 | + 'context' => 'normal', |
|
| 413 | + 'priority' => 'high', |
|
| 414 | + 'show_names' => true, |
|
| 415 | + ) |
|
| 416 | + ); |
|
| 417 | + $cmb->add_field( |
|
| 418 | + array( |
|
| 419 | + 'name' => __( 'Energy', 'lsx-health-plan' ), |
|
| 420 | + 'id' => $this->slug . '_energy', |
|
| 421 | + 'desc' => __( 'Add the energy amount for the entire meal i.e: 700 kj', 'lsx-health-plan' ), |
|
| 422 | + 'type' => 'text', |
|
| 423 | + 'show_on_cb' => 'cmb2_hide_if_no_cats', |
|
| 424 | + ) |
|
| 425 | + ); |
|
| 426 | + $cmb->add_field( |
|
| 427 | + array( |
|
| 428 | + 'name' => __( 'Protein', 'lsx-health-plan' ), |
|
| 429 | + 'id' => $this->slug . '_protein', |
|
| 430 | + 'desc' => __( 'Add the protein amount for the entire meal i.e: 50 g', 'lsx-health-plan' ), |
|
| 431 | + 'type' => 'text', |
|
| 432 | + 'show_on_cb' => 'cmb2_hide_if_no_cats', |
|
| 433 | + ) |
|
| 434 | + ); |
|
| 435 | + $cmb->add_field( |
|
| 436 | + array( |
|
| 437 | + 'name' => __( 'Carbohydrates', 'lsx-health-plan' ), |
|
| 438 | + 'id' => $this->slug . '_carbohydrates', |
|
| 439 | + 'desc' => __( 'Add the carbohydrates amount for the entire meal i.e: 5 g', 'lsx-health-plan' ), |
|
| 440 | + 'type' => 'text', |
|
| 441 | + 'show_on_cb' => 'cmb2_hide_if_no_cats', |
|
| 442 | + ) |
|
| 443 | + ); |
|
| 444 | + $cmb->add_field( |
|
| 445 | + array( |
|
| 446 | + 'name' => __( 'Fibre', 'lsx-health-plan' ), |
|
| 447 | + 'id' => $this->slug . '_fibre', |
|
| 448 | + 'desc' => __( 'Add the fibre amount for the entire meal i.e: 5 g', 'lsx-health-plan' ), |
|
| 449 | + 'type' => 'text', |
|
| 450 | + 'show_on_cb' => 'cmb2_hide_if_no_cats', |
|
| 451 | + ) |
|
| 452 | + ); |
|
| 453 | + $cmb->add_field( |
|
| 454 | + array( |
|
| 455 | + 'name' => __( 'Fat', 'lsx-health-plan' ), |
|
| 456 | + 'id' => $this->slug . '_fat', |
|
| 457 | + 'desc' => __( 'Add the fat amount for the entire meal i.e: 20 g', 'lsx-health-plan' ), |
|
| 458 | + 'type' => 'text', |
|
| 459 | + 'show_on_cb' => 'cmb2_hide_if_no_cats', |
|
| 460 | + ) |
|
| 461 | + ); |
|
| 462 | + } |
|
| 463 | 463 | } |
@@ -26,13 +26,13 @@ discard block |
||
| 26 | 26 | <div class="entry-content"> |
| 27 | 27 | <div class="single-plan-inner meal-content"> |
| 28 | 28 | <?php |
| 29 | - if ( is_singular( 'meal' ) ) { ?> |
|
| 29 | + if ( is_singular( 'meal' ) ) { ?> |
|
| 30 | 30 | <div class="single-plan-section-title meal-plan title-lined"> |
| 31 | 31 | <?php lsx_get_svg_icon( 'meal.svg' ); ?> |
| 32 | 32 | <h2><?php the_title(); ?></h2> |
| 33 | 33 | <?php if ( class_exists( 'LSX_Sharing' ) ) { |
| 34 | - lsx_content_sharing(); |
|
| 35 | - } ?> |
|
| 34 | + lsx_content_sharing(); |
|
| 35 | + } ?> |
|
| 36 | 36 | </div> |
| 37 | 37 | <?php } else { ?> |
| 38 | 38 | <div class="single-plan-section-title meal-plan title-lined"> |
@@ -55,18 +55,18 @@ discard block |
||
| 55 | 55 | <?php } ?> |
| 56 | 56 | |
| 57 | 57 | <?php |
| 58 | - // Shoping list |
|
| 59 | - $shopping_list = get_post_meta( get_the_ID(), 'meal_shopping_list', true ); |
|
| 60 | - if ( ! empty( $shopping_list ) ) { |
|
| 61 | - ?> |
|
| 58 | + // Shoping list |
|
| 59 | + $shopping_list = get_post_meta( get_the_ID(), 'meal_shopping_list', true ); |
|
| 60 | + if ( ! empty( $shopping_list ) ) { |
|
| 61 | + ?> |
|
| 62 | 62 | <a class="btn border-btn btn-shopping" href="<?php echo esc_url( get_page_link( $shopping_list ) ); ?>" target="_blank"><?php esc_html_e( 'Download Shopping List', 'lsx-health-plan' ); ?><i class="fa fa-download" aria-hidden="true"></i></a> |
| 63 | 63 | <?php |
| 64 | - } |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - ?> |
|
| 66 | + ?> |
|
| 67 | 67 | </div> |
| 68 | 68 | |
| 69 | 69 | <?php |
| 70 | 70 | if ( ! empty( $connected_articles ) ) { |
| 71 | - lsx_hp_single_related( $connected_articles, __( 'Related articles', 'lsx-health-plan' ) ); |
|
| 71 | + lsx_hp_single_related( $connected_articles, __( 'Related articles', 'lsx-health-plan' ) ); |
|
| 72 | 72 | } |
@@ -7,11 +7,11 @@ discard block |
||
| 7 | 7 | |
| 8 | 8 | // Getting translated endpoint. |
| 9 | 9 | |
| 10 | -$archive_meals = \lsx_health_plan\functions\get_option( 'endpoint_meal_archive', 'meals' ); |
|
| 11 | -$meal = \lsx_health_plan\functions\get_option( 'endpoint_meal', 'meal' ); |
|
| 10 | +$archive_meals = \lsx_health_plan\functions\get_option('endpoint_meal_archive', 'meals'); |
|
| 11 | +$meal = \lsx_health_plan\functions\get_option('endpoint_meal', 'meal'); |
|
| 12 | 12 | |
| 13 | -$connected_members = get_post_meta( get_the_ID(), ( $meal . '_connected_team_member' ), true ); |
|
| 14 | -$connected_articles = get_post_meta( get_the_ID(), ( $meal . '_connected_articles' ), true ); |
|
| 13 | +$connected_members = get_post_meta(get_the_ID(), ($meal . '_connected_team_member'), true); |
|
| 14 | +$connected_articles = get_post_meta(get_the_ID(), ($meal . '_connected_articles'), true); |
|
| 15 | 15 | |
| 16 | 16 | ?> |
| 17 | 17 | |
@@ -26,18 +26,18 @@ discard block |
||
| 26 | 26 | <div class="entry-content"> |
| 27 | 27 | <div class="single-plan-inner meal-content"> |
| 28 | 28 | <?php |
| 29 | - if ( is_singular( 'meal' ) ) { ?> |
|
| 29 | + if (is_singular('meal')) { ?> |
|
| 30 | 30 | <div class="single-plan-section-title meal-plan title-lined"> |
| 31 | - <?php lsx_get_svg_icon( 'meal.svg' ); ?> |
|
| 31 | + <?php lsx_get_svg_icon('meal.svg'); ?> |
|
| 32 | 32 | <h2><?php the_title(); ?></h2> |
| 33 | - <?php if ( class_exists( 'LSX_Sharing' ) ) { |
|
| 33 | + <?php if (class_exists('LSX_Sharing')) { |
|
| 34 | 34 | lsx_content_sharing(); |
| 35 | 35 | } ?> |
| 36 | 36 | </div> |
| 37 | 37 | <?php } else { ?> |
| 38 | 38 | <div class="single-plan-section-title meal-plan title-lined"> |
| 39 | - <?php lsx_get_svg_icon( 'meal.svg' ); ?> |
|
| 40 | - <h2><?php esc_html_e( 'My Meal Plan', 'lsx-health-plan' ); ?> <?php the_title(); ?></h2> |
|
| 39 | + <?php lsx_get_svg_icon('meal.svg'); ?> |
|
| 40 | + <h2><?php esc_html_e('My Meal Plan', 'lsx-health-plan'); ?> <?php the_title(); ?></h2> |
|
| 41 | 41 | </div> |
| 42 | 42 | <?php } ?> |
| 43 | 43 | |
@@ -50,16 +50,16 @@ discard block |
||
| 50 | 50 | </article><!-- #post-## --> |
| 51 | 51 | |
| 52 | 52 | <div class="back-plan-btn"> |
| 53 | - <?php if ( is_single() && is_singular( 'meal' ) ) { ?> |
|
| 54 | - <a class="btn border-btn" href="/<?php echo $archive_meals; ?>"><?php esc_html_e( 'Back to meals', 'lsx-health-plan' ); ?></a> |
|
| 53 | + <?php if (is_single() && is_singular('meal')) { ?> |
|
| 54 | + <a class="btn border-btn" href="/<?php echo $archive_meals; ?>"><?php esc_html_e('Back to meals', 'lsx-health-plan'); ?></a> |
|
| 55 | 55 | <?php } ?> |
| 56 | 56 | |
| 57 | 57 | <?php |
| 58 | 58 | // Shoping list |
| 59 | - $shopping_list = get_post_meta( get_the_ID(), 'meal_shopping_list', true ); |
|
| 60 | - if ( ! empty( $shopping_list ) ) { |
|
| 59 | + $shopping_list = get_post_meta(get_the_ID(), 'meal_shopping_list', true); |
|
| 60 | + if ( ! empty($shopping_list)) { |
|
| 61 | 61 | ?> |
| 62 | - <a class="btn border-btn btn-shopping" href="<?php echo esc_url( get_page_link( $shopping_list ) ); ?>" target="_blank"><?php esc_html_e( 'Download Shopping List', 'lsx-health-plan' ); ?><i class="fa fa-download" aria-hidden="true"></i></a> |
|
| 62 | + <a class="btn border-btn btn-shopping" href="<?php echo esc_url(get_page_link($shopping_list)); ?>" target="_blank"><?php esc_html_e('Download Shopping List', 'lsx-health-plan'); ?><i class="fa fa-download" aria-hidden="true"></i></a> |
|
| 63 | 63 | <?php |
| 64 | 64 | } |
| 65 | 65 | |
@@ -67,6 +67,6 @@ discard block |
||
| 67 | 67 | </div> |
| 68 | 68 | |
| 69 | 69 | <?php |
| 70 | -if ( ! empty( $connected_articles ) ) { |
|
| 71 | - lsx_hp_single_related( $connected_articles, __( 'Related articles', 'lsx-health-plan' ) ); |
|
| 70 | +if ( ! empty($connected_articles)) { |
|
| 71 | + lsx_hp_single_related($connected_articles, __('Related articles', 'lsx-health-plan')); |
|
| 72 | 72 | } |
@@ -11,8 +11,8 @@ discard block |
||
| 11 | 11 | |
| 12 | 12 | <?php |
| 13 | 13 | $args = array( |
| 14 | - 'post_parent' => get_the_ID(), |
|
| 15 | - 'post_type' => 'plan', |
|
| 14 | + 'post_parent' => get_the_ID(), |
|
| 15 | + 'post_type' => 'plan', |
|
| 16 | 16 | ); |
| 17 | 17 | |
| 18 | 18 | $plan_id = get_the_ID(); |
@@ -28,18 +28,18 @@ discard block |
||
| 28 | 28 | $small_description = get_post_meta( get_the_ID(), ( $plan . '_short_description' ), true ); |
| 29 | 29 | |
| 30 | 30 | if ( ! empty( $has_sections ) && empty( $is_section ) ) { |
| 31 | - $plan_type_class = 'parent-plan'; |
|
| 31 | + $plan_type_class = 'parent-plan'; |
|
| 32 | 32 | } |
| 33 | 33 | if ( ! empty( $has_sections ) && ! empty( $is_section ) ) { |
| 34 | - $plan_type_class = 'child-plan'; |
|
| 34 | + $plan_type_class = 'child-plan'; |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | // Get the plan restrictions. |
| 38 | 38 | if ( function_exists( 'wc_memberships_is_post_content_restricted' ) && wc_memberships_is_post_content_restricted( get_the_ID() ) ) { |
| 39 | - $restricted = ! current_user_can( 'wc_memberships_view_restricted_post_content', get_the_ID() ); |
|
| 39 | + $restricted = ! current_user_can( 'wc_memberships_view_restricted_post_content', get_the_ID() ); |
|
| 40 | 40 | } |
| 41 | 41 | if ( false === $restricted ) { |
| 42 | - $round_progress = round( \lsx_health_plan\functions\get_progress( get_the_ID() ), 0 ); |
|
| 42 | + $round_progress = round( \lsx_health_plan\functions\get_progress( get_the_ID() ), 0 ); |
|
| 43 | 43 | } |
| 44 | 44 | ?> |
| 45 | 45 | |
@@ -59,9 +59,9 @@ discard block |
||
| 59 | 59 | <?php } ?> |
| 60 | 60 | |
| 61 | 61 | <?php |
| 62 | - if ( ! empty( $has_sections ) ) { |
|
| 63 | - if ( false === $is_section ) { |
|
| 64 | - ?> |
|
| 62 | + if ( ! empty( $has_sections ) ) { |
|
| 63 | + if ( false === $is_section ) { |
|
| 64 | + ?> |
|
| 65 | 65 | <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> |
| 66 | 66 | <div class="entry-content"> |
| 67 | 67 | <div class="single-plan-inner main-plan-content"> |
@@ -69,47 +69,47 @@ discard block |
||
| 69 | 69 | <?php lsx_get_svg_icon( 'my-plan.svg' ); ?> |
| 70 | 70 | <h2><?php echo esc_html_e( 'Your Plan', 'lsx-health-plan' ); ?></h2> |
| 71 | 71 | <?php if ( class_exists( 'LSX_Sharing' ) ) { |
| 72 | - lsx_content_sharing(); |
|
| 73 | - } ?> |
|
| 72 | + lsx_content_sharing(); |
|
| 73 | + } ?> |
|
| 74 | 74 | </div> |
| 75 | 75 | <div class="plan"> |
| 76 | 76 | <div class="set-box set content-box entry-content"> |
| 77 | 77 | <div class="plan-top-content"> |
| 78 | 78 | <?php |
| 79 | - if ( $connected_members ) { |
|
| 80 | - echo wp_kses_post( lsx_hp_member_connected( $connected_members, $plan ) ); |
|
| 81 | - } |
|
| 82 | - if ( false === $restricted ) { |
|
| 83 | - echo wp_kses_post( '<span class="progress"><progress class="bar" value="' . $round_progress . '" max="100"> ' . $round_progress . '% </progress><span>' . $round_progress . '%</span></span>' ); |
|
| 84 | - } |
|
| 85 | - if ( $small_description ) { |
|
| 86 | - ?> |
|
| 79 | + if ( $connected_members ) { |
|
| 80 | + echo wp_kses_post( lsx_hp_member_connected( $connected_members, $plan ) ); |
|
| 81 | + } |
|
| 82 | + if ( false === $restricted ) { |
|
| 83 | + echo wp_kses_post( '<span class="progress"><progress class="bar" value="' . $round_progress . '" max="100"> ' . $round_progress . '% </progress><span>' . $round_progress . '%</span></span>' ); |
|
| 84 | + } |
|
| 85 | + if ( $small_description ) { |
|
| 86 | + ?> |
|
| 87 | 87 | <div class="the-content"> |
| 88 | 88 | <span><?php echo esc_html( $small_description ); ?></span> |
| 89 | 89 | </div> |
| 90 | 90 | <?php |
| 91 | 91 | |
| 92 | - } |
|
| 93 | - ?> |
|
| 92 | + } |
|
| 93 | + ?> |
|
| 94 | 94 | </div> |
| 95 | 95 | <?php |
| 96 | - if ( lsx_health_plan_has_tips() ) { |
|
| 97 | - echo wp_kses_post( do_shortcode( '[lsx_health_plan_featured_tips_block]' ) ); |
|
| 98 | - } ?> |
|
| 96 | + if ( lsx_health_plan_has_tips() ) { |
|
| 97 | + echo wp_kses_post( do_shortcode( '[lsx_health_plan_featured_tips_block]' ) ); |
|
| 98 | + } ?> |
|
| 99 | 99 | </div> |
| 100 | 100 | <div class="the-plan-content"> |
| 101 | 101 | <?php |
| 102 | - echo do_shortcode( '[lsx_health_plan_day_plan_block week_view="true" show_downloads="true" plan="' . get_the_ID() . '"]' ); |
|
| 102 | + echo do_shortcode( '[lsx_health_plan_day_plan_block week_view="true" show_downloads="true" plan="' . get_the_ID() . '"]' ); |
|
| 103 | 103 | |
| 104 | - ?> |
|
| 104 | + ?> |
|
| 105 | 105 | <div class="row status-plan-buttons main-plan-btn"> |
| 106 | 106 | <?php |
| 107 | - if ( function_exists( 'wc_get_page_id' ) ) { |
|
| 108 | - ?> |
|
| 107 | + if ( function_exists( 'wc_get_page_id' ) ) { |
|
| 108 | + ?> |
|
| 109 | 109 | <a class="btn border-btn" href="<?php echo wp_kses_post( get_permalink( wc_get_page_id( 'myaccount' ) ) ); ?>"><?php esc_html_e( 'My Plans', 'lsx-health-plan' ); ?></a> |
| 110 | 110 | <?php |
| 111 | - } |
|
| 112 | - ?> |
|
| 111 | + } |
|
| 112 | + ?> |
|
| 113 | 113 | </div> |
| 114 | 114 | </div> |
| 115 | 115 | </div> |
@@ -118,32 +118,32 @@ discard block |
||
| 118 | 118 | </div><!-- .entry-content --> |
| 119 | 119 | </article> |
| 120 | 120 | <?php |
| 121 | - } else { |
|
| 122 | - lsx_health_plan_single_nav(); |
|
| 123 | - lsx_health_plan_single_tabs(); |
|
| 124 | - } |
|
| 125 | - } |
|
| 126 | - ?> |
|
| 121 | + } else { |
|
| 122 | + lsx_health_plan_single_nav(); |
|
| 123 | + lsx_health_plan_single_tabs(); |
|
| 124 | + } |
|
| 125 | + } |
|
| 126 | + ?> |
|
| 127 | 127 | </div> |
| 128 | 128 | |
| 129 | 129 | <?php |
| 130 | - // Show the buttons on the single plan tabs. |
|
| 131 | - if ( ! empty( $has_sections ) && false !== $is_section ) { |
|
| 132 | - ?> |
|
| 130 | + // Show the buttons on the single plan tabs. |
|
| 131 | + if ( ! empty( $has_sections ) && false !== $is_section ) { |
|
| 132 | + ?> |
|
| 133 | 133 | <div class="row status-plan-buttons"> |
| 134 | 134 | <?php lsx_health_plan_day_button(); ?> |
| 135 | 135 | </div> |
| 136 | 136 | <?php |
| 137 | - } |
|
| 138 | - ?> |
|
| 137 | + } |
|
| 138 | + ?> |
|
| 139 | 139 | |
| 140 | 140 | <?php lsx_content_bottom(); ?> |
| 141 | 141 | |
| 142 | 142 | <?php |
| 143 | - if ( ! empty( $connected_articles ) ) { |
|
| 144 | - lsx_hp_single_related( $connected_articles, __( 'Latest articles', 'lsx-health-plan' ) ); |
|
| 145 | - } |
|
| 146 | - ?> |
|
| 143 | + if ( ! empty( $connected_articles ) ) { |
|
| 144 | + lsx_hp_single_related( $connected_articles, __( 'Latest articles', 'lsx-health-plan' ) ); |
|
| 145 | + } |
|
| 146 | + ?> |
|
| 147 | 147 | |
| 148 | 148 | |
| 149 | 149 | </main><!-- #main --> |
@@ -16,59 +16,59 @@ discard block |
||
| 16 | 16 | ); |
| 17 | 17 | |
| 18 | 18 | $plan_id = get_the_ID(); |
| 19 | -$has_sections = \lsx_health_plan\functions\plan\has_sections( $plan_id ); |
|
| 19 | +$has_sections = \lsx_health_plan\functions\plan\has_sections($plan_id); |
|
| 20 | 20 | $restricted = false; |
| 21 | -$is_section = get_query_var( 'section', false ); |
|
| 21 | +$is_section = get_query_var('section', false); |
|
| 22 | 22 | |
| 23 | 23 | // Getting translated endpoint. |
| 24 | -$plan = \lsx_health_plan\functions\get_option( 'endpoint_plan', 'plan' ); |
|
| 24 | +$plan = \lsx_health_plan\functions\get_option('endpoint_plan', 'plan'); |
|
| 25 | 25 | |
| 26 | -$connected_members = get_post_meta( get_the_ID(), ( $plan . '_connected_team_member' ), true ); |
|
| 27 | -$connected_articles = get_post_meta( get_the_ID(), ( $plan . '_connected_articles' ), true ); |
|
| 28 | -$small_description = get_post_meta( get_the_ID(), ( $plan . '_short_description' ), true ); |
|
| 26 | +$connected_members = get_post_meta(get_the_ID(), ($plan . '_connected_team_member'), true); |
|
| 27 | +$connected_articles = get_post_meta(get_the_ID(), ($plan . '_connected_articles'), true); |
|
| 28 | +$small_description = get_post_meta(get_the_ID(), ($plan . '_short_description'), true); |
|
| 29 | 29 | |
| 30 | -if ( ! empty( $has_sections ) && empty( $is_section ) ) { |
|
| 30 | +if ( ! empty($has_sections) && empty($is_section)) { |
|
| 31 | 31 | $plan_type_class = 'parent-plan'; |
| 32 | 32 | } |
| 33 | -if ( ! empty( $has_sections ) && ! empty( $is_section ) ) { |
|
| 33 | +if ( ! empty($has_sections) && ! empty($is_section)) { |
|
| 34 | 34 | $plan_type_class = 'child-plan'; |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | // Get the plan restrictions. |
| 38 | -if ( function_exists( 'wc_memberships_is_post_content_restricted' ) && wc_memberships_is_post_content_restricted( get_the_ID() ) ) { |
|
| 39 | - $restricted = ! current_user_can( 'wc_memberships_view_restricted_post_content', get_the_ID() ); |
|
| 38 | +if (function_exists('wc_memberships_is_post_content_restricted') && wc_memberships_is_post_content_restricted(get_the_ID())) { |
|
| 39 | + $restricted = ! current_user_can('wc_memberships_view_restricted_post_content', get_the_ID()); |
|
| 40 | 40 | } |
| 41 | -if ( false === $restricted ) { |
|
| 42 | - $round_progress = round( \lsx_health_plan\functions\get_progress( get_the_ID() ), 0 ); |
|
| 41 | +if (false === $restricted) { |
|
| 42 | + $round_progress = round(\lsx_health_plan\functions\get_progress(get_the_ID()), 0); |
|
| 43 | 43 | } |
| 44 | 44 | ?> |
| 45 | 45 | |
| 46 | -<div id="primary" class="content-area <?php echo esc_attr( lsx_main_class() ); ?>"> |
|
| 46 | +<div id="primary" class="content-area <?php echo esc_attr(lsx_main_class()); ?>"> |
|
| 47 | 47 | |
| 48 | 48 | <?php lsx_content_before(); ?> |
| 49 | 49 | |
| 50 | - <main id="main" class="site-main <?php echo esc_html( $plan_type_class ); ?>" role="main"> |
|
| 50 | + <main id="main" class="site-main <?php echo esc_html($plan_type_class); ?>" role="main"> |
|
| 51 | 51 | |
| 52 | 52 | <?php lsx_content_top(); ?> |
| 53 | 53 | |
| 54 | 54 | <div class="post-wrapper"> |
| 55 | - <?php if ( ! empty( $has_sections ) && empty( $is_section ) ) { ?> |
|
| 55 | + <?php if ( ! empty($has_sections) && empty($is_section)) { ?> |
|
| 56 | 56 | <div class="plan-content"> |
| 57 | 57 | <?php the_content(); ?> |
| 58 | 58 | </div> |
| 59 | 59 | <?php } ?> |
| 60 | 60 | |
| 61 | 61 | <?php |
| 62 | - if ( ! empty( $has_sections ) ) { |
|
| 63 | - if ( false === $is_section ) { |
|
| 62 | + if ( ! empty($has_sections)) { |
|
| 63 | + if (false === $is_section) { |
|
| 64 | 64 | ?> |
| 65 | 65 | <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> |
| 66 | 66 | <div class="entry-content"> |
| 67 | 67 | <div class="single-plan-inner main-plan-content"> |
| 68 | 68 | <div class="single-plan-section-title title-lined"> |
| 69 | - <?php lsx_get_svg_icon( 'my-plan.svg' ); ?> |
|
| 70 | - <h2><?php echo esc_html_e( 'Your Plan', 'lsx-health-plan' ); ?></h2> |
|
| 71 | - <?php if ( class_exists( 'LSX_Sharing' ) ) { |
|
| 69 | + <?php lsx_get_svg_icon('my-plan.svg'); ?> |
|
| 70 | + <h2><?php echo esc_html_e('Your Plan', 'lsx-health-plan'); ?></h2> |
|
| 71 | + <?php if (class_exists('LSX_Sharing')) { |
|
| 72 | 72 | lsx_content_sharing(); |
| 73 | 73 | } ?> |
| 74 | 74 | </div> |
@@ -76,16 +76,16 @@ discard block |
||
| 76 | 76 | <div class="set-box set content-box entry-content"> |
| 77 | 77 | <div class="plan-top-content"> |
| 78 | 78 | <?php |
| 79 | - if ( $connected_members ) { |
|
| 80 | - echo wp_kses_post( lsx_hp_member_connected( $connected_members, $plan ) ); |
|
| 79 | + if ($connected_members) { |
|
| 80 | + echo wp_kses_post(lsx_hp_member_connected($connected_members, $plan)); |
|
| 81 | 81 | } |
| 82 | - if ( false === $restricted ) { |
|
| 83 | - echo wp_kses_post( '<span class="progress"><progress class="bar" value="' . $round_progress . '" max="100"> ' . $round_progress . '% </progress><span>' . $round_progress . '%</span></span>' ); |
|
| 82 | + if (false === $restricted) { |
|
| 83 | + echo wp_kses_post('<span class="progress"><progress class="bar" value="' . $round_progress . '" max="100"> ' . $round_progress . '% </progress><span>' . $round_progress . '%</span></span>'); |
|
| 84 | 84 | } |
| 85 | - if ( $small_description ) { |
|
| 85 | + if ($small_description) { |
|
| 86 | 86 | ?> |
| 87 | 87 | <div class="the-content"> |
| 88 | - <span><?php echo esc_html( $small_description ); ?></span> |
|
| 88 | + <span><?php echo esc_html($small_description); ?></span> |
|
| 89 | 89 | </div> |
| 90 | 90 | <?php |
| 91 | 91 | |
@@ -93,20 +93,20 @@ discard block |
||
| 93 | 93 | ?> |
| 94 | 94 | </div> |
| 95 | 95 | <?php |
| 96 | - if ( lsx_health_plan_has_tips() ) { |
|
| 97 | - echo wp_kses_post( do_shortcode( '[lsx_health_plan_featured_tips_block]' ) ); |
|
| 96 | + if (lsx_health_plan_has_tips()) { |
|
| 97 | + echo wp_kses_post(do_shortcode('[lsx_health_plan_featured_tips_block]')); |
|
| 98 | 98 | } ?> |
| 99 | 99 | </div> |
| 100 | 100 | <div class="the-plan-content"> |
| 101 | 101 | <?php |
| 102 | - echo do_shortcode( '[lsx_health_plan_day_plan_block week_view="true" show_downloads="true" plan="' . get_the_ID() . '"]' ); |
|
| 102 | + echo do_shortcode('[lsx_health_plan_day_plan_block week_view="true" show_downloads="true" plan="' . get_the_ID() . '"]'); |
|
| 103 | 103 | |
| 104 | 104 | ?> |
| 105 | 105 | <div class="row status-plan-buttons main-plan-btn"> |
| 106 | 106 | <?php |
| 107 | - if ( function_exists( 'wc_get_page_id' ) ) { |
|
| 107 | + if (function_exists('wc_get_page_id')) { |
|
| 108 | 108 | ?> |
| 109 | - <a class="btn border-btn" href="<?php echo wp_kses_post( get_permalink( wc_get_page_id( 'myaccount' ) ) ); ?>"><?php esc_html_e( 'My Plans', 'lsx-health-plan' ); ?></a> |
|
| 109 | + <a class="btn border-btn" href="<?php echo wp_kses_post(get_permalink(wc_get_page_id('myaccount'))); ?>"><?php esc_html_e('My Plans', 'lsx-health-plan'); ?></a> |
|
| 110 | 110 | <?php |
| 111 | 111 | } |
| 112 | 112 | ?> |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | |
| 129 | 129 | <?php |
| 130 | 130 | // Show the buttons on the single plan tabs. |
| 131 | - if ( ! empty( $has_sections ) && false !== $is_section ) { |
|
| 131 | + if ( ! empty($has_sections) && false !== $is_section) { |
|
| 132 | 132 | ?> |
| 133 | 133 | <div class="row status-plan-buttons"> |
| 134 | 134 | <?php lsx_health_plan_day_button(); ?> |
@@ -140,8 +140,8 @@ discard block |
||
| 140 | 140 | <?php lsx_content_bottom(); ?> |
| 141 | 141 | |
| 142 | 142 | <?php |
| 143 | - if ( ! empty( $connected_articles ) ) { |
|
| 144 | - lsx_hp_single_related( $connected_articles, __( 'Latest articles', 'lsx-health-plan' ) ); |
|
| 143 | + if ( ! empty($connected_articles)) { |
|
| 144 | + lsx_hp_single_related($connected_articles, __('Latest articles', 'lsx-health-plan')); |
|
| 145 | 145 | } |
| 146 | 146 | ?> |
| 147 | 147 | |
@@ -13,10 +13,10 @@ discard block |
||
| 13 | 13 | $column_class = '4'; |
| 14 | 14 | // Check for shortcode overrides. |
| 15 | 15 | if ( null !== $shortcode_args ) { |
| 16 | - if ( isset( $shortcode_args['columns'] ) ) { |
|
| 17 | - $column_class = $shortcode_args['columns']; |
|
| 18 | - $column_class = \lsx_health_plan\functions\column_class( $column_class ); |
|
| 19 | - } |
|
| 16 | + if ( isset( $shortcode_args['columns'] ) ) { |
|
| 17 | + $column_class = $shortcode_args['columns']; |
|
| 18 | + $column_class = \lsx_health_plan\functions\column_class( $column_class ); |
|
| 19 | + } |
|
| 20 | 20 | } |
| 21 | 21 | ?> |
| 22 | 22 | |
@@ -29,17 +29,17 @@ discard block |
||
| 29 | 29 | <div class="recipe-feature-img"> |
| 30 | 30 | <a href="<?php echo esc_url( get_permalink() ); ?>"> |
| 31 | 31 | <?php |
| 32 | - $featured_image = get_the_post_thumbnail(); |
|
| 33 | - if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
| 34 | - the_post_thumbnail( 'lsx-thumbnail-square', array( |
|
| 35 | - 'class' => 'aligncenter', |
|
| 36 | - ) ); |
|
| 37 | - } else { |
|
| 38 | - ?> |
|
| 32 | + $featured_image = get_the_post_thumbnail(); |
|
| 33 | + if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
| 34 | + the_post_thumbnail( 'lsx-thumbnail-square', array( |
|
| 35 | + 'class' => 'aligncenter', |
|
| 36 | + ) ); |
|
| 37 | + } else { |
|
| 38 | + ?> |
|
| 39 | 39 | <img loading="lazy" class="placeholder" src="<?php echo esc_attr( plugin_dir_url( __FILE__ ) . '../assets/images/placeholder.jpg' ); ?>"> |
| 40 | 40 | <?php |
| 41 | - } |
|
| 42 | - ?> |
|
| 41 | + } |
|
| 42 | + ?> |
|
| 43 | 43 | </a> |
| 44 | 44 | </div> |
| 45 | 45 | <div class="content-box white-bg"> |
@@ -12,31 +12,31 @@ discard block |
||
| 12 | 12 | <?php |
| 13 | 13 | $column_class = '4'; |
| 14 | 14 | // Check for shortcode overrides. |
| 15 | -if ( null !== $shortcode_args ) { |
|
| 16 | - if ( isset( $shortcode_args['columns'] ) ) { |
|
| 15 | +if (null !== $shortcode_args) { |
|
| 16 | + if (isset($shortcode_args['columns'])) { |
|
| 17 | 17 | $column_class = $shortcode_args['columns']; |
| 18 | - $column_class = \lsx_health_plan\functions\column_class( $column_class ); |
|
| 18 | + $column_class = \lsx_health_plan\functions\column_class($column_class); |
|
| 19 | 19 | } |
| 20 | 20 | } |
| 21 | 21 | ?> |
| 22 | 22 | |
| 23 | -<div class="col-xs-12 col-sm-6 col-md-<?php echo esc_attr( $column_class ); ?>"> |
|
| 23 | +<div class="col-xs-12 col-sm-6 col-md-<?php echo esc_attr($column_class); ?>"> |
|
| 24 | 24 | <article class="lsx-slot box-shadow"> |
| 25 | 25 | <?php lsx_entry_top(); ?> |
| 26 | 26 | |
| 27 | 27 | <?php lsx_hp_recipe_plan_meta(); ?> |
| 28 | 28 | |
| 29 | 29 | <div class="recipe-feature-img"> |
| 30 | - <a href="<?php echo esc_url( get_permalink() ); ?>"> |
|
| 30 | + <a href="<?php echo esc_url(get_permalink()); ?>"> |
|
| 31 | 31 | <?php |
| 32 | 32 | $featured_image = get_the_post_thumbnail(); |
| 33 | - if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
| 34 | - the_post_thumbnail( 'lsx-thumbnail-square', array( |
|
| 33 | + if ( ! empty($featured_image) && '' !== $featured_image) { |
|
| 34 | + the_post_thumbnail('lsx-thumbnail-square', array( |
|
| 35 | 35 | 'class' => 'aligncenter', |
| 36 | - ) ); |
|
| 36 | + )); |
|
| 37 | 37 | } else { |
| 38 | 38 | ?> |
| 39 | - <img loading="lazy" class="placeholder" src="<?php echo esc_attr( plugin_dir_url( __FILE__ ) . '../assets/images/placeholder.jpg' ); ?>"> |
|
| 39 | + <img loading="lazy" class="placeholder" src="<?php echo esc_attr(plugin_dir_url(__FILE__) . '../assets/images/placeholder.jpg'); ?>"> |
|
| 40 | 40 | <?php |
| 41 | 41 | } |
| 42 | 42 | ?> |
@@ -44,10 +44,10 @@ discard block |
||
| 44 | 44 | </div> |
| 45 | 45 | <div class="content-box white-bg"> |
| 46 | 46 | <?php lsx_health_plan_recipe_data(); ?> |
| 47 | - <a class="recipe-title-link" href="<?php echo esc_url( get_permalink() ); ?>"> |
|
| 48 | - <?php the_title( '<h3 class="recipe-title">', '</h3>' ); ?> |
|
| 47 | + <a class="recipe-title-link" href="<?php echo esc_url(get_permalink()); ?>"> |
|
| 48 | + <?php the_title('<h3 class="recipe-title">', '</h3>'); ?> |
|
| 49 | 49 | </a> |
| 50 | - <a href="<?php echo esc_url( get_permalink() ); ?>" class="btn border-btn"><?php esc_html_e( 'See Recipe', 'lsx-health-plan' ); ?></a> |
|
| 50 | + <a href="<?php echo esc_url(get_permalink()); ?>" class="btn border-btn"><?php esc_html_e('See Recipe', 'lsx-health-plan'); ?></a> |
|
| 51 | 51 | </div> |
| 52 | 52 | <?php lsx_entry_bottom(); ?> |
| 53 | 53 | </article> |
@@ -1143,7 +1143,9 @@ |
||
| 1143 | 1143 | </article> |
| 1144 | 1144 | |
| 1145 | 1145 | <?php |
| 1146 | - if (++$i === 3) break; |
|
| 1146 | + if (++$i === 3) { |
|
| 1147 | + break; |
|
| 1148 | + } |
|
| 1147 | 1149 | } ?> |
| 1148 | 1150 | </div> |
| 1149 | 1151 | </div> |
@@ -11,25 +11,25 @@ discard block |
||
| 11 | 11 | * @return void |
| 12 | 12 | */ |
| 13 | 13 | function lsx_health_plan_warmup_box() { |
| 14 | - ?> |
|
| 14 | + ?> |
|
| 15 | 15 | <div class="col-md-4" > |
| 16 | 16 | <div class="lsx-health-plan-box"> |
| 17 | 17 | <h3 class="title warm-up-title title-lined"><?php esc_html_e( 'Your Warm-up', 'lsx-health-plan' ); ?><?php lsx_get_svg_icon( 'warm.svg' ); ?></h3> |
| 18 | 18 | <div class="spacer"></div> |
| 19 | 19 | <?php |
| 20 | - $intro_text = \lsx_health_plan\functions\get_option( 'warmup_intro', false ); |
|
| 21 | - if ( false !== $intro_text ) { |
|
| 22 | - ?> |
|
| 20 | + $intro_text = \lsx_health_plan\functions\get_option( 'warmup_intro', false ); |
|
| 21 | + if ( false !== $intro_text ) { |
|
| 22 | + ?> |
|
| 23 | 23 | <div class="excerpt"> |
| 24 | 24 | <p><?php echo wp_kses_post( $intro_text ); ?></p> |
| 25 | 25 | </div> |
| 26 | 26 | <?php |
| 27 | - } |
|
| 28 | - $warm_up = \lsx_health_plan\functions\get_option( 'endpoint_warm_up', false ); |
|
| 29 | - if ( false === $warm_up ) { |
|
| 30 | - $warm_up = 'warm-up'; |
|
| 31 | - } |
|
| 32 | - ?> |
|
| 27 | + } |
|
| 28 | + $warm_up = \lsx_health_plan\functions\get_option( 'endpoint_warm_up', false ); |
|
| 29 | + if ( false === $warm_up ) { |
|
| 30 | + $warm_up = 'warm-up'; |
|
| 31 | + } |
|
| 32 | + ?> |
|
| 33 | 33 | <a href="<?php the_permalink(); ?><?php echo esc_attr( $warm_up ); ?>/" class="btn"><?php esc_html_e( 'Start your warm-up', 'lsx-health-plan' ); ?></a> |
| 34 | 34 | </div> |
| 35 | 35 | </div> |
@@ -42,28 +42,28 @@ discard block |
||
| 42 | 42 | * @return void |
| 43 | 43 | */ |
| 44 | 44 | function lsx_health_plan_workout_box() { |
| 45 | - if ( ! post_type_exists( 'workout' ) ) { |
|
| 46 | - return; |
|
| 47 | - } |
|
| 48 | - ?> |
|
| 45 | + if ( ! post_type_exists( 'workout' ) ) { |
|
| 46 | + return; |
|
| 47 | + } |
|
| 48 | + ?> |
|
| 49 | 49 | <div class="col-md-4" > |
| 50 | 50 | <div class="lsx-health-plan-box"> |
| 51 | 51 | <h3 class="title work-out-title title-lined"><?php esc_html_e( 'Your Workout', 'lsx-health-plan' ); ?><?php lsx_get_svg_icon( 'work.svg' ); ?></h3> |
| 52 | 52 | <div class="spacer"></div> |
| 53 | 53 | <?php |
| 54 | - $intro_text = \lsx_health_plan\functions\get_option( 'workout_intro', false ); |
|
| 55 | - if ( false !== $intro_text ) { |
|
| 56 | - ?> |
|
| 54 | + $intro_text = \lsx_health_plan\functions\get_option( 'workout_intro', false ); |
|
| 55 | + if ( false !== $intro_text ) { |
|
| 56 | + ?> |
|
| 57 | 57 | <div class="excerpt"> |
| 58 | 58 | <p><?php echo wp_kses_post( $intro_text ); ?></p> |
| 59 | 59 | </div> |
| 60 | 60 | <?php |
| 61 | - } |
|
| 62 | - $workout = \lsx_health_plan\functions\get_option( 'endpoint_workout', false ); |
|
| 63 | - if ( false === $workout ) { |
|
| 64 | - $workout = 'workout'; |
|
| 65 | - } |
|
| 66 | - ?> |
|
| 61 | + } |
|
| 62 | + $workout = \lsx_health_plan\functions\get_option( 'endpoint_workout', false ); |
|
| 63 | + if ( false === $workout ) { |
|
| 64 | + $workout = 'workout'; |
|
| 65 | + } |
|
| 66 | + ?> |
|
| 67 | 67 | <a href="<?php the_permalink(); ?><?php echo esc_attr( $workout ); ?>/" class="btn"><?php esc_html_e( 'Start your workout', 'lsx-health-plan' ); ?></a> |
| 68 | 68 | </div> |
| 69 | 69 | </div> |
@@ -76,28 +76,28 @@ discard block |
||
| 76 | 76 | * @return void |
| 77 | 77 | */ |
| 78 | 78 | function lsx_health_plan_meal_box() { |
| 79 | - if ( ! post_type_exists( 'meal' ) ) { |
|
| 80 | - return; |
|
| 81 | - } |
|
| 82 | - ?> |
|
| 79 | + if ( ! post_type_exists( 'meal' ) ) { |
|
| 80 | + return; |
|
| 81 | + } |
|
| 82 | + ?> |
|
| 83 | 83 | <div class="col-md-4" > |
| 84 | 84 | <div class="lsx-health-plan-box"> |
| 85 | 85 | <h3 class="title meal-plan-title title-lined"><?php esc_html_e( 'Your Meal Plan', 'lsx-health-plan' ); ?><?php lsx_get_svg_icon( 'meal.svg' ); ?></h3> |
| 86 | 86 | <div class="spacer"></div> |
| 87 | 87 | <?php |
| 88 | - $intro_text = \lsx_health_plan\functions\get_option( 'meal_plan_intro', false ); |
|
| 89 | - if ( false !== $intro_text ) { |
|
| 90 | - ?> |
|
| 88 | + $intro_text = \lsx_health_plan\functions\get_option( 'meal_plan_intro', false ); |
|
| 89 | + if ( false !== $intro_text ) { |
|
| 90 | + ?> |
|
| 91 | 91 | <div class="excerpt"> |
| 92 | 92 | <p><?php echo wp_kses_post( $intro_text ); ?></p> |
| 93 | 93 | </div> |
| 94 | 94 | <?php |
| 95 | - } |
|
| 96 | - $meal = \lsx_health_plan\functions\get_option( 'endpoint_meal', false ); |
|
| 97 | - if ( false === $meal ) { |
|
| 98 | - $meal = 'meal'; |
|
| 99 | - } |
|
| 100 | - ?> |
|
| 95 | + } |
|
| 96 | + $meal = \lsx_health_plan\functions\get_option( 'endpoint_meal', false ); |
|
| 97 | + if ( false === $meal ) { |
|
| 98 | + $meal = 'meal'; |
|
| 99 | + } |
|
| 100 | + ?> |
|
| 101 | 101 | <a href="<?php the_permalink(); ?><?php echo esc_attr( $meal ); ?>/" class="btn"><?php esc_html_e( 'View your meal plan', 'lsx-health-plan' ); ?></a> |
| 102 | 102 | </div> |
| 103 | 103 | </div> |
@@ -110,28 +110,28 @@ discard block |
||
| 110 | 110 | * @return void |
| 111 | 111 | */ |
| 112 | 112 | function lsx_health_plan_recipe_box() { |
| 113 | - if ( ! post_type_exists( 'recipe' ) ) { |
|
| 114 | - return; |
|
| 115 | - } |
|
| 116 | - ?> |
|
| 113 | + if ( ! post_type_exists( 'recipe' ) ) { |
|
| 114 | + return; |
|
| 115 | + } |
|
| 116 | + ?> |
|
| 117 | 117 | <div class="col-md-4" > |
| 118 | 118 | <div class="lsx-health-plan-box"> |
| 119 | 119 | <h3 class="title recipes-title title-lined"><?php esc_html_e( 'Recipes', 'lsx-health-plan' ); ?><?php lsx_get_svg_icon( 'recipes.svg' ); ?></h3> |
| 120 | 120 | <div class="spacer"></div> |
| 121 | 121 | <?php |
| 122 | - $intro_text = \lsx_health_plan\functions\get_option( 'recipes_intro', false ); |
|
| 123 | - if ( false !== $intro_text ) { |
|
| 124 | - ?> |
|
| 122 | + $intro_text = \lsx_health_plan\functions\get_option( 'recipes_intro', false ); |
|
| 123 | + if ( false !== $intro_text ) { |
|
| 124 | + ?> |
|
| 125 | 125 | <div class="excerpt"> |
| 126 | 126 | <p><?php echo wp_kses_post( $intro_text ); ?></p> |
| 127 | 127 | </div> |
| 128 | 128 | <?php |
| 129 | - } |
|
| 130 | - $recipes = \lsx_health_plan\functions\get_option( 'endpoint_recipe', false ); |
|
| 131 | - if ( false === $recipes ) { |
|
| 132 | - $recipes = 'recipes'; |
|
| 133 | - } |
|
| 134 | - ?> |
|
| 129 | + } |
|
| 130 | + $recipes = \lsx_health_plan\functions\get_option( 'endpoint_recipe', false ); |
|
| 131 | + if ( false === $recipes ) { |
|
| 132 | + $recipes = 'recipes'; |
|
| 133 | + } |
|
| 134 | + ?> |
|
| 135 | 135 | <a href="<?php the_permalink(); ?><?php echo esc_attr( $recipes ); ?>/" class="btn"><?php esc_html_e( 'View all recipes', 'lsx-health-plan' ); ?></a> |
| 136 | 136 | </div> |
| 137 | 137 | </div> |
@@ -144,8 +144,8 @@ discard block |
||
| 144 | 144 | * @return void |
| 145 | 145 | */ |
| 146 | 146 | function lsx_health_plan_downloads_box() { |
| 147 | - global $current_user; |
|
| 148 | - ?> |
|
| 147 | + global $current_user; |
|
| 148 | + ?> |
|
| 149 | 149 | <div class="col-md-4 day-download-box" > |
| 150 | 150 | <div class="lsx-health-plan-box"> |
| 151 | 151 | <h3 class="title downloads-title title-lined"><?php esc_html_e( 'Downloads', 'lsx-health-plan' ); ?><?php lsx_get_svg_icon( 'download.svg' ); ?></h3> |
@@ -153,13 +153,13 @@ discard block |
||
| 153 | 153 | <div class="download-list"> |
| 154 | 154 | <ul> |
| 155 | 155 | <?php |
| 156 | - $downloads = \lsx_health_plan\functions\get_downloads(); |
|
| 157 | - if ( ! empty( $downloads ) ) { |
|
| 158 | - foreach ( $downloads as $download ) { |
|
| 159 | - echo wp_kses_post( '<li><a href=""><i class="fa fa-file-pdf"></i>' . do_shortcode( '[download id="' . $download . '"]' ) . '</a></li>' ); |
|
| 160 | - } |
|
| 161 | - } |
|
| 162 | - ?> |
|
| 156 | + $downloads = \lsx_health_plan\functions\get_downloads(); |
|
| 157 | + if ( ! empty( $downloads ) ) { |
|
| 158 | + foreach ( $downloads as $download ) { |
|
| 159 | + echo wp_kses_post( '<li><a href=""><i class="fa fa-file-pdf"></i>' . do_shortcode( '[download id="' . $download . '"]' ) . '</a></li>' ); |
|
| 160 | + } |
|
| 161 | + } |
|
| 162 | + ?> |
|
| 163 | 163 | </ul> |
| 164 | 164 | </div> |
| 165 | 165 | </div> |
@@ -174,15 +174,15 @@ discard block |
||
| 174 | 174 | * @return void |
| 175 | 175 | */ |
| 176 | 176 | function lsx_health_plan_nav_class( $tab = '' ) { |
| 177 | - $nav_classes = array(); |
|
| 178 | - if ( function_exists( 'is_wc_endpoint_url' ) && 'edit-account' === $tab && is_wc_endpoint_url( 'edit-account' ) ) { |
|
| 179 | - $nav_classes[] = 'active'; |
|
| 180 | - } elseif ( lsx_health_plan_is_current_tab( $tab ) ) { |
|
| 181 | - $nav_classes[] = 'active'; |
|
| 182 | - } |
|
| 183 | - if ( ! empty( $nav_classes ) ) { |
|
| 184 | - echo wp_kses_post( implode( ' ', $nav_classes ) ); |
|
| 185 | - } |
|
| 177 | + $nav_classes = array(); |
|
| 178 | + if ( function_exists( 'is_wc_endpoint_url' ) && 'edit-account' === $tab && is_wc_endpoint_url( 'edit-account' ) ) { |
|
| 179 | + $nav_classes[] = 'active'; |
|
| 180 | + } elseif ( lsx_health_plan_is_current_tab( $tab ) ) { |
|
| 181 | + $nav_classes[] = 'active'; |
|
| 182 | + } |
|
| 183 | + if ( ! empty( $nav_classes ) ) { |
|
| 184 | + echo wp_kses_post( implode( ' ', $nav_classes ) ); |
|
| 185 | + } |
|
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | /** |
@@ -191,22 +191,22 @@ discard block |
||
| 191 | 191 | * @return void |
| 192 | 192 | */ |
| 193 | 193 | function lsx_health_plan_my_profile_tabs() { |
| 194 | - ?> |
|
| 194 | + ?> |
|
| 195 | 195 | <div id="account-nav"> |
| 196 | 196 | <ul class="nav nav-pills"> |
| 197 | 197 | <li class=" |
| 198 | 198 | <?php |
| 199 | - if ( ( function_exists( 'is_wc_endpoint_url' ) && ! is_wc_endpoint_url( 'edit-account' ) ) || ! function_exists( 'is_wc_endpoint_url' ) ) { |
|
| 200 | - echo esc_attr( 'active' ); |
|
| 201 | - } |
|
| 202 | - ?> |
|
| 199 | + if ( ( function_exists( 'is_wc_endpoint_url' ) && ! is_wc_endpoint_url( 'edit-account' ) ) || ! function_exists( 'is_wc_endpoint_url' ) ) { |
|
| 200 | + echo esc_attr( 'active' ); |
|
| 201 | + } |
|
| 202 | + ?> |
|
| 203 | 203 | "><a class="my-plan-tab" href="<?php the_permalink(); ?>"><?php esc_html_e( 'My Plans', 'lsx-health-plan' ); ?></a></li> |
| 204 | 204 | <li class=" |
| 205 | 205 | <?php |
| 206 | - if ( function_exists( 'is_wc_endpoint_url' ) && is_wc_endpoint_url( 'edit-account' ) ) { |
|
| 207 | - echo esc_attr( 'active' ); |
|
| 208 | - } |
|
| 209 | - ?> |
|
| 206 | + if ( function_exists( 'is_wc_endpoint_url' ) && is_wc_endpoint_url( 'edit-account' ) ) { |
|
| 207 | + echo esc_attr( 'active' ); |
|
| 208 | + } |
|
| 209 | + ?> |
|
| 210 | 210 | "><a class="account-details-tab" href="<?php the_permalink(); ?>edit-account/"><?php esc_html_e( 'Account Details', 'lsx-health-plan' ); ?></a></li> |
| 211 | 211 | <li class=""><a class="logout-tab" href="<?php echo esc_url( wp_logout_url( get_permalink() ) ); ?>"><?php esc_html_e( 'Logout', 'lsx-health-plan' ); ?></a></li> |
| 212 | 212 | </ul> |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | * @return void |
| 221 | 221 | */ |
| 222 | 222 | function lsx_health_plan_my_profile_box() { |
| 223 | - ?> |
|
| 223 | + ?> |
|
| 224 | 224 | <div class="lsx-health-plan my-profile-block wp-block-cover alignfull"> |
| 225 | 225 | <div class="wp-block-cover__inner-container"> |
| 226 | 226 | <h2><?php esc_html_e( 'My Dashboard', 'lsx-health-plan' ); ?></h2> |
@@ -228,89 +228,89 @@ discard block |
||
| 228 | 228 | <div class="profile-navigation"> |
| 229 | 229 | <div class="profile-photo"> |
| 230 | 230 | <?php |
| 231 | - global $current_user; |
|
| 232 | - get_current_user(); |
|
| 233 | - echo get_avatar( $current_user->ID, 240 ); |
|
| 234 | - ?> |
|
| 231 | + global $current_user; |
|
| 232 | + get_current_user(); |
|
| 233 | + echo get_avatar( $current_user->ID, 240 ); |
|
| 234 | + ?> |
|
| 235 | 235 | </div> |
| 236 | 236 | </div> |
| 237 | 237 | <div class="profile-details"> |
| 238 | 238 | <h1 class="title-lined has-text-color"><?php echo esc_html( $current_user->display_name ); ?></h1> |
| 239 | 239 | <?php |
| 240 | - $disable_stats = \lsx_health_plan\functions\get_option( 'disable_all_stats', false ); |
|
| 241 | - if ( 'on' !== $disable_stats ) { |
|
| 240 | + $disable_stats = \lsx_health_plan\functions\get_option( 'disable_all_stats', false ); |
|
| 241 | + if ( 'on' !== $disable_stats ) { |
|
| 242 | 242 | |
| 243 | - $is_weight_disabled = \lsx_health_plan\functions\get_option( 'disable_weight_checkbox', false ); |
|
| 244 | - $is_height_disabled = \lsx_health_plan\functions\get_option( 'disable_height_checkbox', false ); |
|
| 245 | - $is_waist_disabled = \lsx_health_plan\functions\get_option( 'disable_waist_checkbox', false ); |
|
| 246 | - $is_bmi_disabled = \lsx_health_plan\functions\get_option( 'disable_bmi_checkbox', false ); |
|
| 243 | + $is_weight_disabled = \lsx_health_plan\functions\get_option( 'disable_weight_checkbox', false ); |
|
| 244 | + $is_height_disabled = \lsx_health_plan\functions\get_option( 'disable_height_checkbox', false ); |
|
| 245 | + $is_waist_disabled = \lsx_health_plan\functions\get_option( 'disable_waist_checkbox', false ); |
|
| 246 | + $is_bmi_disabled = \lsx_health_plan\functions\get_option( 'disable_bmi_checkbox', false ); |
|
| 247 | 247 | |
| 248 | - $weight = get_user_meta( get_current_user_id(), 'weight', true ); |
|
| 249 | - $waist = get_user_meta( get_current_user_id(), 'waist', true ); |
|
| 250 | - $height = get_user_meta( get_current_user_id(), 'height', true ); |
|
| 248 | + $weight = get_user_meta( get_current_user_id(), 'weight', true ); |
|
| 249 | + $waist = get_user_meta( get_current_user_id(), 'waist', true ); |
|
| 250 | + $height = get_user_meta( get_current_user_id(), 'height', true ); |
|
| 251 | 251 | |
| 252 | - $height_m = 0; |
|
| 253 | - if ( is_numeric( $height) ) { |
|
| 254 | - $height_m = $height / 100; |
|
| 255 | - } |
|
| 252 | + $height_m = 0; |
|
| 253 | + if ( is_numeric( $height) ) { |
|
| 254 | + $height_m = $height / 100; |
|
| 255 | + } |
|
| 256 | 256 | |
| 257 | - if ( 1 < $weight && 1 < $height_m ) { |
|
| 258 | - $bmi = $weight / ( $height_m * $height_m ); |
|
| 259 | - $bmi = number_format( $bmi, 1 ); |
|
| 260 | - } else { |
|
| 261 | - $bmi = __( 'Add more data', 'lsx-health-plan' ); |
|
| 262 | - } |
|
| 257 | + if ( 1 < $weight && 1 < $height_m ) { |
|
| 258 | + $bmi = $weight / ( $height_m * $height_m ); |
|
| 259 | + $bmi = number_format( $bmi, 1 ); |
|
| 260 | + } else { |
|
| 261 | + $bmi = __( 'Add more data', 'lsx-health-plan' ); |
|
| 262 | + } |
|
| 263 | 263 | |
| 264 | - ?> |
|
| 264 | + ?> |
|
| 265 | 265 | |
| 266 | 266 | <div> |
| 267 | 267 | <?php if ( 'on' !== $is_weight_disabled ) { ?> |
| 268 | 268 | <span><strong><?php esc_html_e( 'Weight:', 'lsx-health-plan' ); ?></strong> |
| 269 | 269 | <?php |
| 270 | - if ( '' !== $weight ) { |
|
| 271 | - echo wp_kses_post( $weight . ' kg' ); |
|
| 272 | - } else { |
|
| 273 | - echo '/'; |
|
| 274 | - } |
|
| 275 | - ?> |
|
| 270 | + if ( '' !== $weight ) { |
|
| 271 | + echo wp_kses_post( $weight . ' kg' ); |
|
| 272 | + } else { |
|
| 273 | + echo '/'; |
|
| 274 | + } |
|
| 275 | + ?> |
|
| 276 | 276 | </span> |
| 277 | 277 | <?php } |
| 278 | - if ( 'on' !== $is_waist_disabled ) { |
|
| 279 | - ?> |
|
| 278 | + if ( 'on' !== $is_waist_disabled ) { |
|
| 279 | + ?> |
|
| 280 | 280 | <span><strong><?php esc_html_e( 'Waist:', 'lsx-health-plan' ); ?></strong> |
| 281 | 281 | <?php |
| 282 | - if ( '' !== $waist ) { |
|
| 283 | - echo wp_kses_post( $waist . ' cm' ); |
|
| 284 | - } else { |
|
| 285 | - echo '/'; |
|
| 286 | - } |
|
| 287 | - ?> |
|
| 282 | + if ( '' !== $waist ) { |
|
| 283 | + echo wp_kses_post( $waist . ' cm' ); |
|
| 284 | + } else { |
|
| 285 | + echo '/'; |
|
| 286 | + } |
|
| 287 | + ?> |
|
| 288 | 288 | </span> |
| 289 | 289 | <?php } |
| 290 | - if ( 'on' !== $is_bmi_disabled ) { |
|
| 291 | - ?> |
|
| 290 | + if ( 'on' !== $is_bmi_disabled ) { |
|
| 291 | + ?> |
|
| 292 | 292 | <span><strong><?php esc_html_e( 'BMI:', 'lsx-health-plan' ); ?></strong> |
| 293 | 293 | <?php |
| 294 | - if ( '' !== $bmi ) { |
|
| 295 | - echo wp_kses_post( $bmi ); |
|
| 296 | - } else { |
|
| 297 | - echo '/'; |
|
| 298 | - } |
|
| 299 | - ?> |
|
| 294 | + if ( '' !== $bmi ) { |
|
| 295 | + echo wp_kses_post( $bmi ); |
|
| 296 | + } else { |
|
| 297 | + echo '/'; |
|
| 298 | + } |
|
| 299 | + ?> |
|
| 300 | 300 | </span> |
| 301 | 301 | <?php } ?> |
| 302 | 302 | </div> |
| 303 | 303 | <?php |
| 304 | - } |
|
| 305 | - ?> |
|
| 304 | + } |
|
| 305 | + ?> |
|
| 306 | 306 | <div class="edit-profile"> |
| 307 | 307 | <?php |
| 308 | - if ( function_exists( 'wc_get_page_id' ) ) { |
|
| 309 | - $url_id = wc_get_page_id( 'myaccount' ); |
|
| 310 | - } else { |
|
| 311 | - $url_id = ''; |
|
| 312 | - } |
|
| 313 | - ?> |
|
| 308 | + if ( function_exists( 'wc_get_page_id' ) ) { |
|
| 309 | + $url_id = wc_get_page_id( 'myaccount' ); |
|
| 310 | + } else { |
|
| 311 | + $url_id = ''; |
|
| 312 | + } |
|
| 313 | + ?> |
|
| 314 | 314 | <a href="<?php echo esc_url( get_permalink( $url_id ) ); ?>edit-account/"><?php esc_html_e( 'Edit', 'lsx-health-plan' ); ?></a> |
| 315 | 315 | </div> |
| 316 | 316 | </div> |
@@ -326,63 +326,63 @@ discard block |
||
| 326 | 326 | * @return void |
| 327 | 327 | */ |
| 328 | 328 | function lsx_health_plan_all_plans_block() { |
| 329 | - global $post, $product; |
|
| 330 | - |
|
| 331 | - $args = array( |
|
| 332 | - 'orderby' => 'menu_order', |
|
| 333 | - 'order' => 'ASC', |
|
| 334 | - 'post_type' => 'plan', |
|
| 335 | - 'nopagin' => true, |
|
| 336 | - 'post_parent' => 0, |
|
| 337 | - ); |
|
| 338 | - |
|
| 339 | - $product_ids = \lsx_health_plan\functions\woocommerce\get_membership_products(); |
|
| 340 | - if ( ! empty( $product_ids ) ) { |
|
| 341 | - $args['meta_query'] = array( |
|
| 342 | - 'relation' => 'OR', |
|
| 343 | - array( |
|
| 344 | - 'key' => '_plan_product_id', |
|
| 345 | - 'value' => $product_ids, |
|
| 346 | - 'compare' => 'IN', |
|
| 347 | - ), |
|
| 348 | - array( |
|
| 349 | - 'key' => '_plan_product_id', |
|
| 350 | - 'compare' => 'NOT EXISTS', |
|
| 351 | - ), |
|
| 352 | - ); |
|
| 353 | - } |
|
| 354 | - |
|
| 355 | - $the_query = new WP_Query( $args ); |
|
| 356 | - ?> |
|
| 329 | + global $post, $product; |
|
| 330 | + |
|
| 331 | + $args = array( |
|
| 332 | + 'orderby' => 'menu_order', |
|
| 333 | + 'order' => 'ASC', |
|
| 334 | + 'post_type' => 'plan', |
|
| 335 | + 'nopagin' => true, |
|
| 336 | + 'post_parent' => 0, |
|
| 337 | + ); |
|
| 338 | + |
|
| 339 | + $product_ids = \lsx_health_plan\functions\woocommerce\get_membership_products(); |
|
| 340 | + if ( ! empty( $product_ids ) ) { |
|
| 341 | + $args['meta_query'] = array( |
|
| 342 | + 'relation' => 'OR', |
|
| 343 | + array( |
|
| 344 | + 'key' => '_plan_product_id', |
|
| 345 | + 'value' => $product_ids, |
|
| 346 | + 'compare' => 'IN', |
|
| 347 | + ), |
|
| 348 | + array( |
|
| 349 | + 'key' => '_plan_product_id', |
|
| 350 | + 'compare' => 'NOT EXISTS', |
|
| 351 | + ), |
|
| 352 | + ); |
|
| 353 | + } |
|
| 354 | + |
|
| 355 | + $the_query = new WP_Query( $args ); |
|
| 356 | + ?> |
|
| 357 | 357 | <div class="all-plans-block plan-grid block-all-plans-block"> |
| 358 | 358 | <div class="row"> |
| 359 | 359 | <?php |
| 360 | - if ( $the_query->have_posts() ) : |
|
| 361 | - while ( $the_query->have_posts() ) : |
|
| 362 | - $the_query->the_post(); |
|
| 363 | - lsx_entry_before(); |
|
| 364 | - $completed_class = ''; |
|
| 365 | - $linked_product = false; |
|
| 366 | - $restricted = false; |
|
| 367 | - $product = null; |
|
| 368 | - if ( \lsx_health_plan\functions\woocommerce\plan_has_products() ) { |
|
| 369 | - $products = \lsx_health_plan\functions\woocommerce\get_plan_products(); |
|
| 370 | - $linked_product = wc_get_product( $products[0] ); |
|
| 371 | - $product = $linked_product; |
|
| 372 | - } |
|
| 373 | - if ( function_exists( 'wc_memberships_is_post_content_restricted' ) ) { |
|
| 374 | - $restricted = wc_memberships_is_post_content_restricted( get_the_ID() ) && ! current_user_can( 'wc_memberships_view_restricted_post_content', get_the_ID() ); |
|
| 375 | - } |
|
| 376 | - |
|
| 377 | - if ( lsx_health_plan_is_plan_complete() ) { |
|
| 378 | - $completed_class = 'completed'; |
|
| 379 | - } |
|
| 380 | - $round_progress = ''; |
|
| 381 | - $completed_progress = '100'; |
|
| 382 | - if ( false === $restricted ) { |
|
| 383 | - $round_progress = round( \lsx_health_plan\functions\get_progress( get_the_ID() ), 0 ); |
|
| 384 | - } |
|
| 385 | - ?> |
|
| 360 | + if ( $the_query->have_posts() ) : |
|
| 361 | + while ( $the_query->have_posts() ) : |
|
| 362 | + $the_query->the_post(); |
|
| 363 | + lsx_entry_before(); |
|
| 364 | + $completed_class = ''; |
|
| 365 | + $linked_product = false; |
|
| 366 | + $restricted = false; |
|
| 367 | + $product = null; |
|
| 368 | + if ( \lsx_health_plan\functions\woocommerce\plan_has_products() ) { |
|
| 369 | + $products = \lsx_health_plan\functions\woocommerce\get_plan_products(); |
|
| 370 | + $linked_product = wc_get_product( $products[0] ); |
|
| 371 | + $product = $linked_product; |
|
| 372 | + } |
|
| 373 | + if ( function_exists( 'wc_memberships_is_post_content_restricted' ) ) { |
|
| 374 | + $restricted = wc_memberships_is_post_content_restricted( get_the_ID() ) && ! current_user_can( 'wc_memberships_view_restricted_post_content', get_the_ID() ); |
|
| 375 | + } |
|
| 376 | + |
|
| 377 | + if ( lsx_health_plan_is_plan_complete() ) { |
|
| 378 | + $completed_class = 'completed'; |
|
| 379 | + } |
|
| 380 | + $round_progress = ''; |
|
| 381 | + $completed_progress = '100'; |
|
| 382 | + if ( false === $restricted ) { |
|
| 383 | + $round_progress = round( \lsx_health_plan\functions\get_progress( get_the_ID() ), 0 ); |
|
| 384 | + } |
|
| 385 | + ?> |
|
| 386 | 386 | <div class="col-xs-12 col-sm-6 col-md-4"> |
| 387 | 387 | <article class="lsx-slot lsx-hp-shadow <?php echo esc_html( 'progress-') . $round_progress; ?>"> |
| 388 | 388 | <div class="plan-feature-img"> |
@@ -391,45 +391,45 @@ discard block |
||
| 391 | 391 | <?php } ?> |
| 392 | 392 | <a href="<?php echo esc_url( get_permalink() ); ?>"> |
| 393 | 393 | <?php |
| 394 | - $featured_image = get_the_post_thumbnail(); |
|
| 395 | - if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
| 396 | - the_post_thumbnail( 'lsx-thumbnail', array( |
|
| 397 | - 'class' => 'aligncenter', |
|
| 398 | - ) ); |
|
| 399 | - } else { |
|
| 400 | - ?> |
|
| 394 | + $featured_image = get_the_post_thumbnail(); |
|
| 395 | + if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
| 396 | + the_post_thumbnail( 'lsx-thumbnail', array( |
|
| 397 | + 'class' => 'aligncenter', |
|
| 398 | + ) ); |
|
| 399 | + } else { |
|
| 400 | + ?> |
|
| 401 | 401 | <img loading="lazy" class="placeholder" src="<?php echo esc_attr( plugin_dir_url( __FILE__ ) . '../assets/images/placeholder.jpg' ); ?>"> |
| 402 | 402 | <?php |
| 403 | - } |
|
| 404 | - ?> |
|
| 403 | + } |
|
| 404 | + ?> |
|
| 405 | 405 | </a> |
| 406 | 406 | </div> |
| 407 | 407 | <div class="content-box plan-content-box"> |
| 408 | 408 | <h3 class="plan id-<?php the_ID(); ?> <?php echo esc_attr( $completed_class ); ?>"><a href="<?php echo esc_url( get_permalink() ); ?>"><?php the_title(); ?></a></h3> |
| 409 | 409 | <?php |
| 410 | - echo wp_kses_post( \lsx_health_plan\functions\hp_get_plan_type_meta( $post ) ); |
|
| 411 | - ?> |
|
| 410 | + echo wp_kses_post( \lsx_health_plan\functions\hp_get_plan_type_meta( $post ) ); |
|
| 411 | + ?> |
|
| 412 | 412 | <?php |
| 413 | - if ( false !== $linked_product && false !== $restricted ) { |
|
| 414 | - echo wp_kses_post( $linked_product->get_price_html() ); |
|
| 415 | - } |
|
| 416 | - ?> |
|
| 413 | + if ( false !== $linked_product && false !== $restricted ) { |
|
| 414 | + echo wp_kses_post( $linked_product->get_price_html() ); |
|
| 415 | + } |
|
| 416 | + ?> |
|
| 417 | 417 | <div class="excerpt"> |
| 418 | 418 | <?php |
| 419 | - if ( ! has_excerpt() ) { |
|
| 420 | - $content = wp_trim_words( get_the_content(), 20 ); |
|
| 421 | - $content = '<p>' . $content . '</pre>'; |
|
| 422 | - } else { |
|
| 423 | - $content = apply_filters( 'the_excerpt', get_the_excerpt() ); |
|
| 424 | - } |
|
| 425 | - echo wp_kses_post( $content ); |
|
| 426 | - ?> |
|
| 419 | + if ( ! has_excerpt() ) { |
|
| 420 | + $content = wp_trim_words( get_the_content(), 20 ); |
|
| 421 | + $content = '<p>' . $content . '</pre>'; |
|
| 422 | + } else { |
|
| 423 | + $content = apply_filters( 'the_excerpt', get_the_excerpt() ); |
|
| 424 | + } |
|
| 425 | + echo wp_kses_post( $content ); |
|
| 426 | + ?> |
|
| 427 | 427 | </div> |
| 428 | 428 | <?php |
| 429 | - if ( false === $restricted ) { |
|
| 430 | - echo wp_kses_post( '<span class="progress"><progress class="bar" value="' . \lsx_health_plan\functions\get_progress( get_the_ID() ) . '" max="100"> ' . \lsx_health_plan\functions\get_progress( get_the_ID() ) . '% </progress><span>' . $round_progress . '%</span></span>' ); |
|
| 431 | - } |
|
| 432 | - ?> |
|
| 429 | + if ( false === $restricted ) { |
|
| 430 | + echo wp_kses_post( '<span class="progress"><progress class="bar" value="' . \lsx_health_plan\functions\get_progress( get_the_ID() ) . '" max="100"> ' . \lsx_health_plan\functions\get_progress( get_the_ID() ) . '% </progress><span>' . $round_progress . '%</span></span>' ); |
|
| 431 | + } |
|
| 432 | + ?> |
|
| 433 | 433 | </div> |
| 434 | 434 | </article> |
| 435 | 435 | </div> |
@@ -448,36 +448,36 @@ discard block |
||
| 448 | 448 | * @return void |
| 449 | 449 | */ |
| 450 | 450 | function lsx_health_plan_day_plan_block( $args = array() ) { |
| 451 | - $defaults = array( |
|
| 452 | - 'plan' => '', |
|
| 453 | - ); |
|
| 454 | - $args = wp_parse_args( $args, $defaults ); |
|
| 455 | - |
|
| 456 | - if ( isset( $args['plan'] ) && '' !== $args['plan'] && \lsx_health_plan\functions\plan\has_sections( $args['plan'] ) ) { |
|
| 457 | - $sections = \lsx_health_plan\functions\plan\get_sections(); |
|
| 458 | - ?> |
|
| 451 | + $defaults = array( |
|
| 452 | + 'plan' => '', |
|
| 453 | + ); |
|
| 454 | + $args = wp_parse_args( $args, $defaults ); |
|
| 455 | + |
|
| 456 | + if ( isset( $args['plan'] ) && '' !== $args['plan'] && \lsx_health_plan\functions\plan\has_sections( $args['plan'] ) ) { |
|
| 457 | + $sections = \lsx_health_plan\functions\plan\get_sections(); |
|
| 458 | + ?> |
|
| 459 | 459 | <div class="daily-plan-block day-grid"> |
| 460 | 460 | <?php |
| 461 | - foreach ( $sections as $section_key => $section_values ) { |
|
| 462 | - $defaults = array( |
|
| 463 | - 'title' => __( 'Day', 'lsx-health-plan' ) . ' ' . ( $section_key + 1 ), |
|
| 464 | - ); |
|
| 465 | - $section_args = wp_parse_args( $section_values, $defaults ); |
|
| 466 | - |
|
| 467 | - $completed_class = ''; |
|
| 468 | - if ( lsx_health_plan_is_day_complete() ) { |
|
| 469 | - $completed_class = 'completed'; |
|
| 470 | - } |
|
| 471 | - ?> |
|
| 461 | + foreach ( $sections as $section_key => $section_values ) { |
|
| 462 | + $defaults = array( |
|
| 463 | + 'title' => __( 'Day', 'lsx-health-plan' ) . ' ' . ( $section_key + 1 ), |
|
| 464 | + ); |
|
| 465 | + $section_args = wp_parse_args( $section_values, $defaults ); |
|
| 466 | + |
|
| 467 | + $completed_class = ''; |
|
| 468 | + if ( lsx_health_plan_is_day_complete() ) { |
|
| 469 | + $completed_class = 'completed'; |
|
| 470 | + } |
|
| 471 | + ?> |
|
| 472 | 472 | <a href="<?php echo esc_attr( \lsx_health_plan\functions\plan\get_permalink( $args['plan'], $section_args['title'] ) ); ?>" class="day id-<?php echo esc_attr( $section_key + 1 ); ?> <?php echo esc_attr( $completed_class ); ?>"> |
| 473 | 473 | <div class="plan-content"><?php echo esc_attr( $section_args['title'] ); ?></div> |
| 474 | 474 | </a> |
| 475 | 475 | <?php |
| 476 | - } |
|
| 477 | - ?> |
|
| 476 | + } |
|
| 477 | + ?> |
|
| 478 | 478 | </div> |
| 479 | 479 | <?php |
| 480 | - } |
|
| 480 | + } |
|
| 481 | 481 | } |
| 482 | 482 | |
| 483 | 483 | /** |
@@ -487,44 +487,44 @@ discard block |
||
| 487 | 487 | * @return void |
| 488 | 488 | */ |
| 489 | 489 | function lsx_health_plan_week_plan_block( $args = array() ) { |
| 490 | - $defaults = array( |
|
| 491 | - 'show_downloads' => false, |
|
| 492 | - 'plan' => '', |
|
| 493 | - ); |
|
| 494 | - $args = wp_parse_args( $args, $defaults ); |
|
| 495 | - |
|
| 496 | - if ( isset( $args['plan'] ) && '' !== $args['plan'] && \lsx_health_plan\functions\plan\has_sections( $args['plan'] ) ) { |
|
| 497 | - $groups = \lsx_health_plan\functions\plan\get_sections( true ); |
|
| 498 | - |
|
| 499 | - if ( ! empty( $groups ) ) { |
|
| 500 | - $counter = 1; |
|
| 501 | - $group_open = false; |
|
| 502 | - |
|
| 503 | - foreach ( $groups as $group_key => $sections ) { |
|
| 504 | - $collapse_class = ''; |
|
| 505 | - $group_title = \lsx_health_plan\functions\plan\get_group_title( $sections ); |
|
| 506 | - |
|
| 507 | - // Determine if the current week is complete. |
|
| 508 | - $day_ids = wp_list_pluck( $sections, 'title' ); |
|
| 509 | - if ( false === $group_open ) { |
|
| 510 | - if ( 1 === $counter && ! \lsx_health_plan\functions\is_week_complete( false, $day_ids, $group_title ) ) { |
|
| 511 | - $collapse_class = 'in'; |
|
| 512 | - $group_open = true; |
|
| 513 | - } elseif ( ! \lsx_health_plan\functions\is_week_complete( false, $day_ids, $group_title ) ) { |
|
| 514 | - $collapse_class = 'in'; |
|
| 515 | - $group_open = true; |
|
| 516 | - } |
|
| 517 | - } |
|
| 518 | - |
|
| 519 | - // Determine if there are any weekly downloads. |
|
| 520 | - $week_downloads_view = ''; |
|
| 521 | - if ( isset( $args['show_downloads'] ) && false !== $args['show_downloads'] ) { |
|
| 522 | - $weekly_downloads = \lsx_health_plan\functions\get_weekly_downloads( $group_key ); |
|
| 523 | - if ( ! empty( $weekly_downloads ) ) { |
|
| 524 | - $week_downloads_view = 'week-downloads-view-on'; |
|
| 525 | - } |
|
| 526 | - } |
|
| 527 | - ?> |
|
| 490 | + $defaults = array( |
|
| 491 | + 'show_downloads' => false, |
|
| 492 | + 'plan' => '', |
|
| 493 | + ); |
|
| 494 | + $args = wp_parse_args( $args, $defaults ); |
|
| 495 | + |
|
| 496 | + if ( isset( $args['plan'] ) && '' !== $args['plan'] && \lsx_health_plan\functions\plan\has_sections( $args['plan'] ) ) { |
|
| 497 | + $groups = \lsx_health_plan\functions\plan\get_sections( true ); |
|
| 498 | + |
|
| 499 | + if ( ! empty( $groups ) ) { |
|
| 500 | + $counter = 1; |
|
| 501 | + $group_open = false; |
|
| 502 | + |
|
| 503 | + foreach ( $groups as $group_key => $sections ) { |
|
| 504 | + $collapse_class = ''; |
|
| 505 | + $group_title = \lsx_health_plan\functions\plan\get_group_title( $sections ); |
|
| 506 | + |
|
| 507 | + // Determine if the current week is complete. |
|
| 508 | + $day_ids = wp_list_pluck( $sections, 'title' ); |
|
| 509 | + if ( false === $group_open ) { |
|
| 510 | + if ( 1 === $counter && ! \lsx_health_plan\functions\is_week_complete( false, $day_ids, $group_title ) ) { |
|
| 511 | + $collapse_class = 'in'; |
|
| 512 | + $group_open = true; |
|
| 513 | + } elseif ( ! \lsx_health_plan\functions\is_week_complete( false, $day_ids, $group_title ) ) { |
|
| 514 | + $collapse_class = 'in'; |
|
| 515 | + $group_open = true; |
|
| 516 | + } |
|
| 517 | + } |
|
| 518 | + |
|
| 519 | + // Determine if there are any weekly downloads. |
|
| 520 | + $week_downloads_view = ''; |
|
| 521 | + if ( isset( $args['show_downloads'] ) && false !== $args['show_downloads'] ) { |
|
| 522 | + $weekly_downloads = \lsx_health_plan\functions\get_weekly_downloads( $group_key ); |
|
| 523 | + if ( ! empty( $weekly_downloads ) ) { |
|
| 524 | + $week_downloads_view = 'week-downloads-view-on'; |
|
| 525 | + } |
|
| 526 | + } |
|
| 527 | + ?> |
|
| 528 | 528 | <div class="daily-plan-block week-grid"> |
| 529 | 529 | <a href="#group-<?php echo esc_attr( $group_key ); ?>" data-toggle="collapse" class="week-title"><?php echo esc_attr( $group_title ); ?></a> |
| 530 | 530 | <div id="group-<?php echo esc_attr( $group_key ); ?>" class="week-row collapse <?php echo esc_attr( $collapse_class ); ?>"> |
@@ -538,38 +538,38 @@ discard block |
||
| 538 | 538 | <div class="week-meals-recipes-box-inner"> |
| 539 | 539 | <?php |
| 540 | 540 | |
| 541 | - foreach ( $sections as $section_key => $section_values ) { |
|
| 541 | + foreach ( $sections as $section_key => $section_values ) { |
|
| 542 | 542 | |
| 543 | - $defaults = array( |
|
| 544 | - 'title' => __( 'Day', 'lsx-health-plan' ) . ' ' . ( $section_key + 1 ), |
|
| 545 | - ); |
|
| 546 | - $section_args = wp_parse_args( $section_values, $defaults ); |
|
| 543 | + $defaults = array( |
|
| 544 | + 'title' => __( 'Day', 'lsx-health-plan' ) . ' ' . ( $section_key + 1 ), |
|
| 545 | + ); |
|
| 546 | + $section_args = wp_parse_args( $section_values, $defaults ); |
|
| 547 | 547 | |
| 548 | - $completed_class = ''; |
|
| 549 | - if ( lsx_health_plan_is_day_complete( $args['plan'], $section_args['title'] ) ) { |
|
| 550 | - $completed_class = 'completed'; |
|
| 551 | - } |
|
| 552 | - ?> |
|
| 548 | + $completed_class = ''; |
|
| 549 | + if ( lsx_health_plan_is_day_complete( $args['plan'], $section_args['title'] ) ) { |
|
| 550 | + $completed_class = 'completed'; |
|
| 551 | + } |
|
| 552 | + ?> |
|
| 553 | 553 | <a href="<?php echo esc_attr( \lsx_health_plan\functions\plan\get_permalink( $args['plan'], $section_args['title'] ) ); ?>" class="day id-<?php echo esc_attr( $section_key + 1 ); ?> <?php echo esc_attr( $completed_class ); ?>"> |
| 554 | 554 | <div class="plan-content"><?php echo esc_attr( $section_args['title'] ); ?></div> |
| 555 | 555 | </a> |
| 556 | 556 | <?php |
| 557 | - } |
|
| 558 | - ?> |
|
| 557 | + } |
|
| 558 | + ?> |
|
| 559 | 559 | </div> |
| 560 | 560 | </div> |
| 561 | 561 | <?php |
| 562 | - if ( ! empty( $week_downloads_view ) ) { |
|
| 563 | - lsx_health_plan_weekly_downloads( $weekly_downloads ); |
|
| 564 | - } |
|
| 565 | - ?> |
|
| 562 | + if ( ! empty( $week_downloads_view ) ) { |
|
| 563 | + lsx_health_plan_weekly_downloads( $weekly_downloads ); |
|
| 564 | + } |
|
| 565 | + ?> |
|
| 566 | 566 | </div> |
| 567 | 567 | </div> |
| 568 | 568 | </div> |
| 569 | 569 | <?php |
| 570 | - } |
|
| 571 | - } |
|
| 572 | - } |
|
| 570 | + } |
|
| 571 | + } |
|
| 572 | + } |
|
| 573 | 573 | } |
| 574 | 574 | |
| 575 | 575 | /** |
@@ -579,22 +579,22 @@ discard block |
||
| 579 | 579 | * @return void |
| 580 | 580 | */ |
| 581 | 581 | function lsx_health_plan_weekly_downloads( $weekly_downloads = array() ) { |
| 582 | - if ( ! empty( $weekly_downloads ) ) { |
|
| 583 | - ?> |
|
| 582 | + if ( ! empty( $weekly_downloads ) ) { |
|
| 583 | + ?> |
|
| 584 | 584 | <div class="week-download-box"> |
| 585 | 585 | <h3 class="title"><?php lsx_get_svg_icon( 'download.svg' ); ?><?php echo esc_html_e( 'Downloads', 'lsx-health-plan' ); ?></h3> |
| 586 | 586 | <ul class="week-download-box-list"> |
| 587 | 587 | <?php |
| 588 | - foreach ( $weekly_downloads as $weekly_download ) { |
|
| 589 | - ?> |
|
| 588 | + foreach ( $weekly_downloads as $weekly_download ) { |
|
| 589 | + ?> |
|
| 590 | 590 | <li><?php echo wp_kses_post( do_shortcode( '[download id="' . $weekly_download . '"]' ) ); ?></li> |
| 591 | 591 | <?php |
| 592 | - } |
|
| 593 | - ?> |
|
| 592 | + } |
|
| 593 | + ?> |
|
| 594 | 594 | </ul> |
| 595 | 595 | </div> |
| 596 | 596 | <?php |
| 597 | - } |
|
| 597 | + } |
|
| 598 | 598 | } |
| 599 | 599 | |
| 600 | 600 | /** |
@@ -603,9 +603,9 @@ discard block |
||
| 603 | 603 | * @return void |
| 604 | 604 | */ |
| 605 | 605 | function lsx_health_plan_items( $args = array() ) { |
| 606 | - global $shortcode_args; |
|
| 607 | - $shortcode_args = $args; |
|
| 608 | - include LSX_HEALTH_PLAN_PATH . '/templates/partials/shortcode-loop.php'; |
|
| 606 | + global $shortcode_args; |
|
| 607 | + $shortcode_args = $args; |
|
| 608 | + include LSX_HEALTH_PLAN_PATH . '/templates/partials/shortcode-loop.php'; |
|
| 609 | 609 | } |
| 610 | 610 | |
| 611 | 611 | /** |
@@ -614,10 +614,10 @@ discard block |
||
| 614 | 614 | * @return void |
| 615 | 615 | */ |
| 616 | 616 | function lsx_health_plan_featured_video_block() { |
| 617 | - if ( ! post_type_exists( 'video' ) ) { |
|
| 618 | - return; |
|
| 619 | - } |
|
| 620 | - include LSX_HEALTH_PLAN_PATH . '/templates/featured-videos.php'; |
|
| 617 | + if ( ! post_type_exists( 'video' ) ) { |
|
| 618 | + return; |
|
| 619 | + } |
|
| 620 | + include LSX_HEALTH_PLAN_PATH . '/templates/featured-videos.php'; |
|
| 621 | 621 | } |
| 622 | 622 | |
| 623 | 623 | /** |
@@ -626,10 +626,10 @@ discard block |
||
| 626 | 626 | * @return void |
| 627 | 627 | */ |
| 628 | 628 | function lsx_health_plan_featured_recipes_block() { |
| 629 | - if ( ! post_type_exists( 'recipe' ) ) { |
|
| 630 | - return; |
|
| 631 | - } |
|
| 632 | - include LSX_HEALTH_PLAN_PATH . '/templates/featured-recipes.php'; |
|
| 629 | + if ( ! post_type_exists( 'recipe' ) ) { |
|
| 630 | + return; |
|
| 631 | + } |
|
| 632 | + include LSX_HEALTH_PLAN_PATH . '/templates/featured-recipes.php'; |
|
| 633 | 633 | } |
| 634 | 634 | |
| 635 | 635 | /** |
@@ -638,7 +638,7 @@ discard block |
||
| 638 | 638 | * @return void |
| 639 | 639 | */ |
| 640 | 640 | function lsx_health_plan_featured_tips_block() { |
| 641 | - include LSX_HEALTH_PLAN_PATH . '/templates/featured-tips.php'; |
|
| 641 | + include LSX_HEALTH_PLAN_PATH . '/templates/featured-tips.php'; |
|
| 642 | 642 | } |
| 643 | 643 | |
| 644 | 644 | /** |
@@ -648,11 +648,11 @@ discard block |
||
| 648 | 648 | * @return void |
| 649 | 649 | */ |
| 650 | 650 | function lsx_health_plan_day_button() { |
| 651 | - if ( lsx_health_plan_is_day_complete() ) { |
|
| 652 | - lsx_health_plan_unlock_button(); |
|
| 653 | - } else { |
|
| 654 | - lsx_health_plan_complete_button(); |
|
| 655 | - } |
|
| 651 | + if ( lsx_health_plan_is_day_complete() ) { |
|
| 652 | + lsx_health_plan_unlock_button(); |
|
| 653 | + } else { |
|
| 654 | + lsx_health_plan_complete_button(); |
|
| 655 | + } |
|
| 656 | 656 | } |
| 657 | 657 | |
| 658 | 658 | /** |
@@ -661,7 +661,7 @@ discard block |
||
| 661 | 661 | * @return void |
| 662 | 662 | */ |
| 663 | 663 | function lsx_health_plan_complete_button() { |
| 664 | - ?> |
|
| 664 | + ?> |
|
| 665 | 665 | <div class="single-plan-inner-buttons"> |
| 666 | 666 | <form action="<?php the_permalink(); ?>" method="post" class="form-complete-day complete-plan-btn"> |
| 667 | 667 | <?php wp_nonce_field( 'complete', 'lsx-health-plan-actions' ); ?> |
@@ -679,7 +679,7 @@ discard block |
||
| 679 | 679 | * @return void |
| 680 | 680 | */ |
| 681 | 681 | function lsx_health_plan_unlock_button() { |
| 682 | - ?> |
|
| 682 | + ?> |
|
| 683 | 683 | <div class="single-plan-inner-buttons"> |
| 684 | 684 | <form action="<?php the_permalink(); ?>" method="post" class="form-complete-day complete-plan-btn"> |
| 685 | 685 | <?php wp_nonce_field( 'unlock', 'lsx-health-plan-actions' ); ?> |
@@ -698,10 +698,10 @@ discard block |
||
| 698 | 698 | * @return void |
| 699 | 699 | */ |
| 700 | 700 | function lsx_health_plan_single_nav() { |
| 701 | - $tab_template_path = apply_filters( 'lsx_health_plan_single_nav_path', LSX_HEALTH_PLAN_PATH . '/templates/single-plan-tabs.php' ); |
|
| 702 | - if ( '' !== $tab_template_path ) { |
|
| 703 | - require $tab_template_path; |
|
| 704 | - } |
|
| 701 | + $tab_template_path = apply_filters( 'lsx_health_plan_single_nav_path', LSX_HEALTH_PLAN_PATH . '/templates/single-plan-tabs.php' ); |
|
| 702 | + if ( '' !== $tab_template_path ) { |
|
| 703 | + require $tab_template_path; |
|
| 704 | + } |
|
| 705 | 705 | } |
| 706 | 706 | |
| 707 | 707 | /** |
@@ -711,32 +711,32 @@ discard block |
||
| 711 | 711 | * @return void |
| 712 | 712 | */ |
| 713 | 713 | function lsx_health_plan_single_tabs() { |
| 714 | - $endpoint = get_query_var( 'endpoint' ); |
|
| 715 | - switch ( $endpoint ) { |
|
| 716 | - case 'meal': |
|
| 717 | - $tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-meal.php'; |
|
| 718 | - break; |
|
| 719 | - |
|
| 720 | - case 'recipes': |
|
| 721 | - $tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-recipes.php'; |
|
| 722 | - break; |
|
| 723 | - |
|
| 724 | - case 'workout': |
|
| 725 | - $tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-workout.php'; |
|
| 726 | - break; |
|
| 727 | - |
|
| 728 | - case 'warm-up': |
|
| 729 | - $tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-warm-up.php'; |
|
| 730 | - break; |
|
| 731 | - |
|
| 732 | - default: |
|
| 733 | - $tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-plan.php'; |
|
| 734 | - break; |
|
| 735 | - } |
|
| 736 | - $tab_template_path = apply_filters( 'lsx_health_plan_single_tab_path', $tab_template_path ); |
|
| 737 | - if ( '' !== $tab_template_path ) { |
|
| 738 | - include $tab_template_path; |
|
| 739 | - } |
|
| 714 | + $endpoint = get_query_var( 'endpoint' ); |
|
| 715 | + switch ( $endpoint ) { |
|
| 716 | + case 'meal': |
|
| 717 | + $tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-meal.php'; |
|
| 718 | + break; |
|
| 719 | + |
|
| 720 | + case 'recipes': |
|
| 721 | + $tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-recipes.php'; |
|
| 722 | + break; |
|
| 723 | + |
|
| 724 | + case 'workout': |
|
| 725 | + $tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-workout.php'; |
|
| 726 | + break; |
|
| 727 | + |
|
| 728 | + case 'warm-up': |
|
| 729 | + $tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-warm-up.php'; |
|
| 730 | + break; |
|
| 731 | + |
|
| 732 | + default: |
|
| 733 | + $tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-plan.php'; |
|
| 734 | + break; |
|
| 735 | + } |
|
| 736 | + $tab_template_path = apply_filters( 'lsx_health_plan_single_tab_path', $tab_template_path ); |
|
| 737 | + if ( '' !== $tab_template_path ) { |
|
| 738 | + include $tab_template_path; |
|
| 739 | + } |
|
| 740 | 740 | } |
| 741 | 741 | |
| 742 | 742 | /** |
@@ -745,7 +745,7 @@ discard block |
||
| 745 | 745 | * @return void |
| 746 | 746 | */ |
| 747 | 747 | function lsx_health_plan_recipe_data() { |
| 748 | - include LSX_HEALTH_PLAN_PATH . '/templates/table-recipe-data.php'; |
|
| 748 | + include LSX_HEALTH_PLAN_PATH . '/templates/table-recipe-data.php'; |
|
| 749 | 749 | } |
| 750 | 750 | |
| 751 | 751 | /** |
@@ -754,11 +754,11 @@ discard block |
||
| 754 | 754 | * @return recipe_type |
| 755 | 755 | */ |
| 756 | 756 | function lsx_health_plan_recipe_type() { |
| 757 | - $term_obj_list = get_the_terms( get_the_ID(), 'recipe-type' ); |
|
| 758 | - $recipe_type = $term_obj_list[0]->name; |
|
| 759 | - if ( ! empty( $recipe_type ) ) { |
|
| 760 | - return $recipe_type; |
|
| 761 | - } |
|
| 757 | + $term_obj_list = get_the_terms( get_the_ID(), 'recipe-type' ); |
|
| 758 | + $recipe_type = $term_obj_list[0]->name; |
|
| 759 | + if ( ! empty( $recipe_type ) ) { |
|
| 760 | + return $recipe_type; |
|
| 761 | + } |
|
| 762 | 762 | } |
| 763 | 763 | |
| 764 | 764 | /** |
@@ -769,35 +769,35 @@ discard block |
||
| 769 | 769 | * @return void |
| 770 | 770 | */ |
| 771 | 771 | function lsx_health_plan_workout_video_play_button( $m, $group, $echo = true ) { |
| 772 | - $workout_video = ''; |
|
| 773 | - $giphy = ''; |
|
| 774 | - $youtube = ''; |
|
| 775 | - if ( isset( $group['connected_videos'] ) && '' !== $group['connected_videos'] ) { |
|
| 776 | - $workout_video = esc_html( $group['connected_videos'] ); |
|
| 777 | - $giphy = get_post_meta( $workout_video, 'video_giphy_source', true ); |
|
| 778 | - $youtube = esc_url( get_post_meta( $workout_video, 'video_youtube_source', 1 ) ); |
|
| 779 | - $content = get_post_field( 'post_content', $workout_video ); |
|
| 780 | - $play_button = '<button data-toggle="modal" data-target="#workout-video-modal-' . $m . '"><span class="fa fa-play-circle"></span></button>'; |
|
| 781 | - |
|
| 782 | - $modal_body = ''; |
|
| 783 | - if ( ! empty( $giphy ) ) { |
|
| 784 | - $giphy = \lsx_health_plan\functions\get_video_url( $giphy ); |
|
| 785 | - $modal_body = $giphy; // WPCS: XSS OK. |
|
| 786 | - } elseif ( ! empty( $youtube ) ) { |
|
| 787 | - $modal_body = wp_oembed_get( $youtube, array( // WPCS: XSS OK. |
|
| 788 | - 'width' => 480, |
|
| 789 | - ) ); |
|
| 790 | - } |
|
| 791 | - $modal_body .= '<h5 class="modal-title title-lined">' . $group['name'] . '</h5>'; |
|
| 792 | - $modal_body .= $content; |
|
| 793 | - \lsx_health_plan\functions\register_modal( 'workout-video-modal-' . $m, '', $modal_body ); |
|
| 794 | - |
|
| 795 | - if ( true === $echo ) { |
|
| 796 | - echo wp_kses_post( $play_button ); |
|
| 797 | - } else { |
|
| 798 | - return $play_button; |
|
| 799 | - } |
|
| 800 | - } |
|
| 772 | + $workout_video = ''; |
|
| 773 | + $giphy = ''; |
|
| 774 | + $youtube = ''; |
|
| 775 | + if ( isset( $group['connected_videos'] ) && '' !== $group['connected_videos'] ) { |
|
| 776 | + $workout_video = esc_html( $group['connected_videos'] ); |
|
| 777 | + $giphy = get_post_meta( $workout_video, 'video_giphy_source', true ); |
|
| 778 | + $youtube = esc_url( get_post_meta( $workout_video, 'video_youtube_source', 1 ) ); |
|
| 779 | + $content = get_post_field( 'post_content', $workout_video ); |
|
| 780 | + $play_button = '<button data-toggle="modal" data-target="#workout-video-modal-' . $m . '"><span class="fa fa-play-circle"></span></button>'; |
|
| 781 | + |
|
| 782 | + $modal_body = ''; |
|
| 783 | + if ( ! empty( $giphy ) ) { |
|
| 784 | + $giphy = \lsx_health_plan\functions\get_video_url( $giphy ); |
|
| 785 | + $modal_body = $giphy; // WPCS: XSS OK. |
|
| 786 | + } elseif ( ! empty( $youtube ) ) { |
|
| 787 | + $modal_body = wp_oembed_get( $youtube, array( // WPCS: XSS OK. |
|
| 788 | + 'width' => 480, |
|
| 789 | + ) ); |
|
| 790 | + } |
|
| 791 | + $modal_body .= '<h5 class="modal-title title-lined">' . $group['name'] . '</h5>'; |
|
| 792 | + $modal_body .= $content; |
|
| 793 | + \lsx_health_plan\functions\register_modal( 'workout-video-modal-' . $m, '', $modal_body ); |
|
| 794 | + |
|
| 795 | + if ( true === $echo ) { |
|
| 796 | + echo wp_kses_post( $play_button ); |
|
| 797 | + } else { |
|
| 798 | + return $play_button; |
|
| 799 | + } |
|
| 800 | + } |
|
| 801 | 801 | } |
| 802 | 802 | |
| 803 | 803 | /** |
@@ -806,21 +806,21 @@ discard block |
||
| 806 | 806 | * @return void |
| 807 | 807 | */ |
| 808 | 808 | function lsx_health_plan_recipe_archive_description() { |
| 809 | - $description = ''; |
|
| 810 | - if ( is_post_type_archive( 'recipe' ) ) { |
|
| 811 | - $description = \lsx_health_plan\functions\get_option( 'recipe_archive_description', '' ); |
|
| 812 | - } elseif ( is_post_type_archive( 'exercise' ) ) { |
|
| 813 | - $description = \lsx_health_plan\functions\get_option( 'exercise_archive_description', '' ); |
|
| 814 | - } elseif ( is_tax() ) { |
|
| 815 | - $description = get_the_archive_description(); |
|
| 816 | - } |
|
| 817 | - if ( '' !== $description ) { |
|
| 818 | - ?> |
|
| 809 | + $description = ''; |
|
| 810 | + if ( is_post_type_archive( 'recipe' ) ) { |
|
| 811 | + $description = \lsx_health_plan\functions\get_option( 'recipe_archive_description', '' ); |
|
| 812 | + } elseif ( is_post_type_archive( 'exercise' ) ) { |
|
| 813 | + $description = \lsx_health_plan\functions\get_option( 'exercise_archive_description', '' ); |
|
| 814 | + } elseif ( is_tax() ) { |
|
| 815 | + $description = get_the_archive_description(); |
|
| 816 | + } |
|
| 817 | + if ( '' !== $description ) { |
|
| 818 | + ?> |
|
| 819 | 819 | <div class="lsx-hp-archive-description row"> |
| 820 | 820 | <div class="col-xs-12 description-wrapper"><?php echo wp_kses_post( wpautop( $description ) ); ?></div> |
| 821 | 821 | </div> |
| 822 | 822 | <?php |
| 823 | - } |
|
| 823 | + } |
|
| 824 | 824 | } |
| 825 | 825 | |
| 826 | 826 | /** |
@@ -829,23 +829,23 @@ discard block |
||
| 829 | 829 | * @return void |
| 830 | 830 | */ |
| 831 | 831 | function lsx_health_plan_workout_main_content() { |
| 832 | - // Getting translated endpoint. |
|
| 833 | - $workout = \lsx_health_plan\functions\get_option( 'endpoint_workout', 'workout' ); |
|
| 834 | - |
|
| 835 | - $connected_members = get_post_meta( get_the_ID(), ( $workout . '_connected_team_member' ), true ); |
|
| 836 | - $small_description = get_post_meta( get_the_ID(), ( $workout . '_short_description' ), true ); |
|
| 837 | - |
|
| 838 | - $content = ''; |
|
| 839 | - if ( $small_description || $connected_members || lsx_health_plan_has_tips() ) { |
|
| 840 | - $content .= '<div class="set-box set content-box entry-content">'; |
|
| 841 | - $content .= '<div class="the-content">'; |
|
| 842 | - $content .= lsx_hp_member_connected( $connected_members, $workout ); |
|
| 843 | - $content .= '<span>' . $small_description . '</span>'; |
|
| 844 | - $content .= '</div>'; |
|
| 845 | - $content .= do_shortcode( '[lsx_health_plan_featured_tips_block]' ); |
|
| 846 | - $content .= '</div>'; |
|
| 847 | - } |
|
| 848 | - return $content; |
|
| 832 | + // Getting translated endpoint. |
|
| 833 | + $workout = \lsx_health_plan\functions\get_option( 'endpoint_workout', 'workout' ); |
|
| 834 | + |
|
| 835 | + $connected_members = get_post_meta( get_the_ID(), ( $workout . '_connected_team_member' ), true ); |
|
| 836 | + $small_description = get_post_meta( get_the_ID(), ( $workout . '_short_description' ), true ); |
|
| 837 | + |
|
| 838 | + $content = ''; |
|
| 839 | + if ( $small_description || $connected_members || lsx_health_plan_has_tips() ) { |
|
| 840 | + $content .= '<div class="set-box set content-box entry-content">'; |
|
| 841 | + $content .= '<div class="the-content">'; |
|
| 842 | + $content .= lsx_hp_member_connected( $connected_members, $workout ); |
|
| 843 | + $content .= '<span>' . $small_description . '</span>'; |
|
| 844 | + $content .= '</div>'; |
|
| 845 | + $content .= do_shortcode( '[lsx_health_plan_featured_tips_block]' ); |
|
| 846 | + $content .= '</div>'; |
|
| 847 | + } |
|
| 848 | + return $content; |
|
| 849 | 849 | } |
| 850 | 850 | |
| 851 | 851 | /** |
@@ -854,23 +854,23 @@ discard block |
||
| 854 | 854 | * @return void |
| 855 | 855 | */ |
| 856 | 856 | function lsx_health_plan_meal_main_content() { |
| 857 | - // Getting translated endpoint. |
|
| 858 | - $meal = \lsx_health_plan\functions\get_option( 'endpoint_meal', 'meal' ); |
|
| 859 | - |
|
| 860 | - $connected_members = get_post_meta( get_the_ID(), ( $meal . '_connected_team_member' ), true ); |
|
| 861 | - $small_description = get_post_meta( get_the_ID(), ( $meal . '_short_description' ), true ); |
|
| 862 | - |
|
| 863 | - $content_meal = ''; |
|
| 864 | - if ( $small_description || $connected_members || lsx_health_plan_has_tips() ) { |
|
| 865 | - $content_meal .= '<div class="set-box set content-box entry-content">'; |
|
| 866 | - $content_meal .= '<div class="the-content">'; |
|
| 867 | - $content_meal .= lsx_hp_member_connected( $connected_members, $meal ); |
|
| 868 | - $content_meal .= '<span>' . $small_description . '</span>'; |
|
| 869 | - $content_meal .= '</div>'; |
|
| 870 | - $content_meal .= do_shortcode( '[lsx_health_plan_featured_tips_block]' ); |
|
| 871 | - $content_meal .= '</div>'; |
|
| 872 | - } |
|
| 873 | - return $content_meal; |
|
| 857 | + // Getting translated endpoint. |
|
| 858 | + $meal = \lsx_health_plan\functions\get_option( 'endpoint_meal', 'meal' ); |
|
| 859 | + |
|
| 860 | + $connected_members = get_post_meta( get_the_ID(), ( $meal . '_connected_team_member' ), true ); |
|
| 861 | + $small_description = get_post_meta( get_the_ID(), ( $meal . '_short_description' ), true ); |
|
| 862 | + |
|
| 863 | + $content_meal = ''; |
|
| 864 | + if ( $small_description || $connected_members || lsx_health_plan_has_tips() ) { |
|
| 865 | + $content_meal .= '<div class="set-box set content-box entry-content">'; |
|
| 866 | + $content_meal .= '<div class="the-content">'; |
|
| 867 | + $content_meal .= lsx_hp_member_connected( $connected_members, $meal ); |
|
| 868 | + $content_meal .= '<span>' . $small_description . '</span>'; |
|
| 869 | + $content_meal .= '</div>'; |
|
| 870 | + $content_meal .= do_shortcode( '[lsx_health_plan_featured_tips_block]' ); |
|
| 871 | + $content_meal .= '</div>'; |
|
| 872 | + } |
|
| 873 | + return $content_meal; |
|
| 874 | 874 | } |
| 875 | 875 | |
| 876 | 876 | |
@@ -881,36 +881,36 @@ discard block |
||
| 881 | 881 | * @return void |
| 882 | 882 | */ |
| 883 | 883 | function lsx_health_plan_workout_tab_content( $index = 1 ) { |
| 884 | - global $group_name,$shortcode_args; |
|
| 885 | - $group_name = 'workout_section_' . $index; |
|
| 886 | - if ( false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) { |
|
| 887 | - $layout = strtolower( \lsx_health_plan\functions\get_option( 'workout_tab_layout', 'table' ) ); |
|
| 888 | - |
|
| 889 | - // Check for shortcode overrides. |
|
| 890 | - if ( null !== $shortcode_args && isset( $shortcode_args['layout'] ) ) { |
|
| 891 | - $layout = $shortcode_args['layout']; |
|
| 892 | - } |
|
| 893 | - } else { |
|
| 894 | - $layout = 'table'; |
|
| 895 | - } |
|
| 896 | - |
|
| 897 | - switch ( $layout ) { |
|
| 898 | - case 'list': |
|
| 899 | - $tab_template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-list.php'; |
|
| 900 | - break; |
|
| 901 | - |
|
| 902 | - case 'grid': |
|
| 903 | - $tab_template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-grid.php'; |
|
| 904 | - break; |
|
| 905 | - |
|
| 906 | - case 'table': |
|
| 907 | - $tab_template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-table.php'; |
|
| 908 | - break; |
|
| 909 | - } |
|
| 910 | - $tab_template_path = apply_filters( 'lsx_health_plan_workout_tab_content_path', $tab_template_path ); |
|
| 911 | - if ( '' !== $tab_template_path ) { |
|
| 912 | - include $tab_template_path; |
|
| 913 | - } |
|
| 884 | + global $group_name,$shortcode_args; |
|
| 885 | + $group_name = 'workout_section_' . $index; |
|
| 886 | + if ( false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) { |
|
| 887 | + $layout = strtolower( \lsx_health_plan\functions\get_option( 'workout_tab_layout', 'table' ) ); |
|
| 888 | + |
|
| 889 | + // Check for shortcode overrides. |
|
| 890 | + if ( null !== $shortcode_args && isset( $shortcode_args['layout'] ) ) { |
|
| 891 | + $layout = $shortcode_args['layout']; |
|
| 892 | + } |
|
| 893 | + } else { |
|
| 894 | + $layout = 'table'; |
|
| 895 | + } |
|
| 896 | + |
|
| 897 | + switch ( $layout ) { |
|
| 898 | + case 'list': |
|
| 899 | + $tab_template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-list.php'; |
|
| 900 | + break; |
|
| 901 | + |
|
| 902 | + case 'grid': |
|
| 903 | + $tab_template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-grid.php'; |
|
| 904 | + break; |
|
| 905 | + |
|
| 906 | + case 'table': |
|
| 907 | + $tab_template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-table.php'; |
|
| 908 | + break; |
|
| 909 | + } |
|
| 910 | + $tab_template_path = apply_filters( 'lsx_health_plan_workout_tab_content_path', $tab_template_path ); |
|
| 911 | + if ( '' !== $tab_template_path ) { |
|
| 912 | + include $tab_template_path; |
|
| 913 | + } |
|
| 914 | 914 | } |
| 915 | 915 | |
| 916 | 916 | /** |
@@ -919,28 +919,28 @@ discard block |
||
| 919 | 919 | * @return void |
| 920 | 920 | */ |
| 921 | 921 | function lsx_health_plan_workout_sets() { |
| 922 | - if ( is_singular( 'workout' ) ) { |
|
| 923 | - global $connected_workouts; |
|
| 924 | - $connected_workouts = array( get_the_ID() ); |
|
| 925 | - } |
|
| 926 | - if ( is_singular( 'plan' ) ) { |
|
| 927 | - |
|
| 928 | - global $connected_workouts; |
|
| 929 | - |
|
| 930 | - $section_key = get_query_var( 'section' ); |
|
| 931 | - if ( '' !== $section && \lsx_health_plan\functions\plan\has_sections() ) { |
|
| 932 | - $section_info = \lsx_health_plan\functions\plan\get_section_info( $section_key ); |
|
| 933 | - if ( isset( $section_info['connected_workouts'] ) && '' !== $section_info['connected_workouts'] ) { |
|
| 934 | - |
|
| 935 | - $connected_workouts = \lsx_health_plan\functions\prep_array( $section_info['connected_workouts'] ); |
|
| 936 | - } |
|
| 937 | - } |
|
| 938 | - } |
|
| 939 | - $template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-sets.php'; |
|
| 940 | - $template_path = apply_filters( 'lsx_health_plan_workout_set_template_path', $template_path ); |
|
| 941 | - if ( '' !== $template_path && ! empty( $template_path ) ) { |
|
| 942 | - include $template_path; |
|
| 943 | - } |
|
| 922 | + if ( is_singular( 'workout' ) ) { |
|
| 923 | + global $connected_workouts; |
|
| 924 | + $connected_workouts = array( get_the_ID() ); |
|
| 925 | + } |
|
| 926 | + if ( is_singular( 'plan' ) ) { |
|
| 927 | + |
|
| 928 | + global $connected_workouts; |
|
| 929 | + |
|
| 930 | + $section_key = get_query_var( 'section' ); |
|
| 931 | + if ( '' !== $section && \lsx_health_plan\functions\plan\has_sections() ) { |
|
| 932 | + $section_info = \lsx_health_plan\functions\plan\get_section_info( $section_key ); |
|
| 933 | + if ( isset( $section_info['connected_workouts'] ) && '' !== $section_info['connected_workouts'] ) { |
|
| 934 | + |
|
| 935 | + $connected_workouts = \lsx_health_plan\functions\prep_array( $section_info['connected_workouts'] ); |
|
| 936 | + } |
|
| 937 | + } |
|
| 938 | + } |
|
| 939 | + $template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-sets.php'; |
|
| 940 | + $template_path = apply_filters( 'lsx_health_plan_workout_set_template_path', $template_path ); |
|
| 941 | + if ( '' !== $template_path && ! empty( $template_path ) ) { |
|
| 942 | + include $template_path; |
|
| 943 | + } |
|
| 944 | 944 | } |
| 945 | 945 | |
| 946 | 946 | /** |
@@ -950,48 +950,48 @@ discard block |
||
| 950 | 950 | * @return void |
| 951 | 951 | */ |
| 952 | 952 | function lsx_hp_meal_plan_recipes( $args = array() ) { |
| 953 | - $defaults = array( |
|
| 954 | - 'meal_id' => false, |
|
| 955 | - 'meal_time' => '', |
|
| 956 | - 'modal' => true, |
|
| 957 | - ); |
|
| 958 | - $args = wp_parse_args( $args, $defaults ); |
|
| 959 | - // Looking for recipes. |
|
| 960 | - $connected_recipes = get_post_meta( $args['meal_id'], $args['meal_time'] . '_recipes', true ); |
|
| 961 | - if ( ! empty( $connected_recipes ) ) { |
|
| 962 | - $query_args = array( |
|
| 963 | - 'orderby' => 'date', |
|
| 964 | - 'order' => 'DESC', |
|
| 965 | - 'post_type' => 'recipe', |
|
| 966 | - 'post__in' => $connected_recipes, |
|
| 967 | - ); |
|
| 968 | - $recipes = new WP_Query( $query_args ); |
|
| 969 | - ?> |
|
| 953 | + $defaults = array( |
|
| 954 | + 'meal_id' => false, |
|
| 955 | + 'meal_time' => '', |
|
| 956 | + 'modal' => true, |
|
| 957 | + ); |
|
| 958 | + $args = wp_parse_args( $args, $defaults ); |
|
| 959 | + // Looking for recipes. |
|
| 960 | + $connected_recipes = get_post_meta( $args['meal_id'], $args['meal_time'] . '_recipes', true ); |
|
| 961 | + if ( ! empty( $connected_recipes ) ) { |
|
| 962 | + $query_args = array( |
|
| 963 | + 'orderby' => 'date', |
|
| 964 | + 'order' => 'DESC', |
|
| 965 | + 'post_type' => 'recipe', |
|
| 966 | + 'post__in' => $connected_recipes, |
|
| 967 | + ); |
|
| 968 | + $recipes = new WP_Query( $query_args ); |
|
| 969 | + ?> |
|
| 970 | 970 | <div class="recipes"> |
| 971 | 971 | <div class="row eating-row"> |
| 972 | 972 | <?php |
| 973 | - if ( $recipes->have_posts() ) { |
|
| 974 | - while ( $recipes->have_posts() ) { |
|
| 975 | - $recipes->the_post(); |
|
| 976 | - if ( false !== $args['modal'] ) { |
|
| 977 | - \lsx_health_plan\functions\recipes\register_recipe_modal(); |
|
| 978 | - } |
|
| 979 | - ?> |
|
| 973 | + if ( $recipes->have_posts() ) { |
|
| 974 | + while ( $recipes->have_posts() ) { |
|
| 975 | + $recipes->the_post(); |
|
| 976 | + if ( false !== $args['modal'] ) { |
|
| 977 | + \lsx_health_plan\functions\recipes\register_recipe_modal(); |
|
| 978 | + } |
|
| 979 | + ?> |
|
| 980 | 980 | <div class="recipe-column"> |
| 981 | 981 | <a data-toggle="modal" data-target="#recipe-modal-<?php echo esc_attr( get_the_ID() ); ?>" href="#recipe-modal-<?php echo esc_attr( get_the_ID() ); ?>" class="recipe-box box-shadow"> |
| 982 | 982 | <div class="recipe-feature-img"> |
| 983 | 983 | <?php |
| 984 | - $featured_image = get_the_post_thumbnail(); |
|
| 985 | - if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
| 986 | - the_post_thumbnail( 'lsx-thumbnail-square', array( |
|
| 987 | - 'class' => 'aligncenter', |
|
| 988 | - ) ); |
|
| 989 | - } else { |
|
| 990 | - ?> |
|
| 984 | + $featured_image = get_the_post_thumbnail(); |
|
| 985 | + if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
| 986 | + the_post_thumbnail( 'lsx-thumbnail-square', array( |
|
| 987 | + 'class' => 'aligncenter', |
|
| 988 | + ) ); |
|
| 989 | + } else { |
|
| 990 | + ?> |
|
| 991 | 991 | <img loading="lazy" class="placeholder" src="<?php echo esc_attr( plugin_dir_url( __DIR__ ) . 'assets/images/placeholder.jpg' ); ?>"> |
| 992 | 992 | <?php |
| 993 | - } |
|
| 994 | - ?> |
|
| 993 | + } |
|
| 994 | + ?> |
|
| 995 | 995 | </div> |
| 996 | 996 | <div class="recipe-content"> |
| 997 | 997 | <h3 class="recipe-title"><?php the_title(); ?></h3> |
@@ -1000,41 +1000,41 @@ discard block |
||
| 1000 | 1000 | </a> |
| 1001 | 1001 | </div> |
| 1002 | 1002 | <?php |
| 1003 | - } |
|
| 1004 | - } |
|
| 1005 | - wp_reset_postdata(); |
|
| 1006 | - ?> |
|
| 1003 | + } |
|
| 1004 | + } |
|
| 1005 | + wp_reset_postdata(); |
|
| 1006 | + ?> |
|
| 1007 | 1007 | </div> |
| 1008 | 1008 | </div> |
| 1009 | 1009 | <?php |
| 1010 | 1010 | |
| 1011 | - } |
|
| 1011 | + } |
|
| 1012 | 1012 | } |
| 1013 | 1013 | |
| 1014 | 1014 | /** |
| 1015 | 1015 | * Output the connected. |
| 1016 | 1016 | */ |
| 1017 | 1017 | function lsx_hp_recipe_plan_meta( $args = array() ) { |
| 1018 | - $defaults = array(); |
|
| 1019 | - $top_level_plans = array(); |
|
| 1020 | - // Get meals this exercise is connected to. |
|
| 1021 | - $plans = get_post_meta( get_the_ID(), 'connected_plans', true ); |
|
| 1022 | - if ( ! empty( $plans ) ) { |
|
| 1023 | - $plan = end( $plans ); |
|
| 1024 | - $has_parent = wp_get_post_parent_id( $plan ); |
|
| 1025 | - if ( 0 === $has_parent ) { |
|
| 1026 | - $top_level_plans[] = $plan; |
|
| 1027 | - } elseif ( false !== $top_level_plans ) { |
|
| 1028 | - $top_level_plans[] = $has_parent; |
|
| 1029 | - } |
|
| 1030 | - } |
|
| 1031 | - if ( ! empty( $top_level_plans ) && ( '' !== $top_level_plans ) ) { |
|
| 1032 | - $top_level_plans = array_unique( $top_level_plans ); |
|
| 1033 | - $top_level_plan = end( $top_level_plans ); |
|
| 1034 | - ?> |
|
| 1018 | + $defaults = array(); |
|
| 1019 | + $top_level_plans = array(); |
|
| 1020 | + // Get meals this exercise is connected to. |
|
| 1021 | + $plans = get_post_meta( get_the_ID(), 'connected_plans', true ); |
|
| 1022 | + if ( ! empty( $plans ) ) { |
|
| 1023 | + $plan = end( $plans ); |
|
| 1024 | + $has_parent = wp_get_post_parent_id( $plan ); |
|
| 1025 | + if ( 0 === $has_parent ) { |
|
| 1026 | + $top_level_plans[] = $plan; |
|
| 1027 | + } elseif ( false !== $top_level_plans ) { |
|
| 1028 | + $top_level_plans[] = $has_parent; |
|
| 1029 | + } |
|
| 1030 | + } |
|
| 1031 | + if ( ! empty( $top_level_plans ) && ( '' !== $top_level_plans ) ) { |
|
| 1032 | + $top_level_plans = array_unique( $top_level_plans ); |
|
| 1033 | + $top_level_plan = end( $top_level_plans ); |
|
| 1034 | + ?> |
|
| 1035 | 1035 | <span class="recipe-type recipe-parent"><?php echo esc_html( get_the_title( $top_level_plan ) ); ?></span> |
| 1036 | 1036 | <?php |
| 1037 | - } |
|
| 1037 | + } |
|
| 1038 | 1038 | } |
| 1039 | 1039 | |
| 1040 | 1040 | /** |
@@ -1042,42 +1042,42 @@ discard block |
||
| 1042 | 1042 | */ |
| 1043 | 1043 | function lsx_hp_exercise_plan_meta() { |
| 1044 | 1044 | |
| 1045 | - $top_level_plans = array(); |
|
| 1046 | - |
|
| 1047 | - // Get workouts this exercise is connected to. |
|
| 1048 | - $workouts = get_post_meta( get_the_ID(), 'connected_workouts', true ); |
|
| 1049 | - |
|
| 1050 | - if ( '' !== $workouts && ! is_array( $workouts ) ) { |
|
| 1051 | - $workouts = array( $workouts ); |
|
| 1052 | - } |
|
| 1053 | - if ( ! empty( $workouts ) ) { |
|
| 1054 | - foreach ( $workouts as $workout ) { |
|
| 1055 | - // Get the plans this workout is connected to. |
|
| 1056 | - $plans = get_post_meta( $workout, 'connected_plans', true ); |
|
| 1057 | - |
|
| 1058 | - if ( '' !== $plans && ! is_array( $plans ) ) { |
|
| 1059 | - $plans = array( $plans ); |
|
| 1060 | - } |
|
| 1061 | - if ( ! empty( $plans ) ) { |
|
| 1062 | - foreach ( $plans as $plan ) { |
|
| 1063 | - $has_parent = wp_get_post_parent_id( $plan ); |
|
| 1064 | - if ( 0 === $has_parent ) { |
|
| 1065 | - $top_level_plans = $plan; |
|
| 1066 | - } else { |
|
| 1067 | - $top_level_plans = $has_parent; |
|
| 1068 | - } |
|
| 1069 | - } |
|
| 1070 | - } |
|
| 1071 | - } |
|
| 1072 | - } |
|
| 1073 | - |
|
| 1074 | - if ( ! empty( $top_level_plans ) && ( '' !== $top_level_plans ) ) { |
|
| 1075 | - $top_level_plans = array_unique( $top_level_plans ); |
|
| 1076 | - $top_level_plan = end( $top_level_plans ); |
|
| 1077 | - ?> |
|
| 1045 | + $top_level_plans = array(); |
|
| 1046 | + |
|
| 1047 | + // Get workouts this exercise is connected to. |
|
| 1048 | + $workouts = get_post_meta( get_the_ID(), 'connected_workouts', true ); |
|
| 1049 | + |
|
| 1050 | + if ( '' !== $workouts && ! is_array( $workouts ) ) { |
|
| 1051 | + $workouts = array( $workouts ); |
|
| 1052 | + } |
|
| 1053 | + if ( ! empty( $workouts ) ) { |
|
| 1054 | + foreach ( $workouts as $workout ) { |
|
| 1055 | + // Get the plans this workout is connected to. |
|
| 1056 | + $plans = get_post_meta( $workout, 'connected_plans', true ); |
|
| 1057 | + |
|
| 1058 | + if ( '' !== $plans && ! is_array( $plans ) ) { |
|
| 1059 | + $plans = array( $plans ); |
|
| 1060 | + } |
|
| 1061 | + if ( ! empty( $plans ) ) { |
|
| 1062 | + foreach ( $plans as $plan ) { |
|
| 1063 | + $has_parent = wp_get_post_parent_id( $plan ); |
|
| 1064 | + if ( 0 === $has_parent ) { |
|
| 1065 | + $top_level_plans = $plan; |
|
| 1066 | + } else { |
|
| 1067 | + $top_level_plans = $has_parent; |
|
| 1068 | + } |
|
| 1069 | + } |
|
| 1070 | + } |
|
| 1071 | + } |
|
| 1072 | + } |
|
| 1073 | + |
|
| 1074 | + if ( ! empty( $top_level_plans ) && ( '' !== $top_level_plans ) ) { |
|
| 1075 | + $top_level_plans = array_unique( $top_level_plans ); |
|
| 1076 | + $top_level_plan = end( $top_level_plans ); |
|
| 1077 | + ?> |
|
| 1078 | 1078 | <span class="recipe-type recipe-parent"><?php echo esc_html( get_the_title( $top_level_plan ) ); ?></span> |
| 1079 | 1079 | <?php |
| 1080 | - } |
|
| 1080 | + } |
|
| 1081 | 1081 | } |
| 1082 | 1082 | |
| 1083 | 1083 | /** |
@@ -1087,7 +1087,7 @@ discard block |
||
| 1087 | 1087 | * @return void |
| 1088 | 1088 | */ |
| 1089 | 1089 | function lsx_hp_single_related( $related_content, $post_type_text ) { |
| 1090 | - ?> |
|
| 1090 | + ?> |
|
| 1091 | 1091 | <section id="lsx-hp-related"> |
| 1092 | 1092 | <div class="row lsx-related-posts lsx-related-posts-title"> |
| 1093 | 1093 | <div class="col-xs-12"> |
@@ -1098,14 +1098,14 @@ discard block |
||
| 1098 | 1098 | <div class="col-xs-12"> |
| 1099 | 1099 | <div class="lsx-related-posts-wrapper"> |
| 1100 | 1100 | <?php |
| 1101 | - $i = 0; |
|
| 1102 | - foreach ( $related_content as $article ) { |
|
| 1103 | - $post_title = get_the_title( $article ); |
|
| 1104 | - $post_categories = wp_get_post_categories( $article ); |
|
| 1105 | - $post_link = get_permalink( $article ); |
|
| 1106 | - |
|
| 1107 | - $cats = array(); |
|
| 1108 | - ?> |
|
| 1101 | + $i = 0; |
|
| 1102 | + foreach ( $related_content as $article ) { |
|
| 1103 | + $post_title = get_the_title( $article ); |
|
| 1104 | + $post_categories = wp_get_post_categories( $article ); |
|
| 1105 | + $post_link = get_permalink( $article ); |
|
| 1106 | + |
|
| 1107 | + $cats = array(); |
|
| 1108 | + ?> |
|
| 1109 | 1109 | <article id="post-<?php echo esc_html( $article ); ?>" class="lsx-slot post"> |
| 1110 | 1110 | <div class="entry-layout lsx-hp-shadow"> |
| 1111 | 1111 | <div class="entry-layout-content"> |
@@ -1113,25 +1113,25 @@ discard block |
||
| 1113 | 1113 | <div class="entry-image"> |
| 1114 | 1114 | <a href="<?php echo esc_url( $post_link ); ?>" class="thumbnail"> |
| 1115 | 1115 | <?php |
| 1116 | - $featured_image = get_the_post_thumbnail( $article, 'lsx-thumbnail-wide' ); |
|
| 1117 | - if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
| 1118 | - echo wp_kses_post( $featured_image ); |
|
| 1119 | - } else { |
|
| 1120 | - ?> |
|
| 1116 | + $featured_image = get_the_post_thumbnail( $article, 'lsx-thumbnail-wide' ); |
|
| 1117 | + if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
| 1118 | + echo wp_kses_post( $featured_image ); |
|
| 1119 | + } else { |
|
| 1120 | + ?> |
|
| 1121 | 1121 | <img loading="lazy" class="placeholder" src="<?php echo esc_attr( plugin_dir_url( __FILE__ ) . '../assets/images/placeholder.jpg' ); ?>"> |
| 1122 | 1122 | <?php |
| 1123 | - } |
|
| 1124 | - ?> |
|
| 1123 | + } |
|
| 1124 | + ?> |
|
| 1125 | 1125 | </a> |
| 1126 | 1126 | </div> |
| 1127 | 1127 | <div class="entry-meta"> |
| 1128 | 1128 | <?php |
| 1129 | - foreach ( $post_categories as $c ) { |
|
| 1130 | - $cat = get_category( $c ); |
|
| 1131 | - /* Translators: %s: category name */ |
|
| 1132 | - $cats[] = '<a href="' . esc_url( get_category_link( $cat->term_id ) ) . '" title="' . sprintf( esc_html__( 'Posts in %s', 'lsx-blog-customizer' ), $cat->name ) . '">' . $cat->name . '</a>'; |
|
| 1133 | - } |
|
| 1134 | - if ( ! empty( $cats ) ) { ?> |
|
| 1129 | + foreach ( $post_categories as $c ) { |
|
| 1130 | + $cat = get_category( $c ); |
|
| 1131 | + /* Translators: %s: category name */ |
|
| 1132 | + $cats[] = '<a href="' . esc_url( get_category_link( $cat->term_id ) ) . '" title="' . sprintf( esc_html__( 'Posts in %s', 'lsx-blog-customizer' ), $cat->name ) . '">' . $cat->name . '</a>'; |
|
| 1133 | + } |
|
| 1134 | + if ( ! empty( $cats ) ) { ?> |
|
| 1135 | 1135 | <div class="post-categories"><span></span><?php echo wp_kses_post( implode( ', ', $cats ) ); ?></div> |
| 1136 | 1136 | <?php } ?> |
| 1137 | 1137 | </div> |
@@ -1146,8 +1146,8 @@ discard block |
||
| 1146 | 1146 | </article> |
| 1147 | 1147 | |
| 1148 | 1148 | <?php |
| 1149 | - if (++$i === 3) break; |
|
| 1150 | - } ?> |
|
| 1149 | + if (++$i === 3) break; |
|
| 1150 | + } ?> |
|
| 1151 | 1151 | </div> |
| 1152 | 1152 | </div> |
| 1153 | 1153 | </div> |
@@ -1162,32 +1162,32 @@ discard block |
||
| 1162 | 1162 | * @return void |
| 1163 | 1163 | */ |
| 1164 | 1164 | function lsx_hp_member_connected( $connected_members, $post_type ) { |
| 1165 | - if ( ! empty( $connected_members ) ) { |
|
| 1166 | - $content = '<div id="hp-connected-members" class="hp-connected-members connected-' . $post_type . '">'; |
|
| 1167 | - foreach ( $connected_members as $member ) { |
|
| 1168 | - $post_link = get_permalink( $member ); |
|
| 1169 | - $member_name = get_the_title( $member ); |
|
| 1170 | - $member_name = '<span class="lsx-team-name">' . $member_name . '</span>'; |
|
| 1171 | - |
|
| 1172 | - $member_link = '<a href="' . $post_link . '" >' . $member_name . '</a>'; |
|
| 1173 | - |
|
| 1174 | - $roles = ''; |
|
| 1175 | - $terms = get_the_terms( $member, 'team_role' ); |
|
| 1176 | - |
|
| 1177 | - if ( $terms && ! is_wp_error( $terms ) ) { |
|
| 1178 | - $roles = array(); |
|
| 1179 | - |
|
| 1180 | - foreach ( $terms as $term ) { |
|
| 1181 | - $roles[] = $term->name; |
|
| 1182 | - } |
|
| 1183 | - |
|
| 1184 | - $roles = join( ', ', $roles ); |
|
| 1185 | - } |
|
| 1186 | - $member_roles = '' !== $roles ? "<small class='lsx-team-roles'>$roles</small>" : ''; |
|
| 1187 | - |
|
| 1188 | - $content .= '<p>' . $member_roles . ': ' . $member_link . '</p>'; |
|
| 1189 | - } |
|
| 1190 | - $content .= '</div>'; |
|
| 1191 | - return $content; |
|
| 1192 | - } |
|
| 1165 | + if ( ! empty( $connected_members ) ) { |
|
| 1166 | + $content = '<div id="hp-connected-members" class="hp-connected-members connected-' . $post_type . '">'; |
|
| 1167 | + foreach ( $connected_members as $member ) { |
|
| 1168 | + $post_link = get_permalink( $member ); |
|
| 1169 | + $member_name = get_the_title( $member ); |
|
| 1170 | + $member_name = '<span class="lsx-team-name">' . $member_name . '</span>'; |
|
| 1171 | + |
|
| 1172 | + $member_link = '<a href="' . $post_link . '" >' . $member_name . '</a>'; |
|
| 1173 | + |
|
| 1174 | + $roles = ''; |
|
| 1175 | + $terms = get_the_terms( $member, 'team_role' ); |
|
| 1176 | + |
|
| 1177 | + if ( $terms && ! is_wp_error( $terms ) ) { |
|
| 1178 | + $roles = array(); |
|
| 1179 | + |
|
| 1180 | + foreach ( $terms as $term ) { |
|
| 1181 | + $roles[] = $term->name; |
|
| 1182 | + } |
|
| 1183 | + |
|
| 1184 | + $roles = join( ', ', $roles ); |
|
| 1185 | + } |
|
| 1186 | + $member_roles = '' !== $roles ? "<small class='lsx-team-roles'>$roles</small>" : ''; |
|
| 1187 | + |
|
| 1188 | + $content .= '<p>' . $member_roles . ': ' . $member_link . '</p>'; |
|
| 1189 | + } |
|
| 1190 | + $content .= '</div>'; |
|
| 1191 | + return $content; |
|
| 1192 | + } |
|
| 1193 | 1193 | } |
@@ -14,23 +14,23 @@ discard block |
||
| 14 | 14 | ?> |
| 15 | 15 | <div class="col-md-4" > |
| 16 | 16 | <div class="lsx-health-plan-box"> |
| 17 | - <h3 class="title warm-up-title title-lined"><?php esc_html_e( 'Your Warm-up', 'lsx-health-plan' ); ?><?php lsx_get_svg_icon( 'warm.svg' ); ?></h3> |
|
| 17 | + <h3 class="title warm-up-title title-lined"><?php esc_html_e('Your Warm-up', 'lsx-health-plan'); ?><?php lsx_get_svg_icon('warm.svg'); ?></h3> |
|
| 18 | 18 | <div class="spacer"></div> |
| 19 | 19 | <?php |
| 20 | - $intro_text = \lsx_health_plan\functions\get_option( 'warmup_intro', false ); |
|
| 21 | - if ( false !== $intro_text ) { |
|
| 20 | + $intro_text = \lsx_health_plan\functions\get_option('warmup_intro', false); |
|
| 21 | + if (false !== $intro_text) { |
|
| 22 | 22 | ?> |
| 23 | 23 | <div class="excerpt"> |
| 24 | - <p><?php echo wp_kses_post( $intro_text ); ?></p> |
|
| 24 | + <p><?php echo wp_kses_post($intro_text); ?></p> |
|
| 25 | 25 | </div> |
| 26 | 26 | <?php |
| 27 | 27 | } |
| 28 | - $warm_up = \lsx_health_plan\functions\get_option( 'endpoint_warm_up', false ); |
|
| 29 | - if ( false === $warm_up ) { |
|
| 28 | + $warm_up = \lsx_health_plan\functions\get_option('endpoint_warm_up', false); |
|
| 29 | + if (false === $warm_up) { |
|
| 30 | 30 | $warm_up = 'warm-up'; |
| 31 | 31 | } |
| 32 | 32 | ?> |
| 33 | - <a href="<?php the_permalink(); ?><?php echo esc_attr( $warm_up ); ?>/" class="btn"><?php esc_html_e( 'Start your warm-up', 'lsx-health-plan' ); ?></a> |
|
| 33 | + <a href="<?php the_permalink(); ?><?php echo esc_attr($warm_up); ?>/" class="btn"><?php esc_html_e('Start your warm-up', 'lsx-health-plan'); ?></a> |
|
| 34 | 34 | </div> |
| 35 | 35 | </div> |
| 36 | 36 | <?php |
@@ -42,29 +42,29 @@ discard block |
||
| 42 | 42 | * @return void |
| 43 | 43 | */ |
| 44 | 44 | function lsx_health_plan_workout_box() { |
| 45 | - if ( ! post_type_exists( 'workout' ) ) { |
|
| 45 | + if ( ! post_type_exists('workout')) { |
|
| 46 | 46 | return; |
| 47 | 47 | } |
| 48 | 48 | ?> |
| 49 | 49 | <div class="col-md-4" > |
| 50 | 50 | <div class="lsx-health-plan-box"> |
| 51 | - <h3 class="title work-out-title title-lined"><?php esc_html_e( 'Your Workout', 'lsx-health-plan' ); ?><?php lsx_get_svg_icon( 'work.svg' ); ?></h3> |
|
| 51 | + <h3 class="title work-out-title title-lined"><?php esc_html_e('Your Workout', 'lsx-health-plan'); ?><?php lsx_get_svg_icon('work.svg'); ?></h3> |
|
| 52 | 52 | <div class="spacer"></div> |
| 53 | 53 | <?php |
| 54 | - $intro_text = \lsx_health_plan\functions\get_option( 'workout_intro', false ); |
|
| 55 | - if ( false !== $intro_text ) { |
|
| 54 | + $intro_text = \lsx_health_plan\functions\get_option('workout_intro', false); |
|
| 55 | + if (false !== $intro_text) { |
|
| 56 | 56 | ?> |
| 57 | 57 | <div class="excerpt"> |
| 58 | - <p><?php echo wp_kses_post( $intro_text ); ?></p> |
|
| 58 | + <p><?php echo wp_kses_post($intro_text); ?></p> |
|
| 59 | 59 | </div> |
| 60 | 60 | <?php |
| 61 | 61 | } |
| 62 | - $workout = \lsx_health_plan\functions\get_option( 'endpoint_workout', false ); |
|
| 63 | - if ( false === $workout ) { |
|
| 62 | + $workout = \lsx_health_plan\functions\get_option('endpoint_workout', false); |
|
| 63 | + if (false === $workout) { |
|
| 64 | 64 | $workout = 'workout'; |
| 65 | 65 | } |
| 66 | 66 | ?> |
| 67 | - <a href="<?php the_permalink(); ?><?php echo esc_attr( $workout ); ?>/" class="btn"><?php esc_html_e( 'Start your workout', 'lsx-health-plan' ); ?></a> |
|
| 67 | + <a href="<?php the_permalink(); ?><?php echo esc_attr($workout); ?>/" class="btn"><?php esc_html_e('Start your workout', 'lsx-health-plan'); ?></a> |
|
| 68 | 68 | </div> |
| 69 | 69 | </div> |
| 70 | 70 | <?php |
@@ -76,29 +76,29 @@ discard block |
||
| 76 | 76 | * @return void |
| 77 | 77 | */ |
| 78 | 78 | function lsx_health_plan_meal_box() { |
| 79 | - if ( ! post_type_exists( 'meal' ) ) { |
|
| 79 | + if ( ! post_type_exists('meal')) { |
|
| 80 | 80 | return; |
| 81 | 81 | } |
| 82 | 82 | ?> |
| 83 | 83 | <div class="col-md-4" > |
| 84 | 84 | <div class="lsx-health-plan-box"> |
| 85 | - <h3 class="title meal-plan-title title-lined"><?php esc_html_e( 'Your Meal Plan', 'lsx-health-plan' ); ?><?php lsx_get_svg_icon( 'meal.svg' ); ?></h3> |
|
| 85 | + <h3 class="title meal-plan-title title-lined"><?php esc_html_e('Your Meal Plan', 'lsx-health-plan'); ?><?php lsx_get_svg_icon('meal.svg'); ?></h3> |
|
| 86 | 86 | <div class="spacer"></div> |
| 87 | 87 | <?php |
| 88 | - $intro_text = \lsx_health_plan\functions\get_option( 'meal_plan_intro', false ); |
|
| 89 | - if ( false !== $intro_text ) { |
|
| 88 | + $intro_text = \lsx_health_plan\functions\get_option('meal_plan_intro', false); |
|
| 89 | + if (false !== $intro_text) { |
|
| 90 | 90 | ?> |
| 91 | 91 | <div class="excerpt"> |
| 92 | - <p><?php echo wp_kses_post( $intro_text ); ?></p> |
|
| 92 | + <p><?php echo wp_kses_post($intro_text); ?></p> |
|
| 93 | 93 | </div> |
| 94 | 94 | <?php |
| 95 | 95 | } |
| 96 | - $meal = \lsx_health_plan\functions\get_option( 'endpoint_meal', false ); |
|
| 97 | - if ( false === $meal ) { |
|
| 96 | + $meal = \lsx_health_plan\functions\get_option('endpoint_meal', false); |
|
| 97 | + if (false === $meal) { |
|
| 98 | 98 | $meal = 'meal'; |
| 99 | 99 | } |
| 100 | 100 | ?> |
| 101 | - <a href="<?php the_permalink(); ?><?php echo esc_attr( $meal ); ?>/" class="btn"><?php esc_html_e( 'View your meal plan', 'lsx-health-plan' ); ?></a> |
|
| 101 | + <a href="<?php the_permalink(); ?><?php echo esc_attr($meal); ?>/" class="btn"><?php esc_html_e('View your meal plan', 'lsx-health-plan'); ?></a> |
|
| 102 | 102 | </div> |
| 103 | 103 | </div> |
| 104 | 104 | <?php |
@@ -110,29 +110,29 @@ discard block |
||
| 110 | 110 | * @return void |
| 111 | 111 | */ |
| 112 | 112 | function lsx_health_plan_recipe_box() { |
| 113 | - if ( ! post_type_exists( 'recipe' ) ) { |
|
| 113 | + if ( ! post_type_exists('recipe')) { |
|
| 114 | 114 | return; |
| 115 | 115 | } |
| 116 | 116 | ?> |
| 117 | 117 | <div class="col-md-4" > |
| 118 | 118 | <div class="lsx-health-plan-box"> |
| 119 | - <h3 class="title recipes-title title-lined"><?php esc_html_e( 'Recipes', 'lsx-health-plan' ); ?><?php lsx_get_svg_icon( 'recipes.svg' ); ?></h3> |
|
| 119 | + <h3 class="title recipes-title title-lined"><?php esc_html_e('Recipes', 'lsx-health-plan'); ?><?php lsx_get_svg_icon('recipes.svg'); ?></h3> |
|
| 120 | 120 | <div class="spacer"></div> |
| 121 | 121 | <?php |
| 122 | - $intro_text = \lsx_health_plan\functions\get_option( 'recipes_intro', false ); |
|
| 123 | - if ( false !== $intro_text ) { |
|
| 122 | + $intro_text = \lsx_health_plan\functions\get_option('recipes_intro', false); |
|
| 123 | + if (false !== $intro_text) { |
|
| 124 | 124 | ?> |
| 125 | 125 | <div class="excerpt"> |
| 126 | - <p><?php echo wp_kses_post( $intro_text ); ?></p> |
|
| 126 | + <p><?php echo wp_kses_post($intro_text); ?></p> |
|
| 127 | 127 | </div> |
| 128 | 128 | <?php |
| 129 | 129 | } |
| 130 | - $recipes = \lsx_health_plan\functions\get_option( 'endpoint_recipe', false ); |
|
| 131 | - if ( false === $recipes ) { |
|
| 130 | + $recipes = \lsx_health_plan\functions\get_option('endpoint_recipe', false); |
|
| 131 | + if (false === $recipes) { |
|
| 132 | 132 | $recipes = 'recipes'; |
| 133 | 133 | } |
| 134 | 134 | ?> |
| 135 | - <a href="<?php the_permalink(); ?><?php echo esc_attr( $recipes ); ?>/" class="btn"><?php esc_html_e( 'View all recipes', 'lsx-health-plan' ); ?></a> |
|
| 135 | + <a href="<?php the_permalink(); ?><?php echo esc_attr($recipes); ?>/" class="btn"><?php esc_html_e('View all recipes', 'lsx-health-plan'); ?></a> |
|
| 136 | 136 | </div> |
| 137 | 137 | </div> |
| 138 | 138 | <?php |
@@ -148,15 +148,15 @@ discard block |
||
| 148 | 148 | ?> |
| 149 | 149 | <div class="col-md-4 day-download-box" > |
| 150 | 150 | <div class="lsx-health-plan-box"> |
| 151 | - <h3 class="title downloads-title title-lined"><?php esc_html_e( 'Downloads', 'lsx-health-plan' ); ?><?php lsx_get_svg_icon( 'download.svg' ); ?></h3> |
|
| 151 | + <h3 class="title downloads-title title-lined"><?php esc_html_e('Downloads', 'lsx-health-plan'); ?><?php lsx_get_svg_icon('download.svg'); ?></h3> |
|
| 152 | 152 | <div class="spacer"></div> |
| 153 | 153 | <div class="download-list"> |
| 154 | 154 | <ul> |
| 155 | 155 | <?php |
| 156 | 156 | $downloads = \lsx_health_plan\functions\get_downloads(); |
| 157 | - if ( ! empty( $downloads ) ) { |
|
| 158 | - foreach ( $downloads as $download ) { |
|
| 159 | - echo wp_kses_post( '<li><a href=""><i class="fa fa-file-pdf"></i>' . do_shortcode( '[download id="' . $download . '"]' ) . '</a></li>' ); |
|
| 157 | + if ( ! empty($downloads)) { |
|
| 158 | + foreach ($downloads as $download) { |
|
| 159 | + echo wp_kses_post('<li><a href=""><i class="fa fa-file-pdf"></i>' . do_shortcode('[download id="' . $download . '"]') . '</a></li>'); |
|
| 160 | 160 | } |
| 161 | 161 | } |
| 162 | 162 | ?> |
@@ -173,15 +173,15 @@ discard block |
||
| 173 | 173 | * @param string $tab |
| 174 | 174 | * @return void |
| 175 | 175 | */ |
| 176 | -function lsx_health_plan_nav_class( $tab = '' ) { |
|
| 176 | +function lsx_health_plan_nav_class($tab = '') { |
|
| 177 | 177 | $nav_classes = array(); |
| 178 | - if ( function_exists( 'is_wc_endpoint_url' ) && 'edit-account' === $tab && is_wc_endpoint_url( 'edit-account' ) ) { |
|
| 178 | + if (function_exists('is_wc_endpoint_url') && 'edit-account' === $tab && is_wc_endpoint_url('edit-account')) { |
|
| 179 | 179 | $nav_classes[] = 'active'; |
| 180 | - } elseif ( lsx_health_plan_is_current_tab( $tab ) ) { |
|
| 180 | + } elseif (lsx_health_plan_is_current_tab($tab)) { |
|
| 181 | 181 | $nav_classes[] = 'active'; |
| 182 | 182 | } |
| 183 | - if ( ! empty( $nav_classes ) ) { |
|
| 184 | - echo wp_kses_post( implode( ' ', $nav_classes ) ); |
|
| 183 | + if ( ! empty($nav_classes)) { |
|
| 184 | + echo wp_kses_post(implode(' ', $nav_classes)); |
|
| 185 | 185 | } |
| 186 | 186 | } |
| 187 | 187 | |
@@ -196,19 +196,19 @@ discard block |
||
| 196 | 196 | <ul class="nav nav-pills"> |
| 197 | 197 | <li class=" |
| 198 | 198 | <?php |
| 199 | - if ( ( function_exists( 'is_wc_endpoint_url' ) && ! is_wc_endpoint_url( 'edit-account' ) ) || ! function_exists( 'is_wc_endpoint_url' ) ) { |
|
| 200 | - echo esc_attr( 'active' ); |
|
| 199 | + if ((function_exists('is_wc_endpoint_url') && ! is_wc_endpoint_url('edit-account')) || ! function_exists('is_wc_endpoint_url')) { |
|
| 200 | + echo esc_attr('active'); |
|
| 201 | 201 | } |
| 202 | 202 | ?> |
| 203 | - "><a class="my-plan-tab" href="<?php the_permalink(); ?>"><?php esc_html_e( 'My Plans', 'lsx-health-plan' ); ?></a></li> |
|
| 203 | + "><a class="my-plan-tab" href="<?php the_permalink(); ?>"><?php esc_html_e('My Plans', 'lsx-health-plan'); ?></a></li> |
|
| 204 | 204 | <li class=" |
| 205 | 205 | <?php |
| 206 | - if ( function_exists( 'is_wc_endpoint_url' ) && is_wc_endpoint_url( 'edit-account' ) ) { |
|
| 207 | - echo esc_attr( 'active' ); |
|
| 206 | + if (function_exists('is_wc_endpoint_url') && is_wc_endpoint_url('edit-account')) { |
|
| 207 | + echo esc_attr('active'); |
|
| 208 | 208 | } |
| 209 | 209 | ?> |
| 210 | - "><a class="account-details-tab" href="<?php the_permalink(); ?>edit-account/"><?php esc_html_e( 'Account Details', 'lsx-health-plan' ); ?></a></li> |
|
| 211 | - <li class=""><a class="logout-tab" href="<?php echo esc_url( wp_logout_url( get_permalink() ) ); ?>"><?php esc_html_e( 'Logout', 'lsx-health-plan' ); ?></a></li> |
|
| 210 | + "><a class="account-details-tab" href="<?php the_permalink(); ?>edit-account/"><?php esc_html_e('Account Details', 'lsx-health-plan'); ?></a></li> |
|
| 211 | + <li class=""><a class="logout-tab" href="<?php echo esc_url(wp_logout_url(get_permalink())); ?>"><?php esc_html_e('Logout', 'lsx-health-plan'); ?></a></li> |
|
| 212 | 212 | </ul> |
| 213 | 213 | </div> |
| 214 | 214 | <?php |
@@ -223,76 +223,76 @@ discard block |
||
| 223 | 223 | ?> |
| 224 | 224 | <div class="lsx-health-plan my-profile-block wp-block-cover alignfull"> |
| 225 | 225 | <div class="wp-block-cover__inner-container"> |
| 226 | - <h2><?php esc_html_e( 'My Dashboard', 'lsx-health-plan' ); ?></h2> |
|
| 226 | + <h2><?php esc_html_e('My Dashboard', 'lsx-health-plan'); ?></h2> |
|
| 227 | 227 | <section id="dashboard-card"> |
| 228 | 228 | <div class="profile-navigation"> |
| 229 | 229 | <div class="profile-photo"> |
| 230 | 230 | <?php |
| 231 | 231 | global $current_user; |
| 232 | 232 | get_current_user(); |
| 233 | - echo get_avatar( $current_user->ID, 240 ); |
|
| 233 | + echo get_avatar($current_user->ID, 240); |
|
| 234 | 234 | ?> |
| 235 | 235 | </div> |
| 236 | 236 | </div> |
| 237 | 237 | <div class="profile-details"> |
| 238 | - <h1 class="title-lined has-text-color"><?php echo esc_html( $current_user->display_name ); ?></h1> |
|
| 238 | + <h1 class="title-lined has-text-color"><?php echo esc_html($current_user->display_name); ?></h1> |
|
| 239 | 239 | <?php |
| 240 | - $disable_stats = \lsx_health_plan\functions\get_option( 'disable_all_stats', false ); |
|
| 241 | - if ( 'on' !== $disable_stats ) { |
|
| 240 | + $disable_stats = \lsx_health_plan\functions\get_option('disable_all_stats', false); |
|
| 241 | + if ('on' !== $disable_stats) { |
|
| 242 | 242 | |
| 243 | - $is_weight_disabled = \lsx_health_plan\functions\get_option( 'disable_weight_checkbox', false ); |
|
| 244 | - $is_height_disabled = \lsx_health_plan\functions\get_option( 'disable_height_checkbox', false ); |
|
| 245 | - $is_waist_disabled = \lsx_health_plan\functions\get_option( 'disable_waist_checkbox', false ); |
|
| 246 | - $is_bmi_disabled = \lsx_health_plan\functions\get_option( 'disable_bmi_checkbox', false ); |
|
| 243 | + $is_weight_disabled = \lsx_health_plan\functions\get_option('disable_weight_checkbox', false); |
|
| 244 | + $is_height_disabled = \lsx_health_plan\functions\get_option('disable_height_checkbox', false); |
|
| 245 | + $is_waist_disabled = \lsx_health_plan\functions\get_option('disable_waist_checkbox', false); |
|
| 246 | + $is_bmi_disabled = \lsx_health_plan\functions\get_option('disable_bmi_checkbox', false); |
|
| 247 | 247 | |
| 248 | - $weight = get_user_meta( get_current_user_id(), 'weight', true ); |
|
| 249 | - $waist = get_user_meta( get_current_user_id(), 'waist', true ); |
|
| 250 | - $height = get_user_meta( get_current_user_id(), 'height', true ); |
|
| 248 | + $weight = get_user_meta(get_current_user_id(), 'weight', true); |
|
| 249 | + $waist = get_user_meta(get_current_user_id(), 'waist', true); |
|
| 250 | + $height = get_user_meta(get_current_user_id(), 'height', true); |
|
| 251 | 251 | |
| 252 | 252 | $height_m = 0; |
| 253 | - if ( is_numeric( $height) ) { |
|
| 253 | + if (is_numeric($height)) { |
|
| 254 | 254 | $height_m = $height / 100; |
| 255 | 255 | } |
| 256 | 256 | |
| 257 | - if ( 1 < $weight && 1 < $height_m ) { |
|
| 258 | - $bmi = $weight / ( $height_m * $height_m ); |
|
| 259 | - $bmi = number_format( $bmi, 1 ); |
|
| 257 | + if (1 < $weight && 1 < $height_m) { |
|
| 258 | + $bmi = $weight / ($height_m * $height_m); |
|
| 259 | + $bmi = number_format($bmi, 1); |
|
| 260 | 260 | } else { |
| 261 | - $bmi = __( 'Add more data', 'lsx-health-plan' ); |
|
| 261 | + $bmi = __('Add more data', 'lsx-health-plan'); |
|
| 262 | 262 | } |
| 263 | 263 | |
| 264 | 264 | ?> |
| 265 | 265 | |
| 266 | 266 | <div> |
| 267 | - <?php if ( 'on' !== $is_weight_disabled ) { ?> |
|
| 268 | - <span><strong><?php esc_html_e( 'Weight:', 'lsx-health-plan' ); ?></strong> |
|
| 267 | + <?php if ('on' !== $is_weight_disabled) { ?> |
|
| 268 | + <span><strong><?php esc_html_e('Weight:', 'lsx-health-plan'); ?></strong> |
|
| 269 | 269 | <?php |
| 270 | - if ( '' !== $weight ) { |
|
| 271 | - echo wp_kses_post( $weight . ' kg' ); |
|
| 270 | + if ('' !== $weight) { |
|
| 271 | + echo wp_kses_post($weight . ' kg'); |
|
| 272 | 272 | } else { |
| 273 | 273 | echo '/'; |
| 274 | 274 | } |
| 275 | 275 | ?> |
| 276 | 276 | </span> |
| 277 | 277 | <?php } |
| 278 | - if ( 'on' !== $is_waist_disabled ) { |
|
| 278 | + if ('on' !== $is_waist_disabled) { |
|
| 279 | 279 | ?> |
| 280 | - <span><strong><?php esc_html_e( 'Waist:', 'lsx-health-plan' ); ?></strong> |
|
| 280 | + <span><strong><?php esc_html_e('Waist:', 'lsx-health-plan'); ?></strong> |
|
| 281 | 281 | <?php |
| 282 | - if ( '' !== $waist ) { |
|
| 283 | - echo wp_kses_post( $waist . ' cm' ); |
|
| 282 | + if ('' !== $waist) { |
|
| 283 | + echo wp_kses_post($waist . ' cm'); |
|
| 284 | 284 | } else { |
| 285 | 285 | echo '/'; |
| 286 | 286 | } |
| 287 | 287 | ?> |
| 288 | 288 | </span> |
| 289 | 289 | <?php } |
| 290 | - if ( 'on' !== $is_bmi_disabled ) { |
|
| 290 | + if ('on' !== $is_bmi_disabled) { |
|
| 291 | 291 | ?> |
| 292 | - <span><strong><?php esc_html_e( 'BMI:', 'lsx-health-plan' ); ?></strong> |
|
| 292 | + <span><strong><?php esc_html_e('BMI:', 'lsx-health-plan'); ?></strong> |
|
| 293 | 293 | <?php |
| 294 | - if ( '' !== $bmi ) { |
|
| 295 | - echo wp_kses_post( $bmi ); |
|
| 294 | + if ('' !== $bmi) { |
|
| 295 | + echo wp_kses_post($bmi); |
|
| 296 | 296 | } else { |
| 297 | 297 | echo '/'; |
| 298 | 298 | } |
@@ -305,13 +305,13 @@ discard block |
||
| 305 | 305 | ?> |
| 306 | 306 | <div class="edit-profile"> |
| 307 | 307 | <?php |
| 308 | - if ( function_exists( 'wc_get_page_id' ) ) { |
|
| 309 | - $url_id = wc_get_page_id( 'myaccount' ); |
|
| 308 | + if (function_exists('wc_get_page_id')) { |
|
| 309 | + $url_id = wc_get_page_id('myaccount'); |
|
| 310 | 310 | } else { |
| 311 | 311 | $url_id = ''; |
| 312 | 312 | } |
| 313 | 313 | ?> |
| 314 | - <a href="<?php echo esc_url( get_permalink( $url_id ) ); ?>edit-account/"><?php esc_html_e( 'Edit', 'lsx-health-plan' ); ?></a> |
|
| 314 | + <a href="<?php echo esc_url(get_permalink($url_id)); ?>edit-account/"><?php esc_html_e('Edit', 'lsx-health-plan'); ?></a> |
|
| 315 | 315 | </div> |
| 316 | 316 | </div> |
| 317 | 317 | </section> |
@@ -337,7 +337,7 @@ discard block |
||
| 337 | 337 | ); |
| 338 | 338 | |
| 339 | 339 | $product_ids = \lsx_health_plan\functions\woocommerce\get_membership_products(); |
| 340 | - if ( ! empty( $product_ids ) ) { |
|
| 340 | + if ( ! empty($product_ids)) { |
|
| 341 | 341 | $args['meta_query'] = array( |
| 342 | 342 | 'relation' => 'OR', |
| 343 | 343 | array( |
@@ -352,82 +352,82 @@ discard block |
||
| 352 | 352 | ); |
| 353 | 353 | } |
| 354 | 354 | |
| 355 | - $the_query = new WP_Query( $args ); |
|
| 355 | + $the_query = new WP_Query($args); |
|
| 356 | 356 | ?> |
| 357 | 357 | <div class="all-plans-block plan-grid block-all-plans-block"> |
| 358 | 358 | <div class="row"> |
| 359 | 359 | <?php |
| 360 | - if ( $the_query->have_posts() ) : |
|
| 361 | - while ( $the_query->have_posts() ) : |
|
| 360 | + if ($the_query->have_posts()) : |
|
| 361 | + while ($the_query->have_posts()) : |
|
| 362 | 362 | $the_query->the_post(); |
| 363 | 363 | lsx_entry_before(); |
| 364 | 364 | $completed_class = ''; |
| 365 | 365 | $linked_product = false; |
| 366 | 366 | $restricted = false; |
| 367 | 367 | $product = null; |
| 368 | - if ( \lsx_health_plan\functions\woocommerce\plan_has_products() ) { |
|
| 368 | + if (\lsx_health_plan\functions\woocommerce\plan_has_products()) { |
|
| 369 | 369 | $products = \lsx_health_plan\functions\woocommerce\get_plan_products(); |
| 370 | - $linked_product = wc_get_product( $products[0] ); |
|
| 370 | + $linked_product = wc_get_product($products[0]); |
|
| 371 | 371 | $product = $linked_product; |
| 372 | 372 | } |
| 373 | - if ( function_exists( 'wc_memberships_is_post_content_restricted' ) ) { |
|
| 374 | - $restricted = wc_memberships_is_post_content_restricted( get_the_ID() ) && ! current_user_can( 'wc_memberships_view_restricted_post_content', get_the_ID() ); |
|
| 373 | + if (function_exists('wc_memberships_is_post_content_restricted')) { |
|
| 374 | + $restricted = wc_memberships_is_post_content_restricted(get_the_ID()) && ! current_user_can('wc_memberships_view_restricted_post_content', get_the_ID()); |
|
| 375 | 375 | } |
| 376 | 376 | |
| 377 | - if ( lsx_health_plan_is_plan_complete() ) { |
|
| 377 | + if (lsx_health_plan_is_plan_complete()) { |
|
| 378 | 378 | $completed_class = 'completed'; |
| 379 | 379 | } |
| 380 | 380 | $round_progress = ''; |
| 381 | 381 | $completed_progress = '100'; |
| 382 | - if ( false === $restricted ) { |
|
| 383 | - $round_progress = round( \lsx_health_plan\functions\get_progress( get_the_ID() ), 0 ); |
|
| 382 | + if (false === $restricted) { |
|
| 383 | + $round_progress = round(\lsx_health_plan\functions\get_progress(get_the_ID()), 0); |
|
| 384 | 384 | } |
| 385 | 385 | ?> |
| 386 | 386 | <div class="col-xs-12 col-sm-6 col-md-4"> |
| 387 | - <article class="lsx-slot lsx-hp-shadow <?php echo esc_html( 'progress-') . $round_progress; ?>"> |
|
| 387 | + <article class="lsx-slot lsx-hp-shadow <?php echo esc_html('progress-') . $round_progress; ?>"> |
|
| 388 | 388 | <div class="plan-feature-img"> |
| 389 | - <?php if ( (int)$completed_progress === (int)$round_progress ) { ?> |
|
| 390 | - <span class="featured-plan"><?php lsx_get_svg_icon( 'icon-completed.svg' ); ?></span> |
|
| 389 | + <?php if ((int) $completed_progress === (int) $round_progress) { ?> |
|
| 390 | + <span class="featured-plan"><?php lsx_get_svg_icon('icon-completed.svg'); ?></span> |
|
| 391 | 391 | <?php } ?> |
| 392 | - <a href="<?php echo esc_url( get_permalink() ); ?>"> |
|
| 392 | + <a href="<?php echo esc_url(get_permalink()); ?>"> |
|
| 393 | 393 | <?php |
| 394 | 394 | $featured_image = get_the_post_thumbnail(); |
| 395 | - if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
| 396 | - the_post_thumbnail( 'lsx-thumbnail', array( |
|
| 395 | + if ( ! empty($featured_image) && '' !== $featured_image) { |
|
| 396 | + the_post_thumbnail('lsx-thumbnail', array( |
|
| 397 | 397 | 'class' => 'aligncenter', |
| 398 | - ) ); |
|
| 398 | + )); |
|
| 399 | 399 | } else { |
| 400 | 400 | ?> |
| 401 | - <img loading="lazy" class="placeholder" src="<?php echo esc_attr( plugin_dir_url( __FILE__ ) . '../assets/images/placeholder.jpg' ); ?>"> |
|
| 401 | + <img loading="lazy" class="placeholder" src="<?php echo esc_attr(plugin_dir_url(__FILE__) . '../assets/images/placeholder.jpg'); ?>"> |
|
| 402 | 402 | <?php |
| 403 | 403 | } |
| 404 | 404 | ?> |
| 405 | 405 | </a> |
| 406 | 406 | </div> |
| 407 | 407 | <div class="content-box plan-content-box"> |
| 408 | - <h3 class="plan id-<?php the_ID(); ?> <?php echo esc_attr( $completed_class ); ?>"><a href="<?php echo esc_url( get_permalink() ); ?>"><?php the_title(); ?></a></h3> |
|
| 408 | + <h3 class="plan id-<?php the_ID(); ?> <?php echo esc_attr($completed_class); ?>"><a href="<?php echo esc_url(get_permalink()); ?>"><?php the_title(); ?></a></h3> |
|
| 409 | 409 | <?php |
| 410 | - echo wp_kses_post( \lsx_health_plan\functions\hp_get_plan_type_meta( $post ) ); |
|
| 410 | + echo wp_kses_post(\lsx_health_plan\functions\hp_get_plan_type_meta($post)); |
|
| 411 | 411 | ?> |
| 412 | 412 | <?php |
| 413 | - if ( false !== $linked_product && false !== $restricted ) { |
|
| 414 | - echo wp_kses_post( $linked_product->get_price_html() ); |
|
| 413 | + if (false !== $linked_product && false !== $restricted) { |
|
| 414 | + echo wp_kses_post($linked_product->get_price_html()); |
|
| 415 | 415 | } |
| 416 | 416 | ?> |
| 417 | 417 | <div class="excerpt"> |
| 418 | 418 | <?php |
| 419 | - if ( ! has_excerpt() ) { |
|
| 420 | - $content = wp_trim_words( get_the_content(), 20 ); |
|
| 419 | + if ( ! has_excerpt()) { |
|
| 420 | + $content = wp_trim_words(get_the_content(), 20); |
|
| 421 | 421 | $content = '<p>' . $content . '</pre>'; |
| 422 | 422 | } else { |
| 423 | - $content = apply_filters( 'the_excerpt', get_the_excerpt() ); |
|
| 423 | + $content = apply_filters('the_excerpt', get_the_excerpt()); |
|
| 424 | 424 | } |
| 425 | - echo wp_kses_post( $content ); |
|
| 425 | + echo wp_kses_post($content); |
|
| 426 | 426 | ?> |
| 427 | 427 | </div> |
| 428 | 428 | <?php |
| 429 | - if ( false === $restricted ) { |
|
| 430 | - echo wp_kses_post( '<span class="progress"><progress class="bar" value="' . \lsx_health_plan\functions\get_progress( get_the_ID() ) . '" max="100"> ' . \lsx_health_plan\functions\get_progress( get_the_ID() ) . '% </progress><span>' . $round_progress . '%</span></span>' ); |
|
| 429 | + if (false === $restricted) { |
|
| 430 | + echo wp_kses_post('<span class="progress"><progress class="bar" value="' . \lsx_health_plan\functions\get_progress(get_the_ID()) . '" max="100"> ' . \lsx_health_plan\functions\get_progress(get_the_ID()) . '% </progress><span>' . $round_progress . '%</span></span>'); |
|
| 431 | 431 | } |
| 432 | 432 | ?> |
| 433 | 433 | </div> |
@@ -447,30 +447,30 @@ discard block |
||
| 447 | 447 | * |
| 448 | 448 | * @return void |
| 449 | 449 | */ |
| 450 | -function lsx_health_plan_day_plan_block( $args = array() ) { |
|
| 450 | +function lsx_health_plan_day_plan_block($args = array()) { |
|
| 451 | 451 | $defaults = array( |
| 452 | 452 | 'plan' => '', |
| 453 | 453 | ); |
| 454 | - $args = wp_parse_args( $args, $defaults ); |
|
| 454 | + $args = wp_parse_args($args, $defaults); |
|
| 455 | 455 | |
| 456 | - if ( isset( $args['plan'] ) && '' !== $args['plan'] && \lsx_health_plan\functions\plan\has_sections( $args['plan'] ) ) { |
|
| 456 | + if (isset($args['plan']) && '' !== $args['plan'] && \lsx_health_plan\functions\plan\has_sections($args['plan'])) { |
|
| 457 | 457 | $sections = \lsx_health_plan\functions\plan\get_sections(); |
| 458 | 458 | ?> |
| 459 | 459 | <div class="daily-plan-block day-grid"> |
| 460 | 460 | <?php |
| 461 | - foreach ( $sections as $section_key => $section_values ) { |
|
| 462 | - $defaults = array( |
|
| 463 | - 'title' => __( 'Day', 'lsx-health-plan' ) . ' ' . ( $section_key + 1 ), |
|
| 461 | + foreach ($sections as $section_key => $section_values) { |
|
| 462 | + $defaults = array( |
|
| 463 | + 'title' => __('Day', 'lsx-health-plan') . ' ' . ($section_key + 1), |
|
| 464 | 464 | ); |
| 465 | - $section_args = wp_parse_args( $section_values, $defaults ); |
|
| 465 | + $section_args = wp_parse_args($section_values, $defaults); |
|
| 466 | 466 | |
| 467 | 467 | $completed_class = ''; |
| 468 | - if ( lsx_health_plan_is_day_complete() ) { |
|
| 468 | + if (lsx_health_plan_is_day_complete()) { |
|
| 469 | 469 | $completed_class = 'completed'; |
| 470 | 470 | } |
| 471 | 471 | ?> |
| 472 | - <a href="<?php echo esc_attr( \lsx_health_plan\functions\plan\get_permalink( $args['plan'], $section_args['title'] ) ); ?>" class="day id-<?php echo esc_attr( $section_key + 1 ); ?> <?php echo esc_attr( $completed_class ); ?>"> |
|
| 473 | - <div class="plan-content"><?php echo esc_attr( $section_args['title'] ); ?></div> |
|
| 472 | + <a href="<?php echo esc_attr(\lsx_health_plan\functions\plan\get_permalink($args['plan'], $section_args['title'])); ?>" class="day id-<?php echo esc_attr($section_key + 1); ?> <?php echo esc_attr($completed_class); ?>"> |
|
| 473 | + <div class="plan-content"><?php echo esc_attr($section_args['title']); ?></div> |
|
| 474 | 474 | </a> |
| 475 | 475 | <?php |
| 476 | 476 | } |
@@ -486,31 +486,31 @@ discard block |
||
| 486 | 486 | * @param array $args An array of arguments. |
| 487 | 487 | * @return void |
| 488 | 488 | */ |
| 489 | -function lsx_health_plan_week_plan_block( $args = array() ) { |
|
| 489 | +function lsx_health_plan_week_plan_block($args = array()) { |
|
| 490 | 490 | $defaults = array( |
| 491 | 491 | 'show_downloads' => false, |
| 492 | 492 | 'plan' => '', |
| 493 | 493 | ); |
| 494 | - $args = wp_parse_args( $args, $defaults ); |
|
| 494 | + $args = wp_parse_args($args, $defaults); |
|
| 495 | 495 | |
| 496 | - if ( isset( $args['plan'] ) && '' !== $args['plan'] && \lsx_health_plan\functions\plan\has_sections( $args['plan'] ) ) { |
|
| 497 | - $groups = \lsx_health_plan\functions\plan\get_sections( true ); |
|
| 496 | + if (isset($args['plan']) && '' !== $args['plan'] && \lsx_health_plan\functions\plan\has_sections($args['plan'])) { |
|
| 497 | + $groups = \lsx_health_plan\functions\plan\get_sections(true); |
|
| 498 | 498 | |
| 499 | - if ( ! empty( $groups ) ) { |
|
| 499 | + if ( ! empty($groups)) { |
|
| 500 | 500 | $counter = 1; |
| 501 | 501 | $group_open = false; |
| 502 | 502 | |
| 503 | - foreach ( $groups as $group_key => $sections ) { |
|
| 503 | + foreach ($groups as $group_key => $sections) { |
|
| 504 | 504 | $collapse_class = ''; |
| 505 | - $group_title = \lsx_health_plan\functions\plan\get_group_title( $sections ); |
|
| 505 | + $group_title = \lsx_health_plan\functions\plan\get_group_title($sections); |
|
| 506 | 506 | |
| 507 | 507 | // Determine if the current week is complete. |
| 508 | - $day_ids = wp_list_pluck( $sections, 'title' ); |
|
| 509 | - if ( false === $group_open ) { |
|
| 510 | - if ( 1 === $counter && ! \lsx_health_plan\functions\is_week_complete( false, $day_ids, $group_title ) ) { |
|
| 508 | + $day_ids = wp_list_pluck($sections, 'title'); |
|
| 509 | + if (false === $group_open) { |
|
| 510 | + if (1 === $counter && ! \lsx_health_plan\functions\is_week_complete(false, $day_ids, $group_title)) { |
|
| 511 | 511 | $collapse_class = 'in'; |
| 512 | 512 | $group_open = true; |
| 513 | - } elseif ( ! \lsx_health_plan\functions\is_week_complete( false, $day_ids, $group_title ) ) { |
|
| 513 | + } elseif ( ! \lsx_health_plan\functions\is_week_complete(false, $day_ids, $group_title)) { |
|
| 514 | 514 | $collapse_class = 'in'; |
| 515 | 515 | $group_open = true; |
| 516 | 516 | } |
@@ -518,40 +518,40 @@ discard block |
||
| 518 | 518 | |
| 519 | 519 | // Determine if there are any weekly downloads. |
| 520 | 520 | $week_downloads_view = ''; |
| 521 | - if ( isset( $args['show_downloads'] ) && false !== $args['show_downloads'] ) { |
|
| 522 | - $weekly_downloads = \lsx_health_plan\functions\get_weekly_downloads( $group_key ); |
|
| 523 | - if ( ! empty( $weekly_downloads ) ) { |
|
| 521 | + if (isset($args['show_downloads']) && false !== $args['show_downloads']) { |
|
| 522 | + $weekly_downloads = \lsx_health_plan\functions\get_weekly_downloads($group_key); |
|
| 523 | + if ( ! empty($weekly_downloads)) { |
|
| 524 | 524 | $week_downloads_view = 'week-downloads-view-on'; |
| 525 | 525 | } |
| 526 | 526 | } |
| 527 | 527 | ?> |
| 528 | 528 | <div class="daily-plan-block week-grid"> |
| 529 | - <a href="#group-<?php echo esc_attr( $group_key ); ?>" data-toggle="collapse" class="week-title"><?php echo esc_attr( $group_title ); ?></a> |
|
| 530 | - <div id="group-<?php echo esc_attr( $group_key ); ?>" class="week-row collapse <?php echo esc_attr( $collapse_class ); ?>"> |
|
| 531 | - <div class="week-row-inner <?php echo esc_html( $week_downloads_view ); ?>"> |
|
| 529 | + <a href="#group-<?php echo esc_attr($group_key); ?>" data-toggle="collapse" class="week-title"><?php echo esc_attr($group_title); ?></a> |
|
| 530 | + <div id="group-<?php echo esc_attr($group_key); ?>" class="week-row collapse <?php echo esc_attr($collapse_class); ?>"> |
|
| 531 | + <div class="week-row-inner <?php echo esc_html($week_downloads_view); ?>"> |
|
| 532 | 532 | <div class="week-meals-recipes-box"> |
| 533 | 533 | |
| 534 | - <?php if ( ! empty( $week_downloads_view ) ) { ?> |
|
| 535 | - <h3 class="title"><?php lsx_get_svg_icon( 'daily-plan.svg' ); ?><?php echo esc_html_e( 'Plan', 'lsx-health-plan' ); ?></h3> |
|
| 534 | + <?php if ( ! empty($week_downloads_view)) { ?> |
|
| 535 | + <h3 class="title"><?php lsx_get_svg_icon('daily-plan.svg'); ?><?php echo esc_html_e('Plan', 'lsx-health-plan'); ?></h3> |
|
| 536 | 536 | <?php } ?> |
| 537 | 537 | |
| 538 | 538 | <div class="week-meals-recipes-box-inner"> |
| 539 | 539 | <?php |
| 540 | 540 | |
| 541 | - foreach ( $sections as $section_key => $section_values ) { |
|
| 541 | + foreach ($sections as $section_key => $section_values) { |
|
| 542 | 542 | |
| 543 | - $defaults = array( |
|
| 544 | - 'title' => __( 'Day', 'lsx-health-plan' ) . ' ' . ( $section_key + 1 ), |
|
| 543 | + $defaults = array( |
|
| 544 | + 'title' => __('Day', 'lsx-health-plan') . ' ' . ($section_key + 1), |
|
| 545 | 545 | ); |
| 546 | - $section_args = wp_parse_args( $section_values, $defaults ); |
|
| 546 | + $section_args = wp_parse_args($section_values, $defaults); |
|
| 547 | 547 | |
| 548 | 548 | $completed_class = ''; |
| 549 | - if ( lsx_health_plan_is_day_complete( $args['plan'], $section_args['title'] ) ) { |
|
| 549 | + if (lsx_health_plan_is_day_complete($args['plan'], $section_args['title'])) { |
|
| 550 | 550 | $completed_class = 'completed'; |
| 551 | 551 | } |
| 552 | 552 | ?> |
| 553 | - <a href="<?php echo esc_attr( \lsx_health_plan\functions\plan\get_permalink( $args['plan'], $section_args['title'] ) ); ?>" class="day id-<?php echo esc_attr( $section_key + 1 ); ?> <?php echo esc_attr( $completed_class ); ?>"> |
|
| 554 | - <div class="plan-content"><?php echo esc_attr( $section_args['title'] ); ?></div> |
|
| 553 | + <a href="<?php echo esc_attr(\lsx_health_plan\functions\plan\get_permalink($args['plan'], $section_args['title'])); ?>" class="day id-<?php echo esc_attr($section_key + 1); ?> <?php echo esc_attr($completed_class); ?>"> |
|
| 554 | + <div class="plan-content"><?php echo esc_attr($section_args['title']); ?></div> |
|
| 555 | 555 | </a> |
| 556 | 556 | <?php |
| 557 | 557 | } |
@@ -559,8 +559,8 @@ discard block |
||
| 559 | 559 | </div> |
| 560 | 560 | </div> |
| 561 | 561 | <?php |
| 562 | - if ( ! empty( $week_downloads_view ) ) { |
|
| 563 | - lsx_health_plan_weekly_downloads( $weekly_downloads ); |
|
| 562 | + if ( ! empty($week_downloads_view)) { |
|
| 563 | + lsx_health_plan_weekly_downloads($weekly_downloads); |
|
| 564 | 564 | } |
| 565 | 565 | ?> |
| 566 | 566 | </div> |
@@ -578,16 +578,16 @@ discard block |
||
| 578 | 578 | * @param array $weekly_downloads An array of the download ids. |
| 579 | 579 | * @return void |
| 580 | 580 | */ |
| 581 | -function lsx_health_plan_weekly_downloads( $weekly_downloads = array() ) { |
|
| 582 | - if ( ! empty( $weekly_downloads ) ) { |
|
| 581 | +function lsx_health_plan_weekly_downloads($weekly_downloads = array()) { |
|
| 582 | + if ( ! empty($weekly_downloads)) { |
|
| 583 | 583 | ?> |
| 584 | 584 | <div class="week-download-box"> |
| 585 | - <h3 class="title"><?php lsx_get_svg_icon( 'download.svg' ); ?><?php echo esc_html_e( 'Downloads', 'lsx-health-plan' ); ?></h3> |
|
| 585 | + <h3 class="title"><?php lsx_get_svg_icon('download.svg'); ?><?php echo esc_html_e('Downloads', 'lsx-health-plan'); ?></h3> |
|
| 586 | 586 | <ul class="week-download-box-list"> |
| 587 | 587 | <?php |
| 588 | - foreach ( $weekly_downloads as $weekly_download ) { |
|
| 588 | + foreach ($weekly_downloads as $weekly_download) { |
|
| 589 | 589 | ?> |
| 590 | - <li><?php echo wp_kses_post( do_shortcode( '[download id="' . $weekly_download . '"]' ) ); ?></li> |
|
| 590 | + <li><?php echo wp_kses_post(do_shortcode('[download id="' . $weekly_download . '"]')); ?></li> |
|
| 591 | 591 | <?php |
| 592 | 592 | } |
| 593 | 593 | ?> |
@@ -602,7 +602,7 @@ discard block |
||
| 602 | 602 | * |
| 603 | 603 | * @return void |
| 604 | 604 | */ |
| 605 | -function lsx_health_plan_items( $args = array() ) { |
|
| 605 | +function lsx_health_plan_items($args = array()) { |
|
| 606 | 606 | global $shortcode_args; |
| 607 | 607 | $shortcode_args = $args; |
| 608 | 608 | include LSX_HEALTH_PLAN_PATH . '/templates/partials/shortcode-loop.php'; |
@@ -614,7 +614,7 @@ discard block |
||
| 614 | 614 | * @return void |
| 615 | 615 | */ |
| 616 | 616 | function lsx_health_plan_featured_video_block() { |
| 617 | - if ( ! post_type_exists( 'video' ) ) { |
|
| 617 | + if ( ! post_type_exists('video')) { |
|
| 618 | 618 | return; |
| 619 | 619 | } |
| 620 | 620 | include LSX_HEALTH_PLAN_PATH . '/templates/featured-videos.php'; |
@@ -626,7 +626,7 @@ discard block |
||
| 626 | 626 | * @return void |
| 627 | 627 | */ |
| 628 | 628 | function lsx_health_plan_featured_recipes_block() { |
| 629 | - if ( ! post_type_exists( 'recipe' ) ) { |
|
| 629 | + if ( ! post_type_exists('recipe')) { |
|
| 630 | 630 | return; |
| 631 | 631 | } |
| 632 | 632 | include LSX_HEALTH_PLAN_PATH . '/templates/featured-recipes.php'; |
@@ -648,7 +648,7 @@ discard block |
||
| 648 | 648 | * @return void |
| 649 | 649 | */ |
| 650 | 650 | function lsx_health_plan_day_button() { |
| 651 | - if ( lsx_health_plan_is_day_complete() ) { |
|
| 651 | + if (lsx_health_plan_is_day_complete()) { |
|
| 652 | 652 | lsx_health_plan_unlock_button(); |
| 653 | 653 | } else { |
| 654 | 654 | lsx_health_plan_complete_button(); |
@@ -664,9 +664,9 @@ discard block |
||
| 664 | 664 | ?> |
| 665 | 665 | <div class="single-plan-inner-buttons"> |
| 666 | 666 | <form action="<?php the_permalink(); ?>" method="post" class="form-complete-day complete-plan-btn"> |
| 667 | - <?php wp_nonce_field( 'complete', 'lsx-health-plan-actions' ); ?> |
|
| 668 | - <input type="hidden" name="lsx-health-plan-id" value="<?php echo esc_attr( \lsx_health_plan\functions\plan\generate_section_id() ); ?>" /> |
|
| 669 | - <button class="btn cta-btn" type="submit"><?php esc_html_e( 'Complete Day', 'lsx-health-plan' ); ?></button> |
|
| 667 | + <?php wp_nonce_field('complete', 'lsx-health-plan-actions'); ?> |
|
| 668 | + <input type="hidden" name="lsx-health-plan-id" value="<?php echo esc_attr(\lsx_health_plan\functions\plan\generate_section_id()); ?>" /> |
|
| 669 | + <button class="btn cta-btn" type="submit"><?php esc_html_e('Complete Day', 'lsx-health-plan'); ?></button> |
|
| 670 | 670 | </form> |
| 671 | 671 | <?php lsx_health_plan_back_to_plan_button(); ?> |
| 672 | 672 | </div> |
@@ -682,9 +682,9 @@ discard block |
||
| 682 | 682 | ?> |
| 683 | 683 | <div class="single-plan-inner-buttons"> |
| 684 | 684 | <form action="<?php the_permalink(); ?>" method="post" class="form-complete-day complete-plan-btn"> |
| 685 | - <?php wp_nonce_field( 'unlock', 'lsx-health-plan-actions' ); ?> |
|
| 686 | - <input type="hidden" name="lsx-health-plan-id" value="<?php echo esc_attr( \lsx_health_plan\functions\plan\generate_section_id() ); ?>" /> |
|
| 687 | - <button class="btn secondary-btn" type="submit"><?php esc_html_e( 'Im not done!', 'lsx-health-plan' ); ?></button> |
|
| 685 | + <?php wp_nonce_field('unlock', 'lsx-health-plan-actions'); ?> |
|
| 686 | + <input type="hidden" name="lsx-health-plan-id" value="<?php echo esc_attr(\lsx_health_plan\functions\plan\generate_section_id()); ?>" /> |
|
| 687 | + <button class="btn secondary-btn" type="submit"><?php esc_html_e('Im not done!', 'lsx-health-plan'); ?></button> |
|
| 688 | 688 | </form> |
| 689 | 689 | <?php lsx_health_plan_back_to_plan_button(); ?> |
| 690 | 690 | </div> |
@@ -698,8 +698,8 @@ discard block |
||
| 698 | 698 | * @return void |
| 699 | 699 | */ |
| 700 | 700 | function lsx_health_plan_single_nav() { |
| 701 | - $tab_template_path = apply_filters( 'lsx_health_plan_single_nav_path', LSX_HEALTH_PLAN_PATH . '/templates/single-plan-tabs.php' ); |
|
| 702 | - if ( '' !== $tab_template_path ) { |
|
| 701 | + $tab_template_path = apply_filters('lsx_health_plan_single_nav_path', LSX_HEALTH_PLAN_PATH . '/templates/single-plan-tabs.php'); |
|
| 702 | + if ('' !== $tab_template_path) { |
|
| 703 | 703 | require $tab_template_path; |
| 704 | 704 | } |
| 705 | 705 | } |
@@ -711,8 +711,8 @@ discard block |
||
| 711 | 711 | * @return void |
| 712 | 712 | */ |
| 713 | 713 | function lsx_health_plan_single_tabs() { |
| 714 | - $endpoint = get_query_var( 'endpoint' ); |
|
| 715 | - switch ( $endpoint ) { |
|
| 714 | + $endpoint = get_query_var('endpoint'); |
|
| 715 | + switch ($endpoint) { |
|
| 716 | 716 | case 'meal': |
| 717 | 717 | $tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-meal.php'; |
| 718 | 718 | break; |
@@ -733,8 +733,8 @@ discard block |
||
| 733 | 733 | $tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-plan.php'; |
| 734 | 734 | break; |
| 735 | 735 | } |
| 736 | - $tab_template_path = apply_filters( 'lsx_health_plan_single_tab_path', $tab_template_path ); |
|
| 737 | - if ( '' !== $tab_template_path ) { |
|
| 736 | + $tab_template_path = apply_filters('lsx_health_plan_single_tab_path', $tab_template_path); |
|
| 737 | + if ('' !== $tab_template_path) { |
|
| 738 | 738 | include $tab_template_path; |
| 739 | 739 | } |
| 740 | 740 | } |
@@ -754,9 +754,9 @@ discard block |
||
| 754 | 754 | * @return recipe_type |
| 755 | 755 | */ |
| 756 | 756 | function lsx_health_plan_recipe_type() { |
| 757 | - $term_obj_list = get_the_terms( get_the_ID(), 'recipe-type' ); |
|
| 757 | + $term_obj_list = get_the_terms(get_the_ID(), 'recipe-type'); |
|
| 758 | 758 | $recipe_type = $term_obj_list[0]->name; |
| 759 | - if ( ! empty( $recipe_type ) ) { |
|
| 759 | + if ( ! empty($recipe_type)) { |
|
| 760 | 760 | return $recipe_type; |
| 761 | 761 | } |
| 762 | 762 | } |
@@ -768,32 +768,32 @@ discard block |
||
| 768 | 768 | * @param array $group |
| 769 | 769 | * @return void |
| 770 | 770 | */ |
| 771 | -function lsx_health_plan_workout_video_play_button( $m, $group, $echo = true ) { |
|
| 771 | +function lsx_health_plan_workout_video_play_button($m, $group, $echo = true) { |
|
| 772 | 772 | $workout_video = ''; |
| 773 | 773 | $giphy = ''; |
| 774 | 774 | $youtube = ''; |
| 775 | - if ( isset( $group['connected_videos'] ) && '' !== $group['connected_videos'] ) { |
|
| 776 | - $workout_video = esc_html( $group['connected_videos'] ); |
|
| 777 | - $giphy = get_post_meta( $workout_video, 'video_giphy_source', true ); |
|
| 778 | - $youtube = esc_url( get_post_meta( $workout_video, 'video_youtube_source', 1 ) ); |
|
| 779 | - $content = get_post_field( 'post_content', $workout_video ); |
|
| 775 | + if (isset($group['connected_videos']) && '' !== $group['connected_videos']) { |
|
| 776 | + $workout_video = esc_html($group['connected_videos']); |
|
| 777 | + $giphy = get_post_meta($workout_video, 'video_giphy_source', true); |
|
| 778 | + $youtube = esc_url(get_post_meta($workout_video, 'video_youtube_source', 1)); |
|
| 779 | + $content = get_post_field('post_content', $workout_video); |
|
| 780 | 780 | $play_button = '<button data-toggle="modal" data-target="#workout-video-modal-' . $m . '"><span class="fa fa-play-circle"></span></button>'; |
| 781 | 781 | |
| 782 | 782 | $modal_body = ''; |
| 783 | - if ( ! empty( $giphy ) ) { |
|
| 784 | - $giphy = \lsx_health_plan\functions\get_video_url( $giphy ); |
|
| 783 | + if ( ! empty($giphy)) { |
|
| 784 | + $giphy = \lsx_health_plan\functions\get_video_url($giphy); |
|
| 785 | 785 | $modal_body = $giphy; // WPCS: XSS OK. |
| 786 | - } elseif ( ! empty( $youtube ) ) { |
|
| 787 | - $modal_body = wp_oembed_get( $youtube, array( // WPCS: XSS OK. |
|
| 786 | + } elseif ( ! empty($youtube)) { |
|
| 787 | + $modal_body = wp_oembed_get($youtube, array( // WPCS: XSS OK. |
|
| 788 | 788 | 'width' => 480, |
| 789 | - ) ); |
|
| 789 | + )); |
|
| 790 | 790 | } |
| 791 | 791 | $modal_body .= '<h5 class="modal-title title-lined">' . $group['name'] . '</h5>'; |
| 792 | 792 | $modal_body .= $content; |
| 793 | - \lsx_health_plan\functions\register_modal( 'workout-video-modal-' . $m, '', $modal_body ); |
|
| 793 | + \lsx_health_plan\functions\register_modal('workout-video-modal-' . $m, '', $modal_body); |
|
| 794 | 794 | |
| 795 | - if ( true === $echo ) { |
|
| 796 | - echo wp_kses_post( $play_button ); |
|
| 795 | + if (true === $echo) { |
|
| 796 | + echo wp_kses_post($play_button); |
|
| 797 | 797 | } else { |
| 798 | 798 | return $play_button; |
| 799 | 799 | } |
@@ -807,17 +807,17 @@ discard block |
||
| 807 | 807 | */ |
| 808 | 808 | function lsx_health_plan_recipe_archive_description() { |
| 809 | 809 | $description = ''; |
| 810 | - if ( is_post_type_archive( 'recipe' ) ) { |
|
| 811 | - $description = \lsx_health_plan\functions\get_option( 'recipe_archive_description', '' ); |
|
| 812 | - } elseif ( is_post_type_archive( 'exercise' ) ) { |
|
| 813 | - $description = \lsx_health_plan\functions\get_option( 'exercise_archive_description', '' ); |
|
| 814 | - } elseif ( is_tax() ) { |
|
| 810 | + if (is_post_type_archive('recipe')) { |
|
| 811 | + $description = \lsx_health_plan\functions\get_option('recipe_archive_description', ''); |
|
| 812 | + } elseif (is_post_type_archive('exercise')) { |
|
| 813 | + $description = \lsx_health_plan\functions\get_option('exercise_archive_description', ''); |
|
| 814 | + } elseif (is_tax()) { |
|
| 815 | 815 | $description = get_the_archive_description(); |
| 816 | 816 | } |
| 817 | - if ( '' !== $description ) { |
|
| 817 | + if ('' !== $description) { |
|
| 818 | 818 | ?> |
| 819 | 819 | <div class="lsx-hp-archive-description row"> |
| 820 | - <div class="col-xs-12 description-wrapper"><?php echo wp_kses_post( wpautop( $description ) ); ?></div> |
|
| 820 | + <div class="col-xs-12 description-wrapper"><?php echo wp_kses_post(wpautop($description)); ?></div> |
|
| 821 | 821 | </div> |
| 822 | 822 | <?php |
| 823 | 823 | } |
@@ -830,19 +830,19 @@ discard block |
||
| 830 | 830 | */ |
| 831 | 831 | function lsx_health_plan_workout_main_content() { |
| 832 | 832 | // Getting translated endpoint. |
| 833 | - $workout = \lsx_health_plan\functions\get_option( 'endpoint_workout', 'workout' ); |
|
| 833 | + $workout = \lsx_health_plan\functions\get_option('endpoint_workout', 'workout'); |
|
| 834 | 834 | |
| 835 | - $connected_members = get_post_meta( get_the_ID(), ( $workout . '_connected_team_member' ), true ); |
|
| 836 | - $small_description = get_post_meta( get_the_ID(), ( $workout . '_short_description' ), true ); |
|
| 835 | + $connected_members = get_post_meta(get_the_ID(), ($workout . '_connected_team_member'), true); |
|
| 836 | + $small_description = get_post_meta(get_the_ID(), ($workout . '_short_description'), true); |
|
| 837 | 837 | |
| 838 | 838 | $content = ''; |
| 839 | - if ( $small_description || $connected_members || lsx_health_plan_has_tips() ) { |
|
| 839 | + if ($small_description || $connected_members || lsx_health_plan_has_tips()) { |
|
| 840 | 840 | $content .= '<div class="set-box set content-box entry-content">'; |
| 841 | 841 | $content .= '<div class="the-content">'; |
| 842 | - $content .= lsx_hp_member_connected( $connected_members, $workout ); |
|
| 842 | + $content .= lsx_hp_member_connected($connected_members, $workout); |
|
| 843 | 843 | $content .= '<span>' . $small_description . '</span>'; |
| 844 | 844 | $content .= '</div>'; |
| 845 | - $content .= do_shortcode( '[lsx_health_plan_featured_tips_block]' ); |
|
| 845 | + $content .= do_shortcode('[lsx_health_plan_featured_tips_block]'); |
|
| 846 | 846 | $content .= '</div>'; |
| 847 | 847 | } |
| 848 | 848 | return $content; |
@@ -855,19 +855,19 @@ discard block |
||
| 855 | 855 | */ |
| 856 | 856 | function lsx_health_plan_meal_main_content() { |
| 857 | 857 | // Getting translated endpoint. |
| 858 | - $meal = \lsx_health_plan\functions\get_option( 'endpoint_meal', 'meal' ); |
|
| 858 | + $meal = \lsx_health_plan\functions\get_option('endpoint_meal', 'meal'); |
|
| 859 | 859 | |
| 860 | - $connected_members = get_post_meta( get_the_ID(), ( $meal . '_connected_team_member' ), true ); |
|
| 861 | - $small_description = get_post_meta( get_the_ID(), ( $meal . '_short_description' ), true ); |
|
| 860 | + $connected_members = get_post_meta(get_the_ID(), ($meal . '_connected_team_member'), true); |
|
| 861 | + $small_description = get_post_meta(get_the_ID(), ($meal . '_short_description'), true); |
|
| 862 | 862 | |
| 863 | 863 | $content_meal = ''; |
| 864 | - if ( $small_description || $connected_members || lsx_health_plan_has_tips() ) { |
|
| 864 | + if ($small_description || $connected_members || lsx_health_plan_has_tips()) { |
|
| 865 | 865 | $content_meal .= '<div class="set-box set content-box entry-content">'; |
| 866 | 866 | $content_meal .= '<div class="the-content">'; |
| 867 | - $content_meal .= lsx_hp_member_connected( $connected_members, $meal ); |
|
| 867 | + $content_meal .= lsx_hp_member_connected($connected_members, $meal); |
|
| 868 | 868 | $content_meal .= '<span>' . $small_description . '</span>'; |
| 869 | 869 | $content_meal .= '</div>'; |
| 870 | - $content_meal .= do_shortcode( '[lsx_health_plan_featured_tips_block]' ); |
|
| 870 | + $content_meal .= do_shortcode('[lsx_health_plan_featured_tips_block]'); |
|
| 871 | 871 | $content_meal .= '</div>'; |
| 872 | 872 | } |
| 873 | 873 | return $content_meal; |
@@ -880,21 +880,21 @@ discard block |
||
| 880 | 880 | * @param string $index |
| 881 | 881 | * @return void |
| 882 | 882 | */ |
| 883 | -function lsx_health_plan_workout_tab_content( $index = 1 ) { |
|
| 884 | - global $group_name,$shortcode_args; |
|
| 883 | +function lsx_health_plan_workout_tab_content($index = 1) { |
|
| 884 | + global $group_name, $shortcode_args; |
|
| 885 | 885 | $group_name = 'workout_section_' . $index; |
| 886 | - if ( false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) { |
|
| 887 | - $layout = strtolower( \lsx_health_plan\functions\get_option( 'workout_tab_layout', 'table' ) ); |
|
| 886 | + if (false !== \lsx_health_plan\functions\get_option('exercise_enabled', false)) { |
|
| 887 | + $layout = strtolower(\lsx_health_plan\functions\get_option('workout_tab_layout', 'table')); |
|
| 888 | 888 | |
| 889 | 889 | // Check for shortcode overrides. |
| 890 | - if ( null !== $shortcode_args && isset( $shortcode_args['layout'] ) ) { |
|
| 890 | + if (null !== $shortcode_args && isset($shortcode_args['layout'])) { |
|
| 891 | 891 | $layout = $shortcode_args['layout']; |
| 892 | 892 | } |
| 893 | 893 | } else { |
| 894 | 894 | $layout = 'table'; |
| 895 | 895 | } |
| 896 | 896 | |
| 897 | - switch ( $layout ) { |
|
| 897 | + switch ($layout) { |
|
| 898 | 898 | case 'list': |
| 899 | 899 | $tab_template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-list.php'; |
| 900 | 900 | break; |
@@ -907,8 +907,8 @@ discard block |
||
| 907 | 907 | $tab_template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-table.php'; |
| 908 | 908 | break; |
| 909 | 909 | } |
| 910 | - $tab_template_path = apply_filters( 'lsx_health_plan_workout_tab_content_path', $tab_template_path ); |
|
| 911 | - if ( '' !== $tab_template_path ) { |
|
| 910 | + $tab_template_path = apply_filters('lsx_health_plan_workout_tab_content_path', $tab_template_path); |
|
| 911 | + if ('' !== $tab_template_path) { |
|
| 912 | 912 | include $tab_template_path; |
| 913 | 913 | } |
| 914 | 914 | } |
@@ -919,26 +919,26 @@ discard block |
||
| 919 | 919 | * @return void |
| 920 | 920 | */ |
| 921 | 921 | function lsx_health_plan_workout_sets() { |
| 922 | - if ( is_singular( 'workout' ) ) { |
|
| 922 | + if (is_singular('workout')) { |
|
| 923 | 923 | global $connected_workouts; |
| 924 | - $connected_workouts = array( get_the_ID() ); |
|
| 924 | + $connected_workouts = array(get_the_ID()); |
|
| 925 | 925 | } |
| 926 | - if ( is_singular( 'plan' ) ) { |
|
| 926 | + if (is_singular('plan')) { |
|
| 927 | 927 | |
| 928 | 928 | global $connected_workouts; |
| 929 | 929 | |
| 930 | - $section_key = get_query_var( 'section' ); |
|
| 931 | - if ( '' !== $section && \lsx_health_plan\functions\plan\has_sections() ) { |
|
| 932 | - $section_info = \lsx_health_plan\functions\plan\get_section_info( $section_key ); |
|
| 933 | - if ( isset( $section_info['connected_workouts'] ) && '' !== $section_info['connected_workouts'] ) { |
|
| 930 | + $section_key = get_query_var('section'); |
|
| 931 | + if ('' !== $section && \lsx_health_plan\functions\plan\has_sections()) { |
|
| 932 | + $section_info = \lsx_health_plan\functions\plan\get_section_info($section_key); |
|
| 933 | + if (isset($section_info['connected_workouts']) && '' !== $section_info['connected_workouts']) { |
|
| 934 | 934 | |
| 935 | - $connected_workouts = \lsx_health_plan\functions\prep_array( $section_info['connected_workouts'] ); |
|
| 935 | + $connected_workouts = \lsx_health_plan\functions\prep_array($section_info['connected_workouts']); |
|
| 936 | 936 | } |
| 937 | 937 | } |
| 938 | 938 | } |
| 939 | 939 | $template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-sets.php'; |
| 940 | - $template_path = apply_filters( 'lsx_health_plan_workout_set_template_path', $template_path ); |
|
| 941 | - if ( '' !== $template_path && ! empty( $template_path ) ) { |
|
| 940 | + $template_path = apply_filters('lsx_health_plan_workout_set_template_path', $template_path); |
|
| 941 | + if ('' !== $template_path && ! empty($template_path)) { |
|
| 942 | 942 | include $template_path; |
| 943 | 943 | } |
| 944 | 944 | } |
@@ -949,46 +949,46 @@ discard block |
||
| 949 | 949 | * @param array $args |
| 950 | 950 | * @return void |
| 951 | 951 | */ |
| 952 | -function lsx_hp_meal_plan_recipes( $args = array() ) { |
|
| 952 | +function lsx_hp_meal_plan_recipes($args = array()) { |
|
| 953 | 953 | $defaults = array( |
| 954 | 954 | 'meal_id' => false, |
| 955 | 955 | 'meal_time' => '', |
| 956 | 956 | 'modal' => true, |
| 957 | 957 | ); |
| 958 | - $args = wp_parse_args( $args, $defaults ); |
|
| 958 | + $args = wp_parse_args($args, $defaults); |
|
| 959 | 959 | // Looking for recipes. |
| 960 | - $connected_recipes = get_post_meta( $args['meal_id'], $args['meal_time'] . '_recipes', true ); |
|
| 961 | - if ( ! empty( $connected_recipes ) ) { |
|
| 962 | - $query_args = array( |
|
| 960 | + $connected_recipes = get_post_meta($args['meal_id'], $args['meal_time'] . '_recipes', true); |
|
| 961 | + if ( ! empty($connected_recipes)) { |
|
| 962 | + $query_args = array( |
|
| 963 | 963 | 'orderby' => 'date', |
| 964 | 964 | 'order' => 'DESC', |
| 965 | 965 | 'post_type' => 'recipe', |
| 966 | 966 | 'post__in' => $connected_recipes, |
| 967 | 967 | ); |
| 968 | - $recipes = new WP_Query( $query_args ); |
|
| 968 | + $recipes = new WP_Query($query_args); |
|
| 969 | 969 | ?> |
| 970 | 970 | <div class="recipes"> |
| 971 | 971 | <div class="row eating-row"> |
| 972 | 972 | <?php |
| 973 | - if ( $recipes->have_posts() ) { |
|
| 974 | - while ( $recipes->have_posts() ) { |
|
| 973 | + if ($recipes->have_posts()) { |
|
| 974 | + while ($recipes->have_posts()) { |
|
| 975 | 975 | $recipes->the_post(); |
| 976 | - if ( false !== $args['modal'] ) { |
|
| 976 | + if (false !== $args['modal']) { |
|
| 977 | 977 | \lsx_health_plan\functions\recipes\register_recipe_modal(); |
| 978 | 978 | } |
| 979 | 979 | ?> |
| 980 | 980 | <div class="recipe-column"> |
| 981 | - <a data-toggle="modal" data-target="#recipe-modal-<?php echo esc_attr( get_the_ID() ); ?>" href="#recipe-modal-<?php echo esc_attr( get_the_ID() ); ?>" class="recipe-box box-shadow"> |
|
| 981 | + <a data-toggle="modal" data-target="#recipe-modal-<?php echo esc_attr(get_the_ID()); ?>" href="#recipe-modal-<?php echo esc_attr(get_the_ID()); ?>" class="recipe-box box-shadow"> |
|
| 982 | 982 | <div class="recipe-feature-img"> |
| 983 | 983 | <?php |
| 984 | 984 | $featured_image = get_the_post_thumbnail(); |
| 985 | - if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
| 986 | - the_post_thumbnail( 'lsx-thumbnail-square', array( |
|
| 985 | + if ( ! empty($featured_image) && '' !== $featured_image) { |
|
| 986 | + the_post_thumbnail('lsx-thumbnail-square', array( |
|
| 987 | 987 | 'class' => 'aligncenter', |
| 988 | - ) ); |
|
| 988 | + )); |
|
| 989 | 989 | } else { |
| 990 | 990 | ?> |
| 991 | - <img loading="lazy" class="placeholder" src="<?php echo esc_attr( plugin_dir_url( __DIR__ ) . 'assets/images/placeholder.jpg' ); ?>"> |
|
| 991 | + <img loading="lazy" class="placeholder" src="<?php echo esc_attr(plugin_dir_url(__DIR__) . 'assets/images/placeholder.jpg'); ?>"> |
|
| 992 | 992 | <?php |
| 993 | 993 | } |
| 994 | 994 | ?> |
@@ -1014,25 +1014,25 @@ discard block |
||
| 1014 | 1014 | /** |
| 1015 | 1015 | * Output the connected. |
| 1016 | 1016 | */ |
| 1017 | -function lsx_hp_recipe_plan_meta( $args = array() ) { |
|
| 1017 | +function lsx_hp_recipe_plan_meta($args = array()) { |
|
| 1018 | 1018 | $defaults = array(); |
| 1019 | 1019 | $top_level_plans = array(); |
| 1020 | 1020 | // Get meals this exercise is connected to. |
| 1021 | - $plans = get_post_meta( get_the_ID(), 'connected_plans', true ); |
|
| 1022 | - if ( ! empty( $plans ) ) { |
|
| 1023 | - $plan = end( $plans ); |
|
| 1024 | - $has_parent = wp_get_post_parent_id( $plan ); |
|
| 1025 | - if ( 0 === $has_parent ) { |
|
| 1021 | + $plans = get_post_meta(get_the_ID(), 'connected_plans', true); |
|
| 1022 | + if ( ! empty($plans)) { |
|
| 1023 | + $plan = end($plans); |
|
| 1024 | + $has_parent = wp_get_post_parent_id($plan); |
|
| 1025 | + if (0 === $has_parent) { |
|
| 1026 | 1026 | $top_level_plans[] = $plan; |
| 1027 | - } elseif ( false !== $top_level_plans ) { |
|
| 1027 | + } elseif (false !== $top_level_plans) { |
|
| 1028 | 1028 | $top_level_plans[] = $has_parent; |
| 1029 | 1029 | } |
| 1030 | 1030 | } |
| 1031 | - if ( ! empty( $top_level_plans ) && ( '' !== $top_level_plans ) ) { |
|
| 1032 | - $top_level_plans = array_unique( $top_level_plans ); |
|
| 1033 | - $top_level_plan = end( $top_level_plans ); |
|
| 1031 | + if ( ! empty($top_level_plans) && ('' !== $top_level_plans)) { |
|
| 1032 | + $top_level_plans = array_unique($top_level_plans); |
|
| 1033 | + $top_level_plan = end($top_level_plans); |
|
| 1034 | 1034 | ?> |
| 1035 | - <span class="recipe-type recipe-parent"><?php echo esc_html( get_the_title( $top_level_plan ) ); ?></span> |
|
| 1035 | + <span class="recipe-type recipe-parent"><?php echo esc_html(get_the_title($top_level_plan)); ?></span> |
|
| 1036 | 1036 | <?php |
| 1037 | 1037 | } |
| 1038 | 1038 | } |
@@ -1045,23 +1045,23 @@ discard block |
||
| 1045 | 1045 | $top_level_plans = array(); |
| 1046 | 1046 | |
| 1047 | 1047 | // Get workouts this exercise is connected to. |
| 1048 | - $workouts = get_post_meta( get_the_ID(), 'connected_workouts', true ); |
|
| 1048 | + $workouts = get_post_meta(get_the_ID(), 'connected_workouts', true); |
|
| 1049 | 1049 | |
| 1050 | - if ( '' !== $workouts && ! is_array( $workouts ) ) { |
|
| 1051 | - $workouts = array( $workouts ); |
|
| 1050 | + if ('' !== $workouts && ! is_array($workouts)) { |
|
| 1051 | + $workouts = array($workouts); |
|
| 1052 | 1052 | } |
| 1053 | - if ( ! empty( $workouts ) ) { |
|
| 1054 | - foreach ( $workouts as $workout ) { |
|
| 1053 | + if ( ! empty($workouts)) { |
|
| 1054 | + foreach ($workouts as $workout) { |
|
| 1055 | 1055 | // Get the plans this workout is connected to. |
| 1056 | - $plans = get_post_meta( $workout, 'connected_plans', true ); |
|
| 1056 | + $plans = get_post_meta($workout, 'connected_plans', true); |
|
| 1057 | 1057 | |
| 1058 | - if ( '' !== $plans && ! is_array( $plans ) ) { |
|
| 1059 | - $plans = array( $plans ); |
|
| 1058 | + if ('' !== $plans && ! is_array($plans)) { |
|
| 1059 | + $plans = array($plans); |
|
| 1060 | 1060 | } |
| 1061 | - if ( ! empty( $plans ) ) { |
|
| 1062 | - foreach ( $plans as $plan ) { |
|
| 1063 | - $has_parent = wp_get_post_parent_id( $plan ); |
|
| 1064 | - if ( 0 === $has_parent ) { |
|
| 1061 | + if ( ! empty($plans)) { |
|
| 1062 | + foreach ($plans as $plan) { |
|
| 1063 | + $has_parent = wp_get_post_parent_id($plan); |
|
| 1064 | + if (0 === $has_parent) { |
|
| 1065 | 1065 | $top_level_plans = $plan; |
| 1066 | 1066 | } else { |
| 1067 | 1067 | $top_level_plans = $has_parent; |
@@ -1071,11 +1071,11 @@ discard block |
||
| 1071 | 1071 | } |
| 1072 | 1072 | } |
| 1073 | 1073 | |
| 1074 | - if ( ! empty( $top_level_plans ) && ( '' !== $top_level_plans ) ) { |
|
| 1075 | - $top_level_plans = array_unique( $top_level_plans ); |
|
| 1076 | - $top_level_plan = end( $top_level_plans ); |
|
| 1074 | + if ( ! empty($top_level_plans) && ('' !== $top_level_plans)) { |
|
| 1075 | + $top_level_plans = array_unique($top_level_plans); |
|
| 1076 | + $top_level_plan = end($top_level_plans); |
|
| 1077 | 1077 | ?> |
| 1078 | - <span class="recipe-type recipe-parent"><?php echo esc_html( get_the_title( $top_level_plan ) ); ?></span> |
|
| 1078 | + <span class="recipe-type recipe-parent"><?php echo esc_html(get_the_title($top_level_plan)); ?></span> |
|
| 1079 | 1079 | <?php |
| 1080 | 1080 | } |
| 1081 | 1081 | } |
@@ -1086,12 +1086,12 @@ discard block |
||
| 1086 | 1086 | * @param [type] $related_content |
| 1087 | 1087 | * @return void |
| 1088 | 1088 | */ |
| 1089 | -function lsx_hp_single_related( $related_content, $post_type_text ) { |
|
| 1089 | +function lsx_hp_single_related($related_content, $post_type_text) { |
|
| 1090 | 1090 | ?> |
| 1091 | 1091 | <section id="lsx-hp-related"> |
| 1092 | 1092 | <div class="row lsx-related-posts lsx-related-posts-title"> |
| 1093 | 1093 | <div class="col-xs-12"> |
| 1094 | - <h2 class="lsx-related-posts-headline"><?php echo esc_html( $post_type_text ); ?></h2> |
|
| 1094 | + <h2 class="lsx-related-posts-headline"><?php echo esc_html($post_type_text); ?></h2> |
|
| 1095 | 1095 | </div> |
| 1096 | 1096 | </div> |
| 1097 | 1097 | <div class="row lsx-related-posts lsx-related-posts-content"> |
@@ -1099,26 +1099,26 @@ discard block |
||
| 1099 | 1099 | <div class="lsx-related-posts-wrapper"> |
| 1100 | 1100 | <?php |
| 1101 | 1101 | $i = 0; |
| 1102 | - foreach ( $related_content as $article ) { |
|
| 1103 | - $post_title = get_the_title( $article ); |
|
| 1104 | - $post_categories = wp_get_post_categories( $article ); |
|
| 1105 | - $post_link = get_permalink( $article ); |
|
| 1102 | + foreach ($related_content as $article) { |
|
| 1103 | + $post_title = get_the_title($article); |
|
| 1104 | + $post_categories = wp_get_post_categories($article); |
|
| 1105 | + $post_link = get_permalink($article); |
|
| 1106 | 1106 | |
| 1107 | 1107 | $cats = array(); |
| 1108 | 1108 | ?> |
| 1109 | - <article id="post-<?php echo esc_html( $article ); ?>" class="lsx-slot post"> |
|
| 1109 | + <article id="post-<?php echo esc_html($article); ?>" class="lsx-slot post"> |
|
| 1110 | 1110 | <div class="entry-layout lsx-hp-shadow"> |
| 1111 | 1111 | <div class="entry-layout-content"> |
| 1112 | 1112 | <header class="entry-header"> |
| 1113 | 1113 | <div class="entry-image"> |
| 1114 | - <a href="<?php echo esc_url( $post_link ); ?>" class="thumbnail"> |
|
| 1114 | + <a href="<?php echo esc_url($post_link); ?>" class="thumbnail"> |
|
| 1115 | 1115 | <?php |
| 1116 | - $featured_image = get_the_post_thumbnail( $article, 'lsx-thumbnail-wide' ); |
|
| 1117 | - if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
| 1118 | - echo wp_kses_post( $featured_image ); |
|
| 1116 | + $featured_image = get_the_post_thumbnail($article, 'lsx-thumbnail-wide'); |
|
| 1117 | + if ( ! empty($featured_image) && '' !== $featured_image) { |
|
| 1118 | + echo wp_kses_post($featured_image); |
|
| 1119 | 1119 | } else { |
| 1120 | 1120 | ?> |
| 1121 | - <img loading="lazy" class="placeholder" src="<?php echo esc_attr( plugin_dir_url( __FILE__ ) . '../assets/images/placeholder.jpg' ); ?>"> |
|
| 1121 | + <img loading="lazy" class="placeholder" src="<?php echo esc_attr(plugin_dir_url(__FILE__) . '../assets/images/placeholder.jpg'); ?>"> |
|
| 1122 | 1122 | <?php |
| 1123 | 1123 | } |
| 1124 | 1124 | ?> |
@@ -1126,18 +1126,18 @@ discard block |
||
| 1126 | 1126 | </div> |
| 1127 | 1127 | <div class="entry-meta"> |
| 1128 | 1128 | <?php |
| 1129 | - foreach ( $post_categories as $c ) { |
|
| 1130 | - $cat = get_category( $c ); |
|
| 1129 | + foreach ($post_categories as $c) { |
|
| 1130 | + $cat = get_category($c); |
|
| 1131 | 1131 | /* Translators: %s: category name */ |
| 1132 | - $cats[] = '<a href="' . esc_url( get_category_link( $cat->term_id ) ) . '" title="' . sprintf( esc_html__( 'Posts in %s', 'lsx-blog-customizer' ), $cat->name ) . '">' . $cat->name . '</a>'; |
|
| 1132 | + $cats[] = '<a href="' . esc_url(get_category_link($cat->term_id)) . '" title="' . sprintf(esc_html__('Posts in %s', 'lsx-blog-customizer'), $cat->name) . '">' . $cat->name . '</a>'; |
|
| 1133 | 1133 | } |
| 1134 | - if ( ! empty( $cats ) ) { ?> |
|
| 1135 | - <div class="post-categories"><span></span><?php echo wp_kses_post( implode( ', ', $cats ) ); ?></div> |
|
| 1134 | + if ( ! empty($cats)) { ?> |
|
| 1135 | + <div class="post-categories"><span></span><?php echo wp_kses_post(implode(', ', $cats)); ?></div> |
|
| 1136 | 1136 | <?php } ?> |
| 1137 | 1137 | </div> |
| 1138 | 1138 | <h2 class="entry-title"> |
| 1139 | - <a href="<?php echo esc_url( $post_link ); ?>"> |
|
| 1140 | - <?php echo esc_html( $post_title ); ?> |
|
| 1139 | + <a href="<?php echo esc_url($post_link); ?>"> |
|
| 1140 | + <?php echo esc_html($post_title); ?> |
|
| 1141 | 1141 | </a> |
| 1142 | 1142 | </h2> |
| 1143 | 1143 | </header> |
@@ -1161,27 +1161,27 @@ discard block |
||
| 1161 | 1161 | * @param [type] $connected_members |
| 1162 | 1162 | * @return void |
| 1163 | 1163 | */ |
| 1164 | -function lsx_hp_member_connected( $connected_members, $post_type ) { |
|
| 1165 | - if ( ! empty( $connected_members ) ) { |
|
| 1164 | +function lsx_hp_member_connected($connected_members, $post_type) { |
|
| 1165 | + if ( ! empty($connected_members)) { |
|
| 1166 | 1166 | $content = '<div id="hp-connected-members" class="hp-connected-members connected-' . $post_type . '">'; |
| 1167 | - foreach ( $connected_members as $member ) { |
|
| 1168 | - $post_link = get_permalink( $member ); |
|
| 1169 | - $member_name = get_the_title( $member ); |
|
| 1167 | + foreach ($connected_members as $member) { |
|
| 1168 | + $post_link = get_permalink($member); |
|
| 1169 | + $member_name = get_the_title($member); |
|
| 1170 | 1170 | $member_name = '<span class="lsx-team-name">' . $member_name . '</span>'; |
| 1171 | 1171 | |
| 1172 | 1172 | $member_link = '<a href="' . $post_link . '" >' . $member_name . '</a>'; |
| 1173 | 1173 | |
| 1174 | 1174 | $roles = ''; |
| 1175 | - $terms = get_the_terms( $member, 'team_role' ); |
|
| 1175 | + $terms = get_the_terms($member, 'team_role'); |
|
| 1176 | 1176 | |
| 1177 | - if ( $terms && ! is_wp_error( $terms ) ) { |
|
| 1177 | + if ($terms && ! is_wp_error($terms)) { |
|
| 1178 | 1178 | $roles = array(); |
| 1179 | 1179 | |
| 1180 | - foreach ( $terms as $term ) { |
|
| 1180 | + foreach ($terms as $term) { |
|
| 1181 | 1181 | $roles[] = $term->name; |
| 1182 | 1182 | } |
| 1183 | 1183 | |
| 1184 | - $roles = join( ', ', $roles ); |
|
| 1184 | + $roles = join(', ', $roles); |
|
| 1185 | 1185 | } |
| 1186 | 1186 | $member_roles = '' !== $roles ? "<small class='lsx-team-roles'>$roles</small>" : ''; |
| 1187 | 1187 | |
@@ -11,10 +11,10 @@ discard block |
||
| 11 | 11 | * @return exercise_type |
| 12 | 12 | */ |
| 13 | 13 | function lsx_health_plan_exercise_type() { |
| 14 | - $term_obj_list = get_the_term_list( get_the_ID(), 'exercise-type', '', ', ' ); |
|
| 15 | - if ( ! empty( $term_obj_list ) ) { |
|
| 16 | - return $term_obj_list; |
|
| 17 | - } |
|
| 14 | + $term_obj_list = get_the_term_list( get_the_ID(), 'exercise-type', '', ', ' ); |
|
| 15 | + if ( ! empty( $term_obj_list ) ) { |
|
| 16 | + return $term_obj_list; |
|
| 17 | + } |
|
| 18 | 18 | } |
| 19 | 19 | |
| 20 | 20 | /** |
@@ -23,10 +23,10 @@ discard block |
||
| 23 | 23 | * @return muscle_group_equipment |
| 24 | 24 | */ |
| 25 | 25 | function lsx_health_plan_muscle_group_equipment() { |
| 26 | - $term_obj_list = get_the_term_list( get_the_ID(), 'muscle-group', '', ', ' ); |
|
| 27 | - if ( ! empty( $term_obj_list ) ) { |
|
| 28 | - return $term_obj_list; |
|
| 29 | - } |
|
| 26 | + $term_obj_list = get_the_term_list( get_the_ID(), 'muscle-group', '', ', ' ); |
|
| 27 | + if ( ! empty( $term_obj_list ) ) { |
|
| 28 | + return $term_obj_list; |
|
| 29 | + } |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | /** |
@@ -35,10 +35,10 @@ discard block |
||
| 35 | 35 | * @return exercise_equipment |
| 36 | 36 | */ |
| 37 | 37 | function lsx_health_plan_exercise_equipment() { |
| 38 | - $term_obj_list = get_the_term_list( get_the_ID(), 'equipment', '', ', ' ); |
|
| 39 | - if ( ! empty( $term_obj_list ) ) { |
|
| 40 | - return $term_obj_list; |
|
| 41 | - } |
|
| 38 | + $term_obj_list = get_the_term_list( get_the_ID(), 'equipment', '', ', ' ); |
|
| 39 | + if ( ! empty( $term_obj_list ) ) { |
|
| 40 | + return $term_obj_list; |
|
| 41 | + } |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | /** |
@@ -47,81 +47,81 @@ discard block |
||
| 47 | 47 | * @return void |
| 48 | 48 | */ |
| 49 | 49 | function lsx_health_plan_exercise_data() { |
| 50 | - include LSX_HEALTH_PLAN_PATH . '/templates/table-exercise-data.php'; |
|
| 50 | + include LSX_HEALTH_PLAN_PATH . '/templates/table-exercise-data.php'; |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | function lsx_health_plan_workout_exercise_alt_button( $m, $group, $echo = true, $args = array(), $alt_title, $alt_description, $alt_image ) { |
| 54 | - $defaults = array( |
|
| 55 | - 'modal_trigger' => 'button', |
|
| 56 | - 'modal_content' => 'excerpt', |
|
| 57 | - ); |
|
| 58 | - $args = wp_parse_args( $args, $defaults ); |
|
| 54 | + $defaults = array( |
|
| 55 | + 'modal_trigger' => 'button', |
|
| 56 | + 'modal_content' => 'excerpt', |
|
| 57 | + ); |
|
| 58 | + $args = wp_parse_args( $args, $defaults ); |
|
| 59 | 59 | |
| 60 | - $exercise_id = ''; |
|
| 61 | - if ( isset( $group['connected_exercises'] ) && '' !== $group['connected_exercises'] ) { |
|
| 62 | - $exercise_id = esc_html( $group['connected_exercises'] ); |
|
| 63 | - $content = get_post_field( 'post_content', $exercise_id ); |
|
| 64 | - $url = get_permalink( $exercise_id ); |
|
| 65 | - $equipment_group = get_the_term_list( $exercise_id, 'equipment', '', ', ' ); |
|
| 66 | - $muscle_group = get_the_term_list( $exercise_id, 'muscle-group', '', ', ' ); |
|
| 67 | - $lsx_hp = lsx_health_plan(); |
|
| 60 | + $exercise_id = ''; |
|
| 61 | + if ( isset( $group['connected_exercises'] ) && '' !== $group['connected_exercises'] ) { |
|
| 62 | + $exercise_id = esc_html( $group['connected_exercises'] ); |
|
| 63 | + $content = get_post_field( 'post_content', $exercise_id ); |
|
| 64 | + $url = get_permalink( $exercise_id ); |
|
| 65 | + $equipment_group = get_the_term_list( $exercise_id, 'equipment', '', ', ' ); |
|
| 66 | + $muscle_group = get_the_term_list( $exercise_id, 'muscle-group', '', ', ' ); |
|
| 67 | + $lsx_hp = lsx_health_plan(); |
|
| 68 | 68 | |
| 69 | - if ( 'excerpt' === $args['modal_content'] ) { |
|
| 70 | - $content = wp_trim_words( $content, 40 ); |
|
| 71 | - } |
|
| 69 | + if ( 'excerpt' === $args['modal_content'] ) { |
|
| 70 | + $content = wp_trim_words( $content, 40 ); |
|
| 71 | + } |
|
| 72 | 72 | |
| 73 | - if ( 'link' ) { |
|
| 74 | - $play_button = '<a data-toggle="modal" href="#workout-alt-exercise-modal-' . $m . '">' . get_the_title( $exercise_id ) . '</a>'; |
|
| 75 | - } else { |
|
| 76 | - $play_button = '<button data-toggle="alt-modal" data-target="#workout-alt-exercise-modal-' . $m . '"><span class="fa fa-play-circle"></span></button>'; |
|
| 77 | - } |
|
| 73 | + if ( 'link' ) { |
|
| 74 | + $play_button = '<a data-toggle="modal" href="#workout-alt-exercise-modal-' . $m . '">' . get_the_title( $exercise_id ) . '</a>'; |
|
| 75 | + } else { |
|
| 76 | + $play_button = '<button data-toggle="alt-modal" data-target="#workout-alt-exercise-modal-' . $m . '"><span class="fa fa-play-circle"></span></button>'; |
|
| 77 | + } |
|
| 78 | 78 | |
| 79 | - $modal_body = ''; |
|
| 79 | + $modal_body = ''; |
|
| 80 | 80 | |
| 81 | - if ( '' !== $alt_image && ! empty( $alt_image ) ) { |
|
| 82 | - $modal_body .= '<div class="modal-image"/><img alt="thumbnail" loading="lazy" class="aligncenter wp-post-image" src="' . $alt_image . '"></div>'; |
|
| 83 | - } else { |
|
| 84 | - if ( $lsx_hp->frontend->gallery->has_gallery( $exercise_id ) ) { |
|
| 85 | - $gallery_args = array( |
|
| 86 | - 'css_class' => 'modal-slider', |
|
| 87 | - ); |
|
| 88 | - $modal_body .= $lsx_hp->frontend->gallery->get_gallery( '', '', $gallery_args ); |
|
| 89 | - } else { |
|
| 90 | - $modal_body .= '<div class="modal-image"/>' . get_the_post_thumbnail( $exercise_id, 'large' ) . '</div>'; |
|
| 91 | - } |
|
| 92 | - } |
|
| 81 | + if ( '' !== $alt_image && ! empty( $alt_image ) ) { |
|
| 82 | + $modal_body .= '<div class="modal-image"/><img alt="thumbnail" loading="lazy" class="aligncenter wp-post-image" src="' . $alt_image . '"></div>'; |
|
| 83 | + } else { |
|
| 84 | + if ( $lsx_hp->frontend->gallery->has_gallery( $exercise_id ) ) { |
|
| 85 | + $gallery_args = array( |
|
| 86 | + 'css_class' => 'modal-slider', |
|
| 87 | + ); |
|
| 88 | + $modal_body .= $lsx_hp->frontend->gallery->get_gallery( '', '', $gallery_args ); |
|
| 89 | + } else { |
|
| 90 | + $modal_body .= '<div class="modal-image"/>' . get_the_post_thumbnail( $exercise_id, 'large' ) . '</div>'; |
|
| 91 | + } |
|
| 92 | + } |
|
| 93 | 93 | |
| 94 | - if ( '' !== $alt_title ) { |
|
| 95 | - $modal_body .= '<div class="title-lined exercise-modal"><h5 class="modal-title">' . $alt_title . '</h5>'; |
|
| 96 | - } else { |
|
| 97 | - $modal_body .= '<div class="title-lined exercise-modal"><h5 class="modal-title">' . get_the_title( $exercise_id ) . '</h5>'; |
|
| 98 | - } |
|
| 94 | + if ( '' !== $alt_title ) { |
|
| 95 | + $modal_body .= '<div class="title-lined exercise-modal"><h5 class="modal-title">' . $alt_title . '</h5>'; |
|
| 96 | + } else { |
|
| 97 | + $modal_body .= '<div class="title-lined exercise-modal"><h5 class="modal-title">' . get_the_title( $exercise_id ) . '</h5>'; |
|
| 98 | + } |
|
| 99 | 99 | |
| 100 | - if ( ! empty( $equipment_group ) ) { |
|
| 101 | - $modal_body .= '<span class="equipment-terms">Equipment: ' . $equipment_group . '</span>'; |
|
| 102 | - } |
|
| 103 | - if ( ! empty( $muscle_group ) ) { |
|
| 104 | - $modal_body .= '<span class="muscle-terms">Muscle Group: ' . $muscle_group . '</span>'; |
|
| 105 | - } |
|
| 106 | - $modal_body .= '</div>'; |
|
| 107 | - if ( '' !== $args['modal_content'] ) { |
|
| 108 | - if ( '' !== $alt_description ) { |
|
| 109 | - $modal_body .= '<div class="modal-excerpt"/>' . $alt_description . '</div>'; |
|
| 110 | - } else { |
|
| 111 | - $modal_body .= '<div class="modal-excerpt"/>' . $content . '</div>'; |
|
| 112 | - } |
|
| 113 | - } |
|
| 114 | - if ( 'excerpt' === $args['modal_content'] ) { |
|
| 115 | - $modal_body .= '<a class="moretag" target="_blank" href="' . $url . '">' . __( 'Read More', 'lsx-heal-plan' ) . '</a>'; |
|
| 116 | - } |
|
| 117 | - \lsx_health_plan\functions\register_modal( 'workout-alt-exercise-modal-' . $m, '', $modal_body ); |
|
| 100 | + if ( ! empty( $equipment_group ) ) { |
|
| 101 | + $modal_body .= '<span class="equipment-terms">Equipment: ' . $equipment_group . '</span>'; |
|
| 102 | + } |
|
| 103 | + if ( ! empty( $muscle_group ) ) { |
|
| 104 | + $modal_body .= '<span class="muscle-terms">Muscle Group: ' . $muscle_group . '</span>'; |
|
| 105 | + } |
|
| 106 | + $modal_body .= '</div>'; |
|
| 107 | + if ( '' !== $args['modal_content'] ) { |
|
| 108 | + if ( '' !== $alt_description ) { |
|
| 109 | + $modal_body .= '<div class="modal-excerpt"/>' . $alt_description . '</div>'; |
|
| 110 | + } else { |
|
| 111 | + $modal_body .= '<div class="modal-excerpt"/>' . $content . '</div>'; |
|
| 112 | + } |
|
| 113 | + } |
|
| 114 | + if ( 'excerpt' === $args['modal_content'] ) { |
|
| 115 | + $modal_body .= '<a class="moretag" target="_blank" href="' . $url . '">' . __( 'Read More', 'lsx-heal-plan' ) . '</a>'; |
|
| 116 | + } |
|
| 117 | + \lsx_health_plan\functions\register_modal( 'workout-alt-exercise-modal-' . $m, '', $modal_body ); |
|
| 118 | 118 | |
| 119 | - if ( true === $echo ) { |
|
| 120 | - echo wp_kses_post( $play_button ); |
|
| 121 | - } else { |
|
| 122 | - return $play_button; |
|
| 123 | - } |
|
| 124 | - } |
|
| 119 | + if ( true === $echo ) { |
|
| 120 | + echo wp_kses_post( $play_button ); |
|
| 121 | + } else { |
|
| 122 | + return $play_button; |
|
| 123 | + } |
|
| 124 | + } |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | /** |
@@ -134,65 +134,65 @@ discard block |
||
| 134 | 134 | * @return void |
| 135 | 135 | */ |
| 136 | 136 | function lsx_health_plan_workout_exercise_button( $m, $group, $echo = true, $args = array() ) { |
| 137 | - $defaults = array( |
|
| 138 | - 'modal_trigger' => 'button', |
|
| 139 | - 'modal_content' => 'excerpt', |
|
| 140 | - ); |
|
| 141 | - $args = wp_parse_args( $args, $defaults ); |
|
| 137 | + $defaults = array( |
|
| 138 | + 'modal_trigger' => 'button', |
|
| 139 | + 'modal_content' => 'excerpt', |
|
| 140 | + ); |
|
| 141 | + $args = wp_parse_args( $args, $defaults ); |
|
| 142 | 142 | |
| 143 | - $exercise_id = ''; |
|
| 144 | - if ( isset( $group['connected_exercises'] ) && '' !== $group['connected_exercises'] ) { |
|
| 145 | - $exercise_id = esc_html( $group['connected_exercises'] ); |
|
| 146 | - $content = get_post_field( 'post_content', $exercise_id ); |
|
| 147 | - $url = get_permalink( $exercise_id ); |
|
| 148 | - $equipment_group = get_the_term_list( $exercise_id, 'equipment', '', ', ' ); |
|
| 149 | - $muscle_group = get_the_term_list( $exercise_id, 'muscle-group', '', ', ' ); |
|
| 150 | - $lsx_hp = lsx_health_plan(); |
|
| 143 | + $exercise_id = ''; |
|
| 144 | + if ( isset( $group['connected_exercises'] ) && '' !== $group['connected_exercises'] ) { |
|
| 145 | + $exercise_id = esc_html( $group['connected_exercises'] ); |
|
| 146 | + $content = get_post_field( 'post_content', $exercise_id ); |
|
| 147 | + $url = get_permalink( $exercise_id ); |
|
| 148 | + $equipment_group = get_the_term_list( $exercise_id, 'equipment', '', ', ' ); |
|
| 149 | + $muscle_group = get_the_term_list( $exercise_id, 'muscle-group', '', ', ' ); |
|
| 150 | + $lsx_hp = lsx_health_plan(); |
|
| 151 | 151 | |
| 152 | - if ( 'excerpt' === $args['modal_content'] ) { |
|
| 153 | - $content = wp_trim_words( $content, 40 ); |
|
| 154 | - } |
|
| 152 | + if ( 'excerpt' === $args['modal_content'] ) { |
|
| 153 | + $content = wp_trim_words( $content, 40 ); |
|
| 154 | + } |
|
| 155 | 155 | |
| 156 | - if ( 'link' ) { |
|
| 157 | - $play_button = '<a data-toggle="modal" href="#workout-exercise-modal-' . $m . '">' . get_the_title( $exercise_id ) . '</a>'; |
|
| 158 | - } else { |
|
| 159 | - $play_button = '<button data-toggle="modal" data-target="#workout-exercise-modal-' . $m . '"><span class="fa fa-play-circle"></span></button>'; |
|
| 160 | - } |
|
| 156 | + if ( 'link' ) { |
|
| 157 | + $play_button = '<a data-toggle="modal" href="#workout-exercise-modal-' . $m . '">' . get_the_title( $exercise_id ) . '</a>'; |
|
| 158 | + } else { |
|
| 159 | + $play_button = '<button data-toggle="modal" data-target="#workout-exercise-modal-' . $m . '"><span class="fa fa-play-circle"></span></button>'; |
|
| 160 | + } |
|
| 161 | 161 | |
| 162 | - $modal_body = ''; |
|
| 162 | + $modal_body = ''; |
|
| 163 | 163 | |
| 164 | - if ( $lsx_hp->frontend->gallery->has_gallery( $exercise_id ) ) { |
|
| 165 | - $gallery_args = array( |
|
| 166 | - 'css_class' => 'modal-slider', |
|
| 167 | - ); |
|
| 168 | - $modal_body .= $lsx_hp->frontend->gallery->get_gallery( '', '', $gallery_args ); |
|
| 169 | - } else { |
|
| 170 | - $modal_body .= '<div class="modal-image"/>' . get_the_post_thumbnail( $exercise_id, 'large' ) . '</div>'; |
|
| 171 | - } |
|
| 164 | + if ( $lsx_hp->frontend->gallery->has_gallery( $exercise_id ) ) { |
|
| 165 | + $gallery_args = array( |
|
| 166 | + 'css_class' => 'modal-slider', |
|
| 167 | + ); |
|
| 168 | + $modal_body .= $lsx_hp->frontend->gallery->get_gallery( '', '', $gallery_args ); |
|
| 169 | + } else { |
|
| 170 | + $modal_body .= '<div class="modal-image"/>' . get_the_post_thumbnail( $exercise_id, 'large' ) . '</div>'; |
|
| 171 | + } |
|
| 172 | 172 | |
| 173 | - $modal_body .= '<div class="title-lined exercise-modal"><h5 class="modal-title">' . get_the_title( $exercise_id ) . '</h5>'; |
|
| 173 | + $modal_body .= '<div class="title-lined exercise-modal"><h5 class="modal-title">' . get_the_title( $exercise_id ) . '</h5>'; |
|
| 174 | 174 | |
| 175 | - if ( ! empty( $equipment_group ) ) { |
|
| 176 | - $modal_body .= '<span class="equipment-terms">Equipment: ' . $equipment_group . '</span>'; |
|
| 177 | - } |
|
| 178 | - if ( ! empty( $muscle_group ) ) { |
|
| 179 | - $modal_body .= '<span class="muscle-terms">Muscle Group: ' . $muscle_group . '</span>'; |
|
| 180 | - } |
|
| 181 | - $modal_body .= '</div>'; |
|
| 182 | - if ( '' !== $args['modal_content'] ) { |
|
| 183 | - $modal_body .= '<div class="modal-excerpt"/>' . $content . '</div>'; |
|
| 184 | - } |
|
| 185 | - if ( 'excerpt' === $args['modal_content'] ) { |
|
| 186 | - $modal_body .= '<a class="moretag" target="_blank" href="' . $url . '">' . __( 'Read More', 'lsx-heal-plan' ) . '</a>'; |
|
| 187 | - } |
|
| 188 | - \lsx_health_plan\functions\register_modal( 'workout-exercise-modal-' . $m, '', $modal_body ); |
|
| 175 | + if ( ! empty( $equipment_group ) ) { |
|
| 176 | + $modal_body .= '<span class="equipment-terms">Equipment: ' . $equipment_group . '</span>'; |
|
| 177 | + } |
|
| 178 | + if ( ! empty( $muscle_group ) ) { |
|
| 179 | + $modal_body .= '<span class="muscle-terms">Muscle Group: ' . $muscle_group . '</span>'; |
|
| 180 | + } |
|
| 181 | + $modal_body .= '</div>'; |
|
| 182 | + if ( '' !== $args['modal_content'] ) { |
|
| 183 | + $modal_body .= '<div class="modal-excerpt"/>' . $content . '</div>'; |
|
| 184 | + } |
|
| 185 | + if ( 'excerpt' === $args['modal_content'] ) { |
|
| 186 | + $modal_body .= '<a class="moretag" target="_blank" href="' . $url . '">' . __( 'Read More', 'lsx-heal-plan' ) . '</a>'; |
|
| 187 | + } |
|
| 188 | + \lsx_health_plan\functions\register_modal( 'workout-exercise-modal-' . $m, '', $modal_body ); |
|
| 189 | 189 | |
| 190 | - if ( true === $echo ) { |
|
| 191 | - echo wp_kses_post( $play_button ); |
|
| 192 | - } else { |
|
| 193 | - return $play_button; |
|
| 194 | - } |
|
| 195 | - } |
|
| 190 | + if ( true === $echo ) { |
|
| 191 | + echo wp_kses_post( $play_button ); |
|
| 192 | + } else { |
|
| 193 | + return $play_button; |
|
| 194 | + } |
|
| 195 | + } |
|
| 196 | 196 | } |
| 197 | 197 | |
| 198 | 198 | /** |
@@ -203,38 +203,38 @@ discard block |
||
| 203 | 203 | * @return void |
| 204 | 204 | */ |
| 205 | 205 | function lsx_health_plan_shortcode_exercise_button( $m, $content = true ) { |
| 206 | - $equipment_group = get_the_term_list( $m, 'equipment', '', ', ' ); |
|
| 207 | - $muscle_group = get_the_term_list( $m, 'muscle-group', '', ', ' ); |
|
| 208 | - $title = get_the_title(); |
|
| 209 | - $lsx_hp = lsx_health_plan(); |
|
| 210 | - $button = '<a data-toggle="modal" href="#exercise-modal-' . $m . '" data-target="#exercise-modal-' . $m . '"></a>'; |
|
| 206 | + $equipment_group = get_the_term_list( $m, 'equipment', '', ', ' ); |
|
| 207 | + $muscle_group = get_the_term_list( $m, 'muscle-group', '', ', ' ); |
|
| 208 | + $title = get_the_title(); |
|
| 209 | + $lsx_hp = lsx_health_plan(); |
|
| 210 | + $button = '<a data-toggle="modal" href="#exercise-modal-' . $m . '" data-target="#exercise-modal-' . $m . '"></a>'; |
|
| 211 | 211 | |
| 212 | - if ( true === $content ) { |
|
| 213 | - $content = get_the_content(); |
|
| 214 | - } |
|
| 212 | + if ( true === $content ) { |
|
| 213 | + $content = get_the_content(); |
|
| 214 | + } |
|
| 215 | 215 | |
| 216 | - $modal_body = ''; |
|
| 217 | - if ( $lsx_hp->frontend->gallery->has_gallery( $m ) ) { |
|
| 218 | - $gallery_args = array( |
|
| 219 | - 'css_class' => 'modal-slider', |
|
| 220 | - ); |
|
| 221 | - $modal_body .= $lsx_hp->frontend->gallery->get_gallery( '', '', $gallery_args ); |
|
| 222 | - } else { |
|
| 223 | - $modal_body .= '<div class="modal-image">' . get_the_post_thumbnail( $m, 'large' ) . '</div>'; |
|
| 224 | - } |
|
| 225 | - $modal_body .= '<div class="title-lined exercise-modal"><h5 class="modal-title">' . $title . '</h5>'; |
|
| 216 | + $modal_body = ''; |
|
| 217 | + if ( $lsx_hp->frontend->gallery->has_gallery( $m ) ) { |
|
| 218 | + $gallery_args = array( |
|
| 219 | + 'css_class' => 'modal-slider', |
|
| 220 | + ); |
|
| 221 | + $modal_body .= $lsx_hp->frontend->gallery->get_gallery( '', '', $gallery_args ); |
|
| 222 | + } else { |
|
| 223 | + $modal_body .= '<div class="modal-image">' . get_the_post_thumbnail( $m, 'large' ) . '</div>'; |
|
| 224 | + } |
|
| 225 | + $modal_body .= '<div class="title-lined exercise-modal"><h5 class="modal-title">' . $title . '</h5>'; |
|
| 226 | 226 | |
| 227 | - if ( ! empty( $equipment_group ) ) { |
|
| 228 | - $modal_body .= '<span class="equipment-terms">Equipment: ' . $equipment_group . '</span>'; |
|
| 229 | - } |
|
| 230 | - if ( ! empty( $muscle_group ) ) { |
|
| 231 | - $modal_body .= '<span class="muscle-terms">Muscle Group: ' . $muscle_group . '</span>'; |
|
| 232 | - } |
|
| 233 | - $modal_body .= '</div>'; |
|
| 234 | - $modal_body .= $content; |
|
| 235 | - \lsx_health_plan\functions\register_modal( 'exercise-modal-' . $m, '', $modal_body ); |
|
| 227 | + if ( ! empty( $equipment_group ) ) { |
|
| 228 | + $modal_body .= '<span class="equipment-terms">Equipment: ' . $equipment_group . '</span>'; |
|
| 229 | + } |
|
| 230 | + if ( ! empty( $muscle_group ) ) { |
|
| 231 | + $modal_body .= '<span class="muscle-terms">Muscle Group: ' . $muscle_group . '</span>'; |
|
| 232 | + } |
|
| 233 | + $modal_body .= '</div>'; |
|
| 234 | + $modal_body .= $content; |
|
| 235 | + \lsx_health_plan\functions\register_modal( 'exercise-modal-' . $m, '', $modal_body ); |
|
| 236 | 236 | |
| 237 | - return ( $button ); |
|
| 237 | + return ( $button ); |
|
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | /** |
@@ -246,18 +246,18 @@ discard block |
||
| 246 | 246 | * @return string |
| 247 | 247 | */ |
| 248 | 248 | function lsx_health_plan_exercise_title( $before = '', $after = '', $echo = true, $exercise_id = false ) { |
| 249 | - if ( false === $exercise_id ) { |
|
| 250 | - $exercise_id = get_the_ID(); |
|
| 251 | - } |
|
| 252 | - $title = get_the_title( $exercise_id ); |
|
| 253 | - $side = get_post_meta( $exercise_id, 'exercise_side', true ); |
|
| 254 | - if ( '' !== $side ) { |
|
| 255 | - $title .= ' - ' . ucwords( $side ); |
|
| 256 | - } |
|
| 257 | - $title = apply_filters( 'lsx_health_plan_exercise_title', $before . $title . $after, $title, $before, $after, $exercise_id ); |
|
| 258 | - if ( true === $echo ) { |
|
| 259 | - echo wp_kses_post( $title ); |
|
| 260 | - } else { |
|
| 261 | - return $title; |
|
| 262 | - } |
|
| 249 | + if ( false === $exercise_id ) { |
|
| 250 | + $exercise_id = get_the_ID(); |
|
| 251 | + } |
|
| 252 | + $title = get_the_title( $exercise_id ); |
|
| 253 | + $side = get_post_meta( $exercise_id, 'exercise_side', true ); |
|
| 254 | + if ( '' !== $side ) { |
|
| 255 | + $title .= ' - ' . ucwords( $side ); |
|
| 256 | + } |
|
| 257 | + $title = apply_filters( 'lsx_health_plan_exercise_title', $before . $title . $after, $title, $before, $after, $exercise_id ); |
|
| 258 | + if ( true === $echo ) { |
|
| 259 | + echo wp_kses_post( $title ); |
|
| 260 | + } else { |
|
| 261 | + return $title; |
|
| 262 | + } |
|
| 263 | 263 | } |
@@ -11,8 +11,8 @@ discard block |
||
| 11 | 11 | * @return exercise_type |
| 12 | 12 | */ |
| 13 | 13 | function lsx_health_plan_exercise_type() { |
| 14 | - $term_obj_list = get_the_term_list( get_the_ID(), 'exercise-type', '', ', ' ); |
|
| 15 | - if ( ! empty( $term_obj_list ) ) { |
|
| 14 | + $term_obj_list = get_the_term_list(get_the_ID(), 'exercise-type', '', ', '); |
|
| 15 | + if ( ! empty($term_obj_list)) { |
|
| 16 | 16 | return $term_obj_list; |
| 17 | 17 | } |
| 18 | 18 | } |
@@ -23,8 +23,8 @@ discard block |
||
| 23 | 23 | * @return muscle_group_equipment |
| 24 | 24 | */ |
| 25 | 25 | function lsx_health_plan_muscle_group_equipment() { |
| 26 | - $term_obj_list = get_the_term_list( get_the_ID(), 'muscle-group', '', ', ' ); |
|
| 27 | - if ( ! empty( $term_obj_list ) ) { |
|
| 26 | + $term_obj_list = get_the_term_list(get_the_ID(), 'muscle-group', '', ', '); |
|
| 27 | + if ( ! empty($term_obj_list)) { |
|
| 28 | 28 | return $term_obj_list; |
| 29 | 29 | } |
| 30 | 30 | } |
@@ -35,8 +35,8 @@ discard block |
||
| 35 | 35 | * @return exercise_equipment |
| 36 | 36 | */ |
| 37 | 37 | function lsx_health_plan_exercise_equipment() { |
| 38 | - $term_obj_list = get_the_term_list( get_the_ID(), 'equipment', '', ', ' ); |
|
| 39 | - if ( ! empty( $term_obj_list ) ) { |
|
| 38 | + $term_obj_list = get_the_term_list(get_the_ID(), 'equipment', '', ', '); |
|
| 39 | + if ( ! empty($term_obj_list)) { |
|
| 40 | 40 | return $term_obj_list; |
| 41 | 41 | } |
| 42 | 42 | } |
@@ -50,74 +50,74 @@ discard block |
||
| 50 | 50 | include LSX_HEALTH_PLAN_PATH . '/templates/table-exercise-data.php'; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | -function lsx_health_plan_workout_exercise_alt_button( $m, $group, $echo = true, $args = array(), $alt_title, $alt_description, $alt_image ) { |
|
| 53 | +function lsx_health_plan_workout_exercise_alt_button($m, $group, $echo = true, $args = array(), $alt_title, $alt_description, $alt_image) { |
|
| 54 | 54 | $defaults = array( |
| 55 | 55 | 'modal_trigger' => 'button', |
| 56 | 56 | 'modal_content' => 'excerpt', |
| 57 | 57 | ); |
| 58 | - $args = wp_parse_args( $args, $defaults ); |
|
| 58 | + $args = wp_parse_args($args, $defaults); |
|
| 59 | 59 | |
| 60 | 60 | $exercise_id = ''; |
| 61 | - if ( isset( $group['connected_exercises'] ) && '' !== $group['connected_exercises'] ) { |
|
| 62 | - $exercise_id = esc_html( $group['connected_exercises'] ); |
|
| 63 | - $content = get_post_field( 'post_content', $exercise_id ); |
|
| 64 | - $url = get_permalink( $exercise_id ); |
|
| 65 | - $equipment_group = get_the_term_list( $exercise_id, 'equipment', '', ', ' ); |
|
| 66 | - $muscle_group = get_the_term_list( $exercise_id, 'muscle-group', '', ', ' ); |
|
| 61 | + if (isset($group['connected_exercises']) && '' !== $group['connected_exercises']) { |
|
| 62 | + $exercise_id = esc_html($group['connected_exercises']); |
|
| 63 | + $content = get_post_field('post_content', $exercise_id); |
|
| 64 | + $url = get_permalink($exercise_id); |
|
| 65 | + $equipment_group = get_the_term_list($exercise_id, 'equipment', '', ', '); |
|
| 66 | + $muscle_group = get_the_term_list($exercise_id, 'muscle-group', '', ', '); |
|
| 67 | 67 | $lsx_hp = lsx_health_plan(); |
| 68 | 68 | |
| 69 | - if ( 'excerpt' === $args['modal_content'] ) { |
|
| 70 | - $content = wp_trim_words( $content, 40 ); |
|
| 69 | + if ('excerpt' === $args['modal_content']) { |
|
| 70 | + $content = wp_trim_words($content, 40); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - if ( 'link' ) { |
|
| 74 | - $play_button = '<a data-toggle="modal" href="#workout-alt-exercise-modal-' . $m . '">' . get_the_title( $exercise_id ) . '</a>'; |
|
| 73 | + if ('link') { |
|
| 74 | + $play_button = '<a data-toggle="modal" href="#workout-alt-exercise-modal-' . $m . '">' . get_the_title($exercise_id) . '</a>'; |
|
| 75 | 75 | } else { |
| 76 | 76 | $play_button = '<button data-toggle="alt-modal" data-target="#workout-alt-exercise-modal-' . $m . '"><span class="fa fa-play-circle"></span></button>'; |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - $modal_body = ''; |
|
| 79 | + $modal_body = ''; |
|
| 80 | 80 | |
| 81 | - if ( '' !== $alt_image && ! empty( $alt_image ) ) { |
|
| 81 | + if ('' !== $alt_image && ! empty($alt_image)) { |
|
| 82 | 82 | $modal_body .= '<div class="modal-image"/><img alt="thumbnail" loading="lazy" class="aligncenter wp-post-image" src="' . $alt_image . '"></div>'; |
| 83 | 83 | } else { |
| 84 | - if ( $lsx_hp->frontend->gallery->has_gallery( $exercise_id ) ) { |
|
| 84 | + if ($lsx_hp->frontend->gallery->has_gallery($exercise_id)) { |
|
| 85 | 85 | $gallery_args = array( |
| 86 | 86 | 'css_class' => 'modal-slider', |
| 87 | 87 | ); |
| 88 | - $modal_body .= $lsx_hp->frontend->gallery->get_gallery( '', '', $gallery_args ); |
|
| 88 | + $modal_body .= $lsx_hp->frontend->gallery->get_gallery('', '', $gallery_args); |
|
| 89 | 89 | } else { |
| 90 | - $modal_body .= '<div class="modal-image"/>' . get_the_post_thumbnail( $exercise_id, 'large' ) . '</div>'; |
|
| 90 | + $modal_body .= '<div class="modal-image"/>' . get_the_post_thumbnail($exercise_id, 'large') . '</div>'; |
|
| 91 | 91 | } |
| 92 | 92 | } |
| 93 | 93 | |
| 94 | - if ( '' !== $alt_title ) { |
|
| 94 | + if ('' !== $alt_title) { |
|
| 95 | 95 | $modal_body .= '<div class="title-lined exercise-modal"><h5 class="modal-title">' . $alt_title . '</h5>'; |
| 96 | 96 | } else { |
| 97 | - $modal_body .= '<div class="title-lined exercise-modal"><h5 class="modal-title">' . get_the_title( $exercise_id ) . '</h5>'; |
|
| 97 | + $modal_body .= '<div class="title-lined exercise-modal"><h5 class="modal-title">' . get_the_title($exercise_id) . '</h5>'; |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - if ( ! empty( $equipment_group ) ) { |
|
| 100 | + if ( ! empty($equipment_group)) { |
|
| 101 | 101 | $modal_body .= '<span class="equipment-terms">Equipment: ' . $equipment_group . '</span>'; |
| 102 | 102 | } |
| 103 | - if ( ! empty( $muscle_group ) ) { |
|
| 103 | + if ( ! empty($muscle_group)) { |
|
| 104 | 104 | $modal_body .= '<span class="muscle-terms">Muscle Group: ' . $muscle_group . '</span>'; |
| 105 | 105 | } |
| 106 | 106 | $modal_body .= '</div>'; |
| 107 | - if ( '' !== $args['modal_content'] ) { |
|
| 108 | - if ( '' !== $alt_description ) { |
|
| 107 | + if ('' !== $args['modal_content']) { |
|
| 108 | + if ('' !== $alt_description) { |
|
| 109 | 109 | $modal_body .= '<div class="modal-excerpt"/>' . $alt_description . '</div>'; |
| 110 | 110 | } else { |
| 111 | 111 | $modal_body .= '<div class="modal-excerpt"/>' . $content . '</div>'; |
| 112 | 112 | } |
| 113 | 113 | } |
| 114 | - if ( 'excerpt' === $args['modal_content'] ) { |
|
| 115 | - $modal_body .= '<a class="moretag" target="_blank" href="' . $url . '">' . __( 'Read More', 'lsx-heal-plan' ) . '</a>'; |
|
| 114 | + if ('excerpt' === $args['modal_content']) { |
|
| 115 | + $modal_body .= '<a class="moretag" target="_blank" href="' . $url . '">' . __('Read More', 'lsx-heal-plan') . '</a>'; |
|
| 116 | 116 | } |
| 117 | - \lsx_health_plan\functions\register_modal( 'workout-alt-exercise-modal-' . $m, '', $modal_body ); |
|
| 117 | + \lsx_health_plan\functions\register_modal('workout-alt-exercise-modal-' . $m, '', $modal_body); |
|
| 118 | 118 | |
| 119 | - if ( true === $echo ) { |
|
| 120 | - echo wp_kses_post( $play_button ); |
|
| 119 | + if (true === $echo) { |
|
| 120 | + echo wp_kses_post($play_button); |
|
| 121 | 121 | } else { |
| 122 | 122 | return $play_button; |
| 123 | 123 | } |
@@ -133,62 +133,62 @@ discard block |
||
| 133 | 133 | * @param array $args |
| 134 | 134 | * @return void |
| 135 | 135 | */ |
| 136 | -function lsx_health_plan_workout_exercise_button( $m, $group, $echo = true, $args = array() ) { |
|
| 136 | +function lsx_health_plan_workout_exercise_button($m, $group, $echo = true, $args = array()) { |
|
| 137 | 137 | $defaults = array( |
| 138 | 138 | 'modal_trigger' => 'button', |
| 139 | 139 | 'modal_content' => 'excerpt', |
| 140 | 140 | ); |
| 141 | - $args = wp_parse_args( $args, $defaults ); |
|
| 141 | + $args = wp_parse_args($args, $defaults); |
|
| 142 | 142 | |
| 143 | 143 | $exercise_id = ''; |
| 144 | - if ( isset( $group['connected_exercises'] ) && '' !== $group['connected_exercises'] ) { |
|
| 145 | - $exercise_id = esc_html( $group['connected_exercises'] ); |
|
| 146 | - $content = get_post_field( 'post_content', $exercise_id ); |
|
| 147 | - $url = get_permalink( $exercise_id ); |
|
| 148 | - $equipment_group = get_the_term_list( $exercise_id, 'equipment', '', ', ' ); |
|
| 149 | - $muscle_group = get_the_term_list( $exercise_id, 'muscle-group', '', ', ' ); |
|
| 144 | + if (isset($group['connected_exercises']) && '' !== $group['connected_exercises']) { |
|
| 145 | + $exercise_id = esc_html($group['connected_exercises']); |
|
| 146 | + $content = get_post_field('post_content', $exercise_id); |
|
| 147 | + $url = get_permalink($exercise_id); |
|
| 148 | + $equipment_group = get_the_term_list($exercise_id, 'equipment', '', ', '); |
|
| 149 | + $muscle_group = get_the_term_list($exercise_id, 'muscle-group', '', ', '); |
|
| 150 | 150 | $lsx_hp = lsx_health_plan(); |
| 151 | 151 | |
| 152 | - if ( 'excerpt' === $args['modal_content'] ) { |
|
| 153 | - $content = wp_trim_words( $content, 40 ); |
|
| 152 | + if ('excerpt' === $args['modal_content']) { |
|
| 153 | + $content = wp_trim_words($content, 40); |
|
| 154 | 154 | } |
| 155 | 155 | |
| 156 | - if ( 'link' ) { |
|
| 157 | - $play_button = '<a data-toggle="modal" href="#workout-exercise-modal-' . $m . '">' . get_the_title( $exercise_id ) . '</a>'; |
|
| 156 | + if ('link') { |
|
| 157 | + $play_button = '<a data-toggle="modal" href="#workout-exercise-modal-' . $m . '">' . get_the_title($exercise_id) . '</a>'; |
|
| 158 | 158 | } else { |
| 159 | 159 | $play_button = '<button data-toggle="modal" data-target="#workout-exercise-modal-' . $m . '"><span class="fa fa-play-circle"></span></button>'; |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | - $modal_body = ''; |
|
| 162 | + $modal_body = ''; |
|
| 163 | 163 | |
| 164 | - if ( $lsx_hp->frontend->gallery->has_gallery( $exercise_id ) ) { |
|
| 164 | + if ($lsx_hp->frontend->gallery->has_gallery($exercise_id)) { |
|
| 165 | 165 | $gallery_args = array( |
| 166 | 166 | 'css_class' => 'modal-slider', |
| 167 | 167 | ); |
| 168 | - $modal_body .= $lsx_hp->frontend->gallery->get_gallery( '', '', $gallery_args ); |
|
| 168 | + $modal_body .= $lsx_hp->frontend->gallery->get_gallery('', '', $gallery_args); |
|
| 169 | 169 | } else { |
| 170 | - $modal_body .= '<div class="modal-image"/>' . get_the_post_thumbnail( $exercise_id, 'large' ) . '</div>'; |
|
| 170 | + $modal_body .= '<div class="modal-image"/>' . get_the_post_thumbnail($exercise_id, 'large') . '</div>'; |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | - $modal_body .= '<div class="title-lined exercise-modal"><h5 class="modal-title">' . get_the_title( $exercise_id ) . '</h5>'; |
|
| 173 | + $modal_body .= '<div class="title-lined exercise-modal"><h5 class="modal-title">' . get_the_title($exercise_id) . '</h5>'; |
|
| 174 | 174 | |
| 175 | - if ( ! empty( $equipment_group ) ) { |
|
| 175 | + if ( ! empty($equipment_group)) { |
|
| 176 | 176 | $modal_body .= '<span class="equipment-terms">Equipment: ' . $equipment_group . '</span>'; |
| 177 | 177 | } |
| 178 | - if ( ! empty( $muscle_group ) ) { |
|
| 178 | + if ( ! empty($muscle_group)) { |
|
| 179 | 179 | $modal_body .= '<span class="muscle-terms">Muscle Group: ' . $muscle_group . '</span>'; |
| 180 | 180 | } |
| 181 | 181 | $modal_body .= '</div>'; |
| 182 | - if ( '' !== $args['modal_content'] ) { |
|
| 182 | + if ('' !== $args['modal_content']) { |
|
| 183 | 183 | $modal_body .= '<div class="modal-excerpt"/>' . $content . '</div>'; |
| 184 | 184 | } |
| 185 | - if ( 'excerpt' === $args['modal_content'] ) { |
|
| 186 | - $modal_body .= '<a class="moretag" target="_blank" href="' . $url . '">' . __( 'Read More', 'lsx-heal-plan' ) . '</a>'; |
|
| 185 | + if ('excerpt' === $args['modal_content']) { |
|
| 186 | + $modal_body .= '<a class="moretag" target="_blank" href="' . $url . '">' . __('Read More', 'lsx-heal-plan') . '</a>'; |
|
| 187 | 187 | } |
| 188 | - \lsx_health_plan\functions\register_modal( 'workout-exercise-modal-' . $m, '', $modal_body ); |
|
| 188 | + \lsx_health_plan\functions\register_modal('workout-exercise-modal-' . $m, '', $modal_body); |
|
| 189 | 189 | |
| 190 | - if ( true === $echo ) { |
|
| 191 | - echo wp_kses_post( $play_button ); |
|
| 190 | + if (true === $echo) { |
|
| 191 | + echo wp_kses_post($play_button); |
|
| 192 | 192 | } else { |
| 193 | 193 | return $play_button; |
| 194 | 194 | } |
@@ -202,39 +202,39 @@ discard block |
||
| 202 | 202 | * @param array $group |
| 203 | 203 | * @return void |
| 204 | 204 | */ |
| 205 | -function lsx_health_plan_shortcode_exercise_button( $m, $content = true ) { |
|
| 206 | - $equipment_group = get_the_term_list( $m, 'equipment', '', ', ' ); |
|
| 207 | - $muscle_group = get_the_term_list( $m, 'muscle-group', '', ', ' ); |
|
| 205 | +function lsx_health_plan_shortcode_exercise_button($m, $content = true) { |
|
| 206 | + $equipment_group = get_the_term_list($m, 'equipment', '', ', '); |
|
| 207 | + $muscle_group = get_the_term_list($m, 'muscle-group', '', ', '); |
|
| 208 | 208 | $title = get_the_title(); |
| 209 | 209 | $lsx_hp = lsx_health_plan(); |
| 210 | - $button = '<a data-toggle="modal" href="#exercise-modal-' . $m . '" data-target="#exercise-modal-' . $m . '"></a>'; |
|
| 210 | + $button = '<a data-toggle="modal" href="#exercise-modal-' . $m . '" data-target="#exercise-modal-' . $m . '"></a>'; |
|
| 211 | 211 | |
| 212 | - if ( true === $content ) { |
|
| 212 | + if (true === $content) { |
|
| 213 | 213 | $content = get_the_content(); |
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | $modal_body = ''; |
| 217 | - if ( $lsx_hp->frontend->gallery->has_gallery( $m ) ) { |
|
| 217 | + if ($lsx_hp->frontend->gallery->has_gallery($m)) { |
|
| 218 | 218 | $gallery_args = array( |
| 219 | 219 | 'css_class' => 'modal-slider', |
| 220 | 220 | ); |
| 221 | - $modal_body .= $lsx_hp->frontend->gallery->get_gallery( '', '', $gallery_args ); |
|
| 221 | + $modal_body .= $lsx_hp->frontend->gallery->get_gallery('', '', $gallery_args); |
|
| 222 | 222 | } else { |
| 223 | - $modal_body .= '<div class="modal-image">' . get_the_post_thumbnail( $m, 'large' ) . '</div>'; |
|
| 223 | + $modal_body .= '<div class="modal-image">' . get_the_post_thumbnail($m, 'large') . '</div>'; |
|
| 224 | 224 | } |
| 225 | 225 | $modal_body .= '<div class="title-lined exercise-modal"><h5 class="modal-title">' . $title . '</h5>'; |
| 226 | 226 | |
| 227 | - if ( ! empty( $equipment_group ) ) { |
|
| 227 | + if ( ! empty($equipment_group)) { |
|
| 228 | 228 | $modal_body .= '<span class="equipment-terms">Equipment: ' . $equipment_group . '</span>'; |
| 229 | 229 | } |
| 230 | - if ( ! empty( $muscle_group ) ) { |
|
| 230 | + if ( ! empty($muscle_group)) { |
|
| 231 | 231 | $modal_body .= '<span class="muscle-terms">Muscle Group: ' . $muscle_group . '</span>'; |
| 232 | 232 | } |
| 233 | 233 | $modal_body .= '</div>'; |
| 234 | 234 | $modal_body .= $content; |
| 235 | - \lsx_health_plan\functions\register_modal( 'exercise-modal-' . $m, '', $modal_body ); |
|
| 235 | + \lsx_health_plan\functions\register_modal('exercise-modal-' . $m, '', $modal_body); |
|
| 236 | 236 | |
| 237 | - return ( $button ); |
|
| 237 | + return ($button); |
|
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | /** |
@@ -245,18 +245,18 @@ discard block |
||
| 245 | 245 | * @param boolean $echo |
| 246 | 246 | * @return string |
| 247 | 247 | */ |
| 248 | -function lsx_health_plan_exercise_title( $before = '', $after = '', $echo = true, $exercise_id = false ) { |
|
| 249 | - if ( false === $exercise_id ) { |
|
| 248 | +function lsx_health_plan_exercise_title($before = '', $after = '', $echo = true, $exercise_id = false) { |
|
| 249 | + if (false === $exercise_id) { |
|
| 250 | 250 | $exercise_id = get_the_ID(); |
| 251 | 251 | } |
| 252 | - $title = get_the_title( $exercise_id ); |
|
| 253 | - $side = get_post_meta( $exercise_id, 'exercise_side', true ); |
|
| 254 | - if ( '' !== $side ) { |
|
| 255 | - $title .= ' - ' . ucwords( $side ); |
|
| 252 | + $title = get_the_title($exercise_id); |
|
| 253 | + $side = get_post_meta($exercise_id, 'exercise_side', true); |
|
| 254 | + if ('' !== $side) { |
|
| 255 | + $title .= ' - ' . ucwords($side); |
|
| 256 | 256 | } |
| 257 | - $title = apply_filters( 'lsx_health_plan_exercise_title', $before . $title . $after, $title, $before, $after, $exercise_id ); |
|
| 258 | - if ( true === $echo ) { |
|
| 259 | - echo wp_kses_post( $title ); |
|
| 257 | + $title = apply_filters('lsx_health_plan_exercise_title', $before . $title . $after, $title, $before, $after, $exercise_id); |
|
| 258 | + if (true === $echo) { |
|
| 259 | + echo wp_kses_post($title); |
|
| 260 | 260 | } else { |
| 261 | 261 | return $title; |
| 262 | 262 | } |
@@ -8,148 +8,148 @@ |
||
| 8 | 8 | */ |
| 9 | 9 | class LSX_Team { |
| 10 | 10 | |
| 11 | - /** |
|
| 12 | - * Holds class instance |
|
| 13 | - * |
|
| 14 | - * @var object \lsx_health_plan\classes\LSX_Team() |
|
| 15 | - */ |
|
| 16 | - protected static $instance = null; |
|
| 11 | + /** |
|
| 12 | + * Holds class instance |
|
| 13 | + * |
|
| 14 | + * @var object \lsx_health_plan\classes\LSX_Team() |
|
| 15 | + */ |
|
| 16 | + protected static $instance = null; |
|
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * Constructor. |
|
| 20 | - */ |
|
| 21 | - public function __construct() { |
|
| 22 | - $this->default_types = array( |
|
| 23 | - \lsx_health_plan\functions\get_option( 'endpoint_meal', 'meal' ), |
|
| 24 | - \lsx_health_plan\functions\get_option( 'endpoint_exercise_single', 'exercise' ), |
|
| 25 | - \lsx_health_plan\functions\get_option( 'endpoint_recipe_single', 'recipe' ), |
|
| 26 | - \lsx_health_plan\functions\get_option( 'endpoint_workout', 'workout' ), |
|
| 27 | - \lsx_health_plan\functions\get_option( 'endpoint_plan', 'plan' ), |
|
| 28 | - ); |
|
| 29 | - add_action( 'wp_enqueue_scripts', array( $this, 'assets' ), 5 ); |
|
| 30 | - add_action( 'cmb2_admin_init', array( $this, 'related_team_metabox' ) ); |
|
| 31 | - add_action( 'cmb2_admin_init', array( $this, 'additional_single_team_metabox' ) ); |
|
| 32 | - add_action( 'lsx_entry_bottom', array( $this, 'hp_team_member_tabs' ) ); |
|
| 33 | - add_action( 'wp_head', array( $this, 'remove_archive_original_team_header' ), 99 ); |
|
| 34 | - } |
|
| 18 | + /** |
|
| 19 | + * Constructor. |
|
| 20 | + */ |
|
| 21 | + public function __construct() { |
|
| 22 | + $this->default_types = array( |
|
| 23 | + \lsx_health_plan\functions\get_option( 'endpoint_meal', 'meal' ), |
|
| 24 | + \lsx_health_plan\functions\get_option( 'endpoint_exercise_single', 'exercise' ), |
|
| 25 | + \lsx_health_plan\functions\get_option( 'endpoint_recipe_single', 'recipe' ), |
|
| 26 | + \lsx_health_plan\functions\get_option( 'endpoint_workout', 'workout' ), |
|
| 27 | + \lsx_health_plan\functions\get_option( 'endpoint_plan', 'plan' ), |
|
| 28 | + ); |
|
| 29 | + add_action( 'wp_enqueue_scripts', array( $this, 'assets' ), 5 ); |
|
| 30 | + add_action( 'cmb2_admin_init', array( $this, 'related_team_metabox' ) ); |
|
| 31 | + add_action( 'cmb2_admin_init', array( $this, 'additional_single_team_metabox' ) ); |
|
| 32 | + add_action( 'lsx_entry_bottom', array( $this, 'hp_team_member_tabs' ) ); |
|
| 33 | + add_action( 'wp_head', array( $this, 'remove_archive_original_team_header' ), 99 ); |
|
| 34 | + } |
|
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * Return an instance of this class. |
|
| 38 | - * |
|
| 39 | - * @since 1.0.0 |
|
| 40 | - * |
|
| 41 | - * @return object \lsx_health_plan\classes\LSX_Team() A single instance of this class. |
|
| 42 | - */ |
|
| 43 | - public static function get_instance() { |
|
| 44 | - // If the single instance hasn't been set, set it now. |
|
| 45 | - if ( null === self::$instance ) { |
|
| 46 | - self::$instance = new self(); |
|
| 47 | - } |
|
| 48 | - return self::$instance; |
|
| 49 | - } |
|
| 36 | + /** |
|
| 37 | + * Return an instance of this class. |
|
| 38 | + * |
|
| 39 | + * @since 1.0.0 |
|
| 40 | + * |
|
| 41 | + * @return object \lsx_health_plan\classes\LSX_Team() A single instance of this class. |
|
| 42 | + */ |
|
| 43 | + public static function get_instance() { |
|
| 44 | + // If the single instance hasn't been set, set it now. |
|
| 45 | + if ( null === self::$instance ) { |
|
| 46 | + self::$instance = new self(); |
|
| 47 | + } |
|
| 48 | + return self::$instance; |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | - /** |
|
| 52 | - * Load lsx team related css. |
|
| 53 | - * |
|
| 54 | - * @package lsx |
|
| 55 | - * @subpackage lsx-health-plan |
|
| 56 | - * |
|
| 57 | - */ |
|
| 58 | - public function assets() { |
|
| 59 | - wp_enqueue_style( 'lsx-health-plan-team', LSX_HEALTH_PLAN_URL . 'assets/css/lsx-health-plan-team.css', array(), LSX_HEALTH_PLAN_VER ); |
|
| 60 | - } |
|
| 51 | + /** |
|
| 52 | + * Load lsx team related css. |
|
| 53 | + * |
|
| 54 | + * @package lsx |
|
| 55 | + * @subpackage lsx-health-plan |
|
| 56 | + * |
|
| 57 | + */ |
|
| 58 | + public function assets() { |
|
| 59 | + wp_enqueue_style( 'lsx-health-plan-team', LSX_HEALTH_PLAN_URL . 'assets/css/lsx-health-plan-team.css', array(), LSX_HEALTH_PLAN_VER ); |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | - /** |
|
| 63 | - * Define the related team member metabox and field configurations. |
|
| 64 | - */ |
|
| 65 | - public function related_team_metabox() { |
|
| 66 | - foreach ( $this->default_types as $type => $default_type ) { |
|
| 67 | - $cmb = new_cmb2_box( |
|
| 68 | - array( |
|
| 69 | - 'id' => $default_type . '_related_team_member__metabox', |
|
| 70 | - 'title' => __( 'Related Team Member', 'lsx-health-plan' ), |
|
| 71 | - 'object_types' => array( $default_type ), // Post type. |
|
| 72 | - 'context' => 'normal', |
|
| 73 | - 'priority' => 'low', |
|
| 74 | - 'show_names' => true, |
|
| 75 | - ) |
|
| 76 | - ); |
|
| 62 | + /** |
|
| 63 | + * Define the related team member metabox and field configurations. |
|
| 64 | + */ |
|
| 65 | + public function related_team_metabox() { |
|
| 66 | + foreach ( $this->default_types as $type => $default_type ) { |
|
| 67 | + $cmb = new_cmb2_box( |
|
| 68 | + array( |
|
| 69 | + 'id' => $default_type . '_related_team_member__metabox', |
|
| 70 | + 'title' => __( 'Related Team Member', 'lsx-health-plan' ), |
|
| 71 | + 'object_types' => array( $default_type ), // Post type. |
|
| 72 | + 'context' => 'normal', |
|
| 73 | + 'priority' => 'low', |
|
| 74 | + 'show_names' => true, |
|
| 75 | + ) |
|
| 76 | + ); |
|
| 77 | 77 | |
| 78 | - $cmb->add_field( |
|
| 79 | - array( |
|
| 80 | - 'name' => __( 'Related Team Member', 'lsx-health-plan' ), |
|
| 81 | - 'desc' => __( 'Connect the related team member that applies to this ', 'lsx-health-plan' ) . $default_type, |
|
| 82 | - 'id' => $default_type . '_connected_team_member', |
|
| 83 | - 'type' => 'post_search_ajax', |
|
| 84 | - 'limit' => 4, // Limit selection to X items only (default 1). |
|
| 85 | - 'sortable' => true, // Allow selected items to be sortable (default false). |
|
| 86 | - 'query_args' => array( |
|
| 87 | - 'post_type' => array( 'team' ), |
|
| 88 | - 'post_status' => array( 'publish' ), |
|
| 89 | - 'posts_per_page' => -1, |
|
| 90 | - ), |
|
| 91 | - ) |
|
| 92 | - ); |
|
| 93 | - } |
|
| 78 | + $cmb->add_field( |
|
| 79 | + array( |
|
| 80 | + 'name' => __( 'Related Team Member', 'lsx-health-plan' ), |
|
| 81 | + 'desc' => __( 'Connect the related team member that applies to this ', 'lsx-health-plan' ) . $default_type, |
|
| 82 | + 'id' => $default_type . '_connected_team_member', |
|
| 83 | + 'type' => 'post_search_ajax', |
|
| 84 | + 'limit' => 4, // Limit selection to X items only (default 1). |
|
| 85 | + 'sortable' => true, // Allow selected items to be sortable (default false). |
|
| 86 | + 'query_args' => array( |
|
| 87 | + 'post_type' => array( 'team' ), |
|
| 88 | + 'post_status' => array( 'publish' ), |
|
| 89 | + 'posts_per_page' => -1, |
|
| 90 | + ), |
|
| 91 | + ) |
|
| 92 | + ); |
|
| 93 | + } |
|
| 94 | 94 | |
| 95 | - } |
|
| 95 | + } |
|
| 96 | 96 | |
| 97 | - /** |
|
| 98 | - * Adding additional custom fields to the single members, related with Health Plan. |
|
| 99 | - */ |
|
| 100 | - public function additional_single_team_metabox() { |
|
| 101 | - $cmb = new_cmb2_box( |
|
| 102 | - array( |
|
| 103 | - 'id' => 'lsx__team', |
|
| 104 | - 'title' => '', |
|
| 105 | - 'object_types' => array( 'team' ), // Post type. |
|
| 106 | - 'context' => 'normal', |
|
| 107 | - 'priority' => 'high', |
|
| 108 | - 'show_names' => true, |
|
| 109 | - ) |
|
| 110 | - ); |
|
| 97 | + /** |
|
| 98 | + * Adding additional custom fields to the single members, related with Health Plan. |
|
| 99 | + */ |
|
| 100 | + public function additional_single_team_metabox() { |
|
| 101 | + $cmb = new_cmb2_box( |
|
| 102 | + array( |
|
| 103 | + 'id' => 'lsx__team', |
|
| 104 | + 'title' => '', |
|
| 105 | + 'object_types' => array( 'team' ), // Post type. |
|
| 106 | + 'context' => 'normal', |
|
| 107 | + 'priority' => 'high', |
|
| 108 | + 'show_names' => true, |
|
| 109 | + ) |
|
| 110 | + ); |
|
| 111 | 111 | |
| 112 | - $cmb->add_field( |
|
| 113 | - array( |
|
| 114 | - 'name' => __( 'Team Member Experience', 'lsx-health-plan' ), |
|
| 115 | - 'desc' => __( 'Add additional experience to this team member', 'lsx-health-plan' ), |
|
| 116 | - 'id' => 'team_member_experience', |
|
| 117 | - 'type' => 'wysiwyg', |
|
| 118 | - ) |
|
| 119 | - ); |
|
| 112 | + $cmb->add_field( |
|
| 113 | + array( |
|
| 114 | + 'name' => __( 'Team Member Experience', 'lsx-health-plan' ), |
|
| 115 | + 'desc' => __( 'Add additional experience to this team member', 'lsx-health-plan' ), |
|
| 116 | + 'id' => 'team_member_experience', |
|
| 117 | + 'type' => 'wysiwyg', |
|
| 118 | + ) |
|
| 119 | + ); |
|
| 120 | 120 | |
| 121 | - $cmb->add_field( |
|
| 122 | - array( |
|
| 123 | - 'name' => __( 'Featured Plans', 'lsx-health-plan' ), |
|
| 124 | - 'desc' => __( 'Connect the related plans to this team member', 'lsx-health-plan' ), |
|
| 125 | - 'id' => 'connected_team_member_plan', |
|
| 126 | - 'type' => 'post_search_ajax', |
|
| 127 | - 'limit' => 3, |
|
| 128 | - 'sortable' => true, |
|
| 129 | - 'query_args' => array( |
|
| 130 | - 'post_type' => array( 'plan' ), |
|
| 131 | - 'post_status' => array( 'publish' ), |
|
| 132 | - 'posts_per_page' => -1, |
|
| 133 | - ), |
|
| 134 | - ) |
|
| 135 | - ); |
|
| 121 | + $cmb->add_field( |
|
| 122 | + array( |
|
| 123 | + 'name' => __( 'Featured Plans', 'lsx-health-plan' ), |
|
| 124 | + 'desc' => __( 'Connect the related plans to this team member', 'lsx-health-plan' ), |
|
| 125 | + 'id' => 'connected_team_member_plan', |
|
| 126 | + 'type' => 'post_search_ajax', |
|
| 127 | + 'limit' => 3, |
|
| 128 | + 'sortable' => true, |
|
| 129 | + 'query_args' => array( |
|
| 130 | + 'post_type' => array( 'plan' ), |
|
| 131 | + 'post_status' => array( 'publish' ), |
|
| 132 | + 'posts_per_page' => -1, |
|
| 133 | + ), |
|
| 134 | + ) |
|
| 135 | + ); |
|
| 136 | 136 | |
| 137 | - } |
|
| 137 | + } |
|
| 138 | 138 | |
| 139 | - /** |
|
| 140 | - * Adds custom tabs to the team member single pages. |
|
| 141 | - * |
|
| 142 | - * @return void |
|
| 143 | - */ |
|
| 144 | - public function hp_team_member_tabs() { |
|
| 145 | - if ( is_single() && is_singular( 'team' ) ) { |
|
| 146 | - require_once LSX_HEALTH_PLAN_PATH . '/includes/template-tags/team.php'; |
|
| 147 | - } |
|
| 148 | - } |
|
| 139 | + /** |
|
| 140 | + * Adds custom tabs to the team member single pages. |
|
| 141 | + * |
|
| 142 | + * @return void |
|
| 143 | + */ |
|
| 144 | + public function hp_team_member_tabs() { |
|
| 145 | + if ( is_single() && is_singular( 'team' ) ) { |
|
| 146 | + require_once LSX_HEALTH_PLAN_PATH . '/includes/template-tags/team.php'; |
|
| 147 | + } |
|
| 148 | + } |
|
| 149 | 149 | |
| 150 | - public function remove_archive_original_team_header() { |
|
| 151 | - if ( is_single() && is_singular( 'team' ) ) { |
|
| 152 | - remove_action( 'lsx_content_wrap_before', 'lsx_global_header' ); |
|
| 153 | - } |
|
| 154 | - } |
|
| 150 | + public function remove_archive_original_team_header() { |
|
| 151 | + if ( is_single() && is_singular( 'team' ) ) { |
|
| 152 | + remove_action( 'lsx_content_wrap_before', 'lsx_global_header' ); |
|
| 153 | + } |
|
| 154 | + } |
|
| 155 | 155 | } |
@@ -20,17 +20,17 @@ discard block |
||
| 20 | 20 | */ |
| 21 | 21 | public function __construct() { |
| 22 | 22 | $this->default_types = array( |
| 23 | - \lsx_health_plan\functions\get_option( 'endpoint_meal', 'meal' ), |
|
| 24 | - \lsx_health_plan\functions\get_option( 'endpoint_exercise_single', 'exercise' ), |
|
| 25 | - \lsx_health_plan\functions\get_option( 'endpoint_recipe_single', 'recipe' ), |
|
| 26 | - \lsx_health_plan\functions\get_option( 'endpoint_workout', 'workout' ), |
|
| 27 | - \lsx_health_plan\functions\get_option( 'endpoint_plan', 'plan' ), |
|
| 23 | + \lsx_health_plan\functions\get_option('endpoint_meal', 'meal'), |
|
| 24 | + \lsx_health_plan\functions\get_option('endpoint_exercise_single', 'exercise'), |
|
| 25 | + \lsx_health_plan\functions\get_option('endpoint_recipe_single', 'recipe'), |
|
| 26 | + \lsx_health_plan\functions\get_option('endpoint_workout', 'workout'), |
|
| 27 | + \lsx_health_plan\functions\get_option('endpoint_plan', 'plan'), |
|
| 28 | 28 | ); |
| 29 | - add_action( 'wp_enqueue_scripts', array( $this, 'assets' ), 5 ); |
|
| 30 | - add_action( 'cmb2_admin_init', array( $this, 'related_team_metabox' ) ); |
|
| 31 | - add_action( 'cmb2_admin_init', array( $this, 'additional_single_team_metabox' ) ); |
|
| 32 | - add_action( 'lsx_entry_bottom', array( $this, 'hp_team_member_tabs' ) ); |
|
| 33 | - add_action( 'wp_head', array( $this, 'remove_archive_original_team_header' ), 99 ); |
|
| 29 | + add_action('wp_enqueue_scripts', array($this, 'assets'), 5); |
|
| 30 | + add_action('cmb2_admin_init', array($this, 'related_team_metabox')); |
|
| 31 | + add_action('cmb2_admin_init', array($this, 'additional_single_team_metabox')); |
|
| 32 | + add_action('lsx_entry_bottom', array($this, 'hp_team_member_tabs')); |
|
| 33 | + add_action('wp_head', array($this, 'remove_archive_original_team_header'), 99); |
|
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | /** |
@@ -42,7 +42,7 @@ discard block |
||
| 42 | 42 | */ |
| 43 | 43 | public static function get_instance() { |
| 44 | 44 | // If the single instance hasn't been set, set it now. |
| 45 | - if ( null === self::$instance ) { |
|
| 45 | + if (null === self::$instance) { |
|
| 46 | 46 | self::$instance = new self(); |
| 47 | 47 | } |
| 48 | 48 | return self::$instance; |
@@ -56,19 +56,19 @@ discard block |
||
| 56 | 56 | * |
| 57 | 57 | */ |
| 58 | 58 | public function assets() { |
| 59 | - wp_enqueue_style( 'lsx-health-plan-team', LSX_HEALTH_PLAN_URL . 'assets/css/lsx-health-plan-team.css', array(), LSX_HEALTH_PLAN_VER ); |
|
| 59 | + wp_enqueue_style('lsx-health-plan-team', LSX_HEALTH_PLAN_URL . 'assets/css/lsx-health-plan-team.css', array(), LSX_HEALTH_PLAN_VER); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | /** |
| 63 | 63 | * Define the related team member metabox and field configurations. |
| 64 | 64 | */ |
| 65 | 65 | public function related_team_metabox() { |
| 66 | - foreach ( $this->default_types as $type => $default_type ) { |
|
| 66 | + foreach ($this->default_types as $type => $default_type) { |
|
| 67 | 67 | $cmb = new_cmb2_box( |
| 68 | 68 | array( |
| 69 | 69 | 'id' => $default_type . '_related_team_member__metabox', |
| 70 | - 'title' => __( 'Related Team Member', 'lsx-health-plan' ), |
|
| 71 | - 'object_types' => array( $default_type ), // Post type. |
|
| 70 | + 'title' => __('Related Team Member', 'lsx-health-plan'), |
|
| 71 | + 'object_types' => array($default_type), // Post type. |
|
| 72 | 72 | 'context' => 'normal', |
| 73 | 73 | 'priority' => 'low', |
| 74 | 74 | 'show_names' => true, |
@@ -77,15 +77,15 @@ discard block |
||
| 77 | 77 | |
| 78 | 78 | $cmb->add_field( |
| 79 | 79 | array( |
| 80 | - 'name' => __( 'Related Team Member', 'lsx-health-plan' ), |
|
| 81 | - 'desc' => __( 'Connect the related team member that applies to this ', 'lsx-health-plan' ) . $default_type, |
|
| 80 | + 'name' => __('Related Team Member', 'lsx-health-plan'), |
|
| 81 | + 'desc' => __('Connect the related team member that applies to this ', 'lsx-health-plan') . $default_type, |
|
| 82 | 82 | 'id' => $default_type . '_connected_team_member', |
| 83 | 83 | 'type' => 'post_search_ajax', |
| 84 | - 'limit' => 4, // Limit selection to X items only (default 1). |
|
| 84 | + 'limit' => 4, // Limit selection to X items only (default 1). |
|
| 85 | 85 | 'sortable' => true, // Allow selected items to be sortable (default false). |
| 86 | 86 | 'query_args' => array( |
| 87 | - 'post_type' => array( 'team' ), |
|
| 88 | - 'post_status' => array( 'publish' ), |
|
| 87 | + 'post_type' => array('team'), |
|
| 88 | + 'post_status' => array('publish'), |
|
| 89 | 89 | 'posts_per_page' => -1, |
| 90 | 90 | ), |
| 91 | 91 | ) |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | array( |
| 103 | 103 | 'id' => 'lsx__team', |
| 104 | 104 | 'title' => '', |
| 105 | - 'object_types' => array( 'team' ), // Post type. |
|
| 105 | + 'object_types' => array('team'), // Post type. |
|
| 106 | 106 | 'context' => 'normal', |
| 107 | 107 | 'priority' => 'high', |
| 108 | 108 | 'show_names' => true, |
@@ -111,8 +111,8 @@ discard block |
||
| 111 | 111 | |
| 112 | 112 | $cmb->add_field( |
| 113 | 113 | array( |
| 114 | - 'name' => __( 'Team Member Experience', 'lsx-health-plan' ), |
|
| 115 | - 'desc' => __( 'Add additional experience to this team member', 'lsx-health-plan' ), |
|
| 114 | + 'name' => __('Team Member Experience', 'lsx-health-plan'), |
|
| 115 | + 'desc' => __('Add additional experience to this team member', 'lsx-health-plan'), |
|
| 116 | 116 | 'id' => 'team_member_experience', |
| 117 | 117 | 'type' => 'wysiwyg', |
| 118 | 118 | ) |
@@ -120,15 +120,15 @@ discard block |
||
| 120 | 120 | |
| 121 | 121 | $cmb->add_field( |
| 122 | 122 | array( |
| 123 | - 'name' => __( 'Featured Plans', 'lsx-health-plan' ), |
|
| 124 | - 'desc' => __( 'Connect the related plans to this team member', 'lsx-health-plan' ), |
|
| 123 | + 'name' => __('Featured Plans', 'lsx-health-plan'), |
|
| 124 | + 'desc' => __('Connect the related plans to this team member', 'lsx-health-plan'), |
|
| 125 | 125 | 'id' => 'connected_team_member_plan', |
| 126 | 126 | 'type' => 'post_search_ajax', |
| 127 | 127 | 'limit' => 3, |
| 128 | 128 | 'sortable' => true, |
| 129 | 129 | 'query_args' => array( |
| 130 | - 'post_type' => array( 'plan' ), |
|
| 131 | - 'post_status' => array( 'publish' ), |
|
| 130 | + 'post_type' => array('plan'), |
|
| 131 | + 'post_status' => array('publish'), |
|
| 132 | 132 | 'posts_per_page' => -1, |
| 133 | 133 | ), |
| 134 | 134 | ) |
@@ -142,14 +142,14 @@ discard block |
||
| 142 | 142 | * @return void |
| 143 | 143 | */ |
| 144 | 144 | public function hp_team_member_tabs() { |
| 145 | - if ( is_single() && is_singular( 'team' ) ) { |
|
| 145 | + if (is_single() && is_singular('team')) { |
|
| 146 | 146 | require_once LSX_HEALTH_PLAN_PATH . '/includes/template-tags/team.php'; |
| 147 | 147 | } |
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | public function remove_archive_original_team_header() { |
| 151 | - if ( is_single() && is_singular( 'team' ) ) { |
|
| 152 | - remove_action( 'lsx_content_wrap_before', 'lsx_global_header' ); |
|
| 151 | + if (is_single() && is_singular('team')) { |
|
| 152 | + remove_action('lsx_content_wrap_before', 'lsx_global_header'); |
|
| 153 | 153 | } |
| 154 | 154 | } |
| 155 | 155 | } |
@@ -12,147 +12,147 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | class Meal { |
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * Holds class instance |
|
| 17 | - * |
|
| 18 | - * @since 1.0.0 |
|
| 19 | - * |
|
| 20 | - * @var object \lsx_health_plan\classes\admin\Meal() |
|
| 21 | - */ |
|
| 22 | - protected static $instance = null; |
|
| 15 | + /** |
|
| 16 | + * Holds class instance |
|
| 17 | + * |
|
| 18 | + * @since 1.0.0 |
|
| 19 | + * |
|
| 20 | + * @var object \lsx_health_plan\classes\admin\Meal() |
|
| 21 | + */ |
|
| 22 | + protected static $instance = null; |
|
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * Constructor |
|
| 26 | - */ |
|
| 27 | - public function __construct() { |
|
| 28 | - add_action( 'lsx_hp_settings_page_meal_top', array( $this, 'settings' ), 1, 1 ); |
|
| 29 | - } |
|
| 24 | + /** |
|
| 25 | + * Constructor |
|
| 26 | + */ |
|
| 27 | + public function __construct() { |
|
| 28 | + add_action( 'lsx_hp_settings_page_meal_top', array( $this, 'settings' ), 1, 1 ); |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * Return an instance of this class. |
|
| 33 | - * |
|
| 34 | - * @since 1.0.0 |
|
| 35 | - * |
|
| 36 | - * @return object \lsx_health_plan\classes\admin\Meal() A single instance of this class. |
|
| 37 | - */ |
|
| 38 | - public static function get_instance() { |
|
| 39 | - // If the single instance hasn't been set, set it now. |
|
| 40 | - if ( null === self::$instance ) { |
|
| 41 | - self::$instance = new self(); |
|
| 42 | - } |
|
| 43 | - return self::$instance; |
|
| 44 | - } |
|
| 31 | + /** |
|
| 32 | + * Return an instance of this class. |
|
| 33 | + * |
|
| 34 | + * @since 1.0.0 |
|
| 35 | + * |
|
| 36 | + * @return object \lsx_health_plan\classes\admin\Meal() A single instance of this class. |
|
| 37 | + */ |
|
| 38 | + public static function get_instance() { |
|
| 39 | + // If the single instance hasn't been set, set it now. |
|
| 40 | + if ( null === self::$instance ) { |
|
| 41 | + self::$instance = new self(); |
|
| 42 | + } |
|
| 43 | + return self::$instance; |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - /** |
|
| 47 | - * Registers the general settings. |
|
| 48 | - * |
|
| 49 | - * @param object $cmb new_cmb2_box(). |
|
| 50 | - * @return void |
|
| 51 | - */ |
|
| 52 | - public function settings( $cmb ) { |
|
| 53 | - $cmb->add_field( |
|
| 54 | - array( |
|
| 55 | - 'name' => __( 'Disable Meals', 'lsx-health-plan' ), |
|
| 56 | - 'id' => 'meal_disabled', |
|
| 57 | - 'type' => 'checkbox', |
|
| 58 | - 'value' => 1, |
|
| 59 | - 'default' => 0, |
|
| 60 | - 'description' => __( 'Disable meal post type if you are wanting a minimal site.', 'lsx-health-plan' ), |
|
| 61 | - ) |
|
| 62 | - ); |
|
| 46 | + /** |
|
| 47 | + * Registers the general settings. |
|
| 48 | + * |
|
| 49 | + * @param object $cmb new_cmb2_box(). |
|
| 50 | + * @return void |
|
| 51 | + */ |
|
| 52 | + public function settings( $cmb ) { |
|
| 53 | + $cmb->add_field( |
|
| 54 | + array( |
|
| 55 | + 'name' => __( 'Disable Meals', 'lsx-health-plan' ), |
|
| 56 | + 'id' => 'meal_disabled', |
|
| 57 | + 'type' => 'checkbox', |
|
| 58 | + 'value' => 1, |
|
| 59 | + 'default' => 0, |
|
| 60 | + 'description' => __( 'Disable meal post type if you are wanting a minimal site.', 'lsx-health-plan' ), |
|
| 61 | + ) |
|
| 62 | + ); |
|
| 63 | 63 | |
| 64 | - $cmb->add_field( |
|
| 65 | - array( |
|
| 66 | - 'id' => 'meal_archive_description', |
|
| 67 | - 'type' => 'wysiwyg', |
|
| 68 | - 'name' => __( 'Archive Description', 'lsx-health-plan' ), |
|
| 69 | - 'description' => __( 'This will show up on the post type archive.', 'lsx-health-plan' ), |
|
| 70 | - 'options' => array( |
|
| 71 | - 'textarea_rows' => get_option('default_post_edit_rows', 6), |
|
| 72 | - ), |
|
| 73 | - ) |
|
| 74 | - ); |
|
| 64 | + $cmb->add_field( |
|
| 65 | + array( |
|
| 66 | + 'id' => 'meal_archive_description', |
|
| 67 | + 'type' => 'wysiwyg', |
|
| 68 | + 'name' => __( 'Archive Description', 'lsx-health-plan' ), |
|
| 69 | + 'description' => __( 'This will show up on the post type archive.', 'lsx-health-plan' ), |
|
| 70 | + 'options' => array( |
|
| 71 | + 'textarea_rows' => get_option('default_post_edit_rows', 6), |
|
| 72 | + ), |
|
| 73 | + ) |
|
| 74 | + ); |
|
| 75 | 75 | |
| 76 | - $cmb->add_field( |
|
| 77 | - array( |
|
| 78 | - 'name' => __( 'Your Meal Plan Intro', 'lsx-health-plan' ), |
|
| 79 | - 'id' => 'meal_plan_intro', |
|
| 80 | - 'type' => 'textarea_small', |
|
| 81 | - 'value' => '', |
|
| 82 | - 'default' => __( 'Get the right mix of nutrients to keep muscles strong & healthy.', 'lsx-health-plan' ), |
|
| 83 | - ) |
|
| 84 | - ); |
|
| 76 | + $cmb->add_field( |
|
| 77 | + array( |
|
| 78 | + 'name' => __( 'Your Meal Plan Intro', 'lsx-health-plan' ), |
|
| 79 | + 'id' => 'meal_plan_intro', |
|
| 80 | + 'type' => 'textarea_small', |
|
| 81 | + 'value' => '', |
|
| 82 | + 'default' => __( 'Get the right mix of nutrients to keep muscles strong & healthy.', 'lsx-health-plan' ), |
|
| 83 | + ) |
|
| 84 | + ); |
|
| 85 | 85 | |
| 86 | - $cmb->add_field( |
|
| 87 | - array( |
|
| 88 | - 'before_row' => '<h4><b><u>URL Slug Options</u></b></h4><p style="font-style: italic;">If you need to translate the custom slug for this custom post type, do so below.</p>', |
|
| 89 | - 'name' => __( 'Meal Slug', 'lsx-health-plan' ), |
|
| 90 | - 'id' => 'endpoint_meal', |
|
| 91 | - 'type' => 'input', |
|
| 92 | - 'value' => '', |
|
| 93 | - 'default' => 'meal', |
|
| 94 | - ) |
|
| 95 | - ); |
|
| 96 | - $cmb->add_field( |
|
| 97 | - array( |
|
| 98 | - 'name' => __( 'Meals Archive Slug', 'lsx-health-plan' ), |
|
| 99 | - 'id' => 'endpoint_meal_archive', |
|
| 100 | - 'type' => 'input', |
|
| 101 | - 'value' => '', |
|
| 102 | - 'default' => 'meals', |
|
| 103 | - ) |
|
| 104 | - ); |
|
| 105 | - $cmb->add_field( |
|
| 106 | - array( |
|
| 107 | - 'name' => __( 'Single Meal Slug', 'lsx-health-plan' ), |
|
| 108 | - 'id' => 'meal_single_slug', |
|
| 109 | - 'type' => 'input', |
|
| 110 | - 'value' => '', |
|
| 111 | - 'default' => 'meal', |
|
| 112 | - ) |
|
| 113 | - ); |
|
| 86 | + $cmb->add_field( |
|
| 87 | + array( |
|
| 88 | + 'before_row' => '<h4><b><u>URL Slug Options</u></b></h4><p style="font-style: italic;">If you need to translate the custom slug for this custom post type, do so below.</p>', |
|
| 89 | + 'name' => __( 'Meal Slug', 'lsx-health-plan' ), |
|
| 90 | + 'id' => 'endpoint_meal', |
|
| 91 | + 'type' => 'input', |
|
| 92 | + 'value' => '', |
|
| 93 | + 'default' => 'meal', |
|
| 94 | + ) |
|
| 95 | + ); |
|
| 96 | + $cmb->add_field( |
|
| 97 | + array( |
|
| 98 | + 'name' => __( 'Meals Archive Slug', 'lsx-health-plan' ), |
|
| 99 | + 'id' => 'endpoint_meal_archive', |
|
| 100 | + 'type' => 'input', |
|
| 101 | + 'value' => '', |
|
| 102 | + 'default' => 'meals', |
|
| 103 | + ) |
|
| 104 | + ); |
|
| 105 | + $cmb->add_field( |
|
| 106 | + array( |
|
| 107 | + 'name' => __( 'Single Meal Slug', 'lsx-health-plan' ), |
|
| 108 | + 'id' => 'meal_single_slug', |
|
| 109 | + 'type' => 'input', |
|
| 110 | + 'value' => '', |
|
| 111 | + 'default' => 'meal', |
|
| 112 | + ) |
|
| 113 | + ); |
|
| 114 | 114 | |
| 115 | - $cmb->add_field( |
|
| 116 | - array( |
|
| 117 | - 'before_row' => '<h4><b><u>Default Options</u></b></h4>', |
|
| 118 | - 'name' => __( 'Default Meal Plan', 'lsx-health-plan' ), |
|
| 119 | - 'description' => __( 'Set a default meal plan.', 'lsx-health-plan' ), |
|
| 120 | - 'limit' => 1, |
|
| 121 | - 'id' => 'connected_meals', |
|
| 122 | - 'type' => 'post_search_ajax', |
|
| 123 | - 'query_args' => array( |
|
| 124 | - 'post_type' => 'meal', |
|
| 125 | - 'post_status' => array( 'publish' ), |
|
| 126 | - 'posts_per_page' => -1, |
|
| 127 | - ), |
|
| 128 | - ) |
|
| 129 | - ); |
|
| 130 | - if ( function_exists( 'download_monitor' ) ) { |
|
| 131 | - $page_url = 'https://wordpress.org/plugins/download-monitor/'; |
|
| 132 | - $plugin_name = 'Download Monitor'; |
|
| 133 | - $description = sprintf( |
|
| 134 | - /* translators: %s: The subscription info */ |
|
| 135 | - __( 'If you are using <a target="_blank" href="%1$s">%2$s</a> you can set a default download file for your meal here.', 'lsx-search' ), |
|
| 136 | - $page_url, |
|
| 137 | - $plugin_name |
|
| 138 | - ); |
|
| 139 | - $cmb->add_field( |
|
| 140 | - array( |
|
| 141 | - 'name' => __( 'Default Meal Plan PDF', 'lsx-health-plan' ), |
|
| 142 | - 'description' => $description, |
|
| 143 | - 'id' => 'download_meal', |
|
| 144 | - 'type' => 'post_search_ajax', |
|
| 145 | - 'limit' => 1, |
|
| 146 | - 'query_args' => array( |
|
| 147 | - 'post_type' => array( 'dlm_download' ), |
|
| 148 | - 'post_status' => array( 'publish' ), |
|
| 149 | - 'posts_per_page' => -1, |
|
| 150 | - ), |
|
| 151 | - 'after_row' => __( '<p style="font-style: italic;">If you have changed any URL slugs, please remember re-save your permalinks in Settings > Permalinks.</p>', 'lsx-health-plan' ), |
|
| 152 | - ) |
|
| 153 | - ); |
|
| 154 | - } |
|
| 115 | + $cmb->add_field( |
|
| 116 | + array( |
|
| 117 | + 'before_row' => '<h4><b><u>Default Options</u></b></h4>', |
|
| 118 | + 'name' => __( 'Default Meal Plan', 'lsx-health-plan' ), |
|
| 119 | + 'description' => __( 'Set a default meal plan.', 'lsx-health-plan' ), |
|
| 120 | + 'limit' => 1, |
|
| 121 | + 'id' => 'connected_meals', |
|
| 122 | + 'type' => 'post_search_ajax', |
|
| 123 | + 'query_args' => array( |
|
| 124 | + 'post_type' => 'meal', |
|
| 125 | + 'post_status' => array( 'publish' ), |
|
| 126 | + 'posts_per_page' => -1, |
|
| 127 | + ), |
|
| 128 | + ) |
|
| 129 | + ); |
|
| 130 | + if ( function_exists( 'download_monitor' ) ) { |
|
| 131 | + $page_url = 'https://wordpress.org/plugins/download-monitor/'; |
|
| 132 | + $plugin_name = 'Download Monitor'; |
|
| 133 | + $description = sprintf( |
|
| 134 | + /* translators: %s: The subscription info */ |
|
| 135 | + __( 'If you are using <a target="_blank" href="%1$s">%2$s</a> you can set a default download file for your meal here.', 'lsx-search' ), |
|
| 136 | + $page_url, |
|
| 137 | + $plugin_name |
|
| 138 | + ); |
|
| 139 | + $cmb->add_field( |
|
| 140 | + array( |
|
| 141 | + 'name' => __( 'Default Meal Plan PDF', 'lsx-health-plan' ), |
|
| 142 | + 'description' => $description, |
|
| 143 | + 'id' => 'download_meal', |
|
| 144 | + 'type' => 'post_search_ajax', |
|
| 145 | + 'limit' => 1, |
|
| 146 | + 'query_args' => array( |
|
| 147 | + 'post_type' => array( 'dlm_download' ), |
|
| 148 | + 'post_status' => array( 'publish' ), |
|
| 149 | + 'posts_per_page' => -1, |
|
| 150 | + ), |
|
| 151 | + 'after_row' => __( '<p style="font-style: italic;">If you have changed any URL slugs, please remember re-save your permalinks in Settings > Permalinks.</p>', 'lsx-health-plan' ), |
|
| 152 | + ) |
|
| 153 | + ); |
|
| 154 | + } |
|
| 155 | 155 | |
| 156 | - } |
|
| 156 | + } |
|
| 157 | 157 | } |
| 158 | 158 | Meal::get_instance(); |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | * Constructor |
| 26 | 26 | */ |
| 27 | 27 | public function __construct() { |
| 28 | - add_action( 'lsx_hp_settings_page_meal_top', array( $this, 'settings' ), 1, 1 ); |
|
| 28 | + add_action('lsx_hp_settings_page_meal_top', array($this, 'settings'), 1, 1); |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | /** |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | */ |
| 38 | 38 | public static function get_instance() { |
| 39 | 39 | // If the single instance hasn't been set, set it now. |
| 40 | - if ( null === self::$instance ) { |
|
| 40 | + if (null === self::$instance) { |
|
| 41 | 41 | self::$instance = new self(); |
| 42 | 42 | } |
| 43 | 43 | return self::$instance; |
@@ -49,15 +49,15 @@ discard block |
||
| 49 | 49 | * @param object $cmb new_cmb2_box(). |
| 50 | 50 | * @return void |
| 51 | 51 | */ |
| 52 | - public function settings( $cmb ) { |
|
| 52 | + public function settings($cmb) { |
|
| 53 | 53 | $cmb->add_field( |
| 54 | 54 | array( |
| 55 | - 'name' => __( 'Disable Meals', 'lsx-health-plan' ), |
|
| 55 | + 'name' => __('Disable Meals', 'lsx-health-plan'), |
|
| 56 | 56 | 'id' => 'meal_disabled', |
| 57 | 57 | 'type' => 'checkbox', |
| 58 | 58 | 'value' => 1, |
| 59 | 59 | 'default' => 0, |
| 60 | - 'description' => __( 'Disable meal post type if you are wanting a minimal site.', 'lsx-health-plan' ), |
|
| 60 | + 'description' => __('Disable meal post type if you are wanting a minimal site.', 'lsx-health-plan'), |
|
| 61 | 61 | ) |
| 62 | 62 | ); |
| 63 | 63 | |
@@ -65,8 +65,8 @@ discard block |
||
| 65 | 65 | array( |
| 66 | 66 | 'id' => 'meal_archive_description', |
| 67 | 67 | 'type' => 'wysiwyg', |
| 68 | - 'name' => __( 'Archive Description', 'lsx-health-plan' ), |
|
| 69 | - 'description' => __( 'This will show up on the post type archive.', 'lsx-health-plan' ), |
|
| 68 | + 'name' => __('Archive Description', 'lsx-health-plan'), |
|
| 69 | + 'description' => __('This will show up on the post type archive.', 'lsx-health-plan'), |
|
| 70 | 70 | 'options' => array( |
| 71 | 71 | 'textarea_rows' => get_option('default_post_edit_rows', 6), |
| 72 | 72 | ), |
@@ -75,18 +75,18 @@ discard block |
||
| 75 | 75 | |
| 76 | 76 | $cmb->add_field( |
| 77 | 77 | array( |
| 78 | - 'name' => __( 'Your Meal Plan Intro', 'lsx-health-plan' ), |
|
| 78 | + 'name' => __('Your Meal Plan Intro', 'lsx-health-plan'), |
|
| 79 | 79 | 'id' => 'meal_plan_intro', |
| 80 | 80 | 'type' => 'textarea_small', |
| 81 | 81 | 'value' => '', |
| 82 | - 'default' => __( 'Get the right mix of nutrients to keep muscles strong & healthy.', 'lsx-health-plan' ), |
|
| 82 | + 'default' => __('Get the right mix of nutrients to keep muscles strong & healthy.', 'lsx-health-plan'), |
|
| 83 | 83 | ) |
| 84 | 84 | ); |
| 85 | 85 | |
| 86 | 86 | $cmb->add_field( |
| 87 | 87 | array( |
| 88 | 88 | 'before_row' => '<h4><b><u>URL Slug Options</u></b></h4><p style="font-style: italic;">If you need to translate the custom slug for this custom post type, do so below.</p>', |
| 89 | - 'name' => __( 'Meal Slug', 'lsx-health-plan' ), |
|
| 89 | + 'name' => __('Meal Slug', 'lsx-health-plan'), |
|
| 90 | 90 | 'id' => 'endpoint_meal', |
| 91 | 91 | 'type' => 'input', |
| 92 | 92 | 'value' => '', |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | ); |
| 96 | 96 | $cmb->add_field( |
| 97 | 97 | array( |
| 98 | - 'name' => __( 'Meals Archive Slug', 'lsx-health-plan' ), |
|
| 98 | + 'name' => __('Meals Archive Slug', 'lsx-health-plan'), |
|
| 99 | 99 | 'id' => 'endpoint_meal_archive', |
| 100 | 100 | 'type' => 'input', |
| 101 | 101 | 'value' => '', |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | ); |
| 105 | 105 | $cmb->add_field( |
| 106 | 106 | array( |
| 107 | - 'name' => __( 'Single Meal Slug', 'lsx-health-plan' ), |
|
| 107 | + 'name' => __('Single Meal Slug', 'lsx-health-plan'), |
|
| 108 | 108 | 'id' => 'meal_single_slug', |
| 109 | 109 | 'type' => 'input', |
| 110 | 110 | 'value' => '', |
@@ -115,40 +115,40 @@ discard block |
||
| 115 | 115 | $cmb->add_field( |
| 116 | 116 | array( |
| 117 | 117 | 'before_row' => '<h4><b><u>Default Options</u></b></h4>', |
| 118 | - 'name' => __( 'Default Meal Plan', 'lsx-health-plan' ), |
|
| 119 | - 'description' => __( 'Set a default meal plan.', 'lsx-health-plan' ), |
|
| 118 | + 'name' => __('Default Meal Plan', 'lsx-health-plan'), |
|
| 119 | + 'description' => __('Set a default meal plan.', 'lsx-health-plan'), |
|
| 120 | 120 | 'limit' => 1, |
| 121 | 121 | 'id' => 'connected_meals', |
| 122 | 122 | 'type' => 'post_search_ajax', |
| 123 | 123 | 'query_args' => array( |
| 124 | 124 | 'post_type' => 'meal', |
| 125 | - 'post_status' => array( 'publish' ), |
|
| 125 | + 'post_status' => array('publish'), |
|
| 126 | 126 | 'posts_per_page' => -1, |
| 127 | 127 | ), |
| 128 | 128 | ) |
| 129 | 129 | ); |
| 130 | - if ( function_exists( 'download_monitor' ) ) { |
|
| 130 | + if (function_exists('download_monitor')) { |
|
| 131 | 131 | $page_url = 'https://wordpress.org/plugins/download-monitor/'; |
| 132 | 132 | $plugin_name = 'Download Monitor'; |
| 133 | 133 | $description = sprintf( |
| 134 | 134 | /* translators: %s: The subscription info */ |
| 135 | - __( 'If you are using <a target="_blank" href="%1$s">%2$s</a> you can set a default download file for your meal here.', 'lsx-search' ), |
|
| 135 | + __('If you are using <a target="_blank" href="%1$s">%2$s</a> you can set a default download file for your meal here.', 'lsx-search'), |
|
| 136 | 136 | $page_url, |
| 137 | 137 | $plugin_name |
| 138 | 138 | ); |
| 139 | 139 | $cmb->add_field( |
| 140 | 140 | array( |
| 141 | - 'name' => __( 'Default Meal Plan PDF', 'lsx-health-plan' ), |
|
| 141 | + 'name' => __('Default Meal Plan PDF', 'lsx-health-plan'), |
|
| 142 | 142 | 'description' => $description, |
| 143 | 143 | 'id' => 'download_meal', |
| 144 | 144 | 'type' => 'post_search_ajax', |
| 145 | 145 | 'limit' => 1, |
| 146 | 146 | 'query_args' => array( |
| 147 | - 'post_type' => array( 'dlm_download' ), |
|
| 148 | - 'post_status' => array( 'publish' ), |
|
| 147 | + 'post_type' => array('dlm_download'), |
|
| 148 | + 'post_status' => array('publish'), |
|
| 149 | 149 | 'posts_per_page' => -1, |
| 150 | 150 | ), |
| 151 | - 'after_row' => __( '<p style="font-style: italic;">If you have changed any URL slugs, please remember re-save your permalinks in Settings > Permalinks.</p>', 'lsx-health-plan' ), |
|
| 151 | + 'after_row' => __('<p style="font-style: italic;">If you have changed any URL slugs, please remember re-save your permalinks in Settings > Permalinks.</p>', 'lsx-health-plan'), |
|
| 152 | 152 | ) |
| 153 | 153 | ); |
| 154 | 154 | } |
@@ -12,133 +12,133 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | class Plan { |
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * Holds class instance |
|
| 17 | - * |
|
| 18 | - * @since 1.0.0 |
|
| 19 | - * |
|
| 20 | - * @var object \lsx_health_plan\classes\admin\Plan() |
|
| 21 | - */ |
|
| 22 | - protected static $instance = null; |
|
| 15 | + /** |
|
| 16 | + * Holds class instance |
|
| 17 | + * |
|
| 18 | + * @since 1.0.0 |
|
| 19 | + * |
|
| 20 | + * @var object \lsx_health_plan\classes\admin\Plan() |
|
| 21 | + */ |
|
| 22 | + protected static $instance = null; |
|
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * Constructor |
|
| 26 | - */ |
|
| 27 | - public function __construct() { |
|
| 28 | - add_action( 'lsx_hp_settings_page_plan_top', array( $this, 'settings' ), 1, 1 ); |
|
| 29 | - } |
|
| 24 | + /** |
|
| 25 | + * Constructor |
|
| 26 | + */ |
|
| 27 | + public function __construct() { |
|
| 28 | + add_action( 'lsx_hp_settings_page_plan_top', array( $this, 'settings' ), 1, 1 ); |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * Return an instance of this class. |
|
| 33 | - * |
|
| 34 | - * @since 1.0.0 |
|
| 35 | - * |
|
| 36 | - * @return object \lsx_health_plan\classes\admin\Plan() A single instance of this class. |
|
| 37 | - */ |
|
| 38 | - public static function get_instance() { |
|
| 39 | - // If the single instance hasn't been set, set it now. |
|
| 40 | - if ( null === self::$instance ) { |
|
| 41 | - self::$instance = new self(); |
|
| 42 | - } |
|
| 43 | - return self::$instance; |
|
| 44 | - } |
|
| 31 | + /** |
|
| 32 | + * Return an instance of this class. |
|
| 33 | + * |
|
| 34 | + * @since 1.0.0 |
|
| 35 | + * |
|
| 36 | + * @return object \lsx_health_plan\classes\admin\Plan() A single instance of this class. |
|
| 37 | + */ |
|
| 38 | + public static function get_instance() { |
|
| 39 | + // If the single instance hasn't been set, set it now. |
|
| 40 | + if ( null === self::$instance ) { |
|
| 41 | + self::$instance = new self(); |
|
| 42 | + } |
|
| 43 | + return self::$instance; |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - /** |
|
| 47 | - * Registers the general settings. |
|
| 48 | - * |
|
| 49 | - * @param object $cmb new_cmb2_box(). |
|
| 50 | - * @return void |
|
| 51 | - */ |
|
| 52 | - public function settings( $cmb ) { |
|
| 53 | - $cmb->add_field( |
|
| 54 | - array( |
|
| 55 | - 'name' => __( 'Plan Filters', 'lsx-health-plan' ), |
|
| 56 | - 'id' => 'plan_filters_disabled', |
|
| 57 | - 'type' => 'checkbox', |
|
| 58 | - 'value' => 1, |
|
| 59 | - 'default' => 0, |
|
| 60 | - 'description' => __( 'Toggle the display of the tab filters on the post type archive.', 'lsx-health-plan' ), |
|
| 61 | - ) |
|
| 62 | - ); |
|
| 46 | + /** |
|
| 47 | + * Registers the general settings. |
|
| 48 | + * |
|
| 49 | + * @param object $cmb new_cmb2_box(). |
|
| 50 | + * @return void |
|
| 51 | + */ |
|
| 52 | + public function settings( $cmb ) { |
|
| 53 | + $cmb->add_field( |
|
| 54 | + array( |
|
| 55 | + 'name' => __( 'Plan Filters', 'lsx-health-plan' ), |
|
| 56 | + 'id' => 'plan_filters_disabled', |
|
| 57 | + 'type' => 'checkbox', |
|
| 58 | + 'value' => 1, |
|
| 59 | + 'default' => 0, |
|
| 60 | + 'description' => __( 'Toggle the display of the tab filters on the post type archive.', 'lsx-health-plan' ), |
|
| 61 | + ) |
|
| 62 | + ); |
|
| 63 | 63 | |
| 64 | - $cmb->add_field( |
|
| 65 | - array( |
|
| 66 | - 'before_row' => '<h4><b><u>URL Slug Options</u></b></h4><p style="font-style: italic;">If you need to translate the custom slug for this custom post type, do so below.</p>', |
|
| 67 | - 'name' => __( 'My Plan Slug', 'lsx-health-plan' ), |
|
| 68 | - 'description' => __( 'This will be the slug url for redirecting users after login, use the login page slug.', 'lsx-health-plan' ), |
|
| 69 | - 'id' => 'my_plan_slug', |
|
| 70 | - 'type' => 'input', |
|
| 71 | - 'value' => '', |
|
| 72 | - 'default' => 'my-plan', |
|
| 73 | - ) |
|
| 74 | - ); |
|
| 75 | - $cmb->add_field( |
|
| 76 | - array( |
|
| 77 | - 'name' => __( 'Single Plan Slug', 'lsx-health-plan' ), |
|
| 78 | - 'id' => 'plan_single_slug', |
|
| 79 | - 'type' => 'input', |
|
| 80 | - 'value' => '', |
|
| 81 | - 'default' => 'plan', |
|
| 82 | - ) |
|
| 83 | - ); |
|
| 84 | - $cmb->add_field( |
|
| 85 | - array( |
|
| 86 | - 'name' => __( 'Plans Archive Slug', 'lsx-health-plan' ), |
|
| 87 | - 'id' => 'endpoint_plan_archive', |
|
| 88 | - 'type' => 'input', |
|
| 89 | - 'value' => '', |
|
| 90 | - 'default' => 'plans', |
|
| 91 | - ) |
|
| 92 | - ); |
|
| 64 | + $cmb->add_field( |
|
| 65 | + array( |
|
| 66 | + 'before_row' => '<h4><b><u>URL Slug Options</u></b></h4><p style="font-style: italic;">If you need to translate the custom slug for this custom post type, do so below.</p>', |
|
| 67 | + 'name' => __( 'My Plan Slug', 'lsx-health-plan' ), |
|
| 68 | + 'description' => __( 'This will be the slug url for redirecting users after login, use the login page slug.', 'lsx-health-plan' ), |
|
| 69 | + 'id' => 'my_plan_slug', |
|
| 70 | + 'type' => 'input', |
|
| 71 | + 'value' => '', |
|
| 72 | + 'default' => 'my-plan', |
|
| 73 | + ) |
|
| 74 | + ); |
|
| 75 | + $cmb->add_field( |
|
| 76 | + array( |
|
| 77 | + 'name' => __( 'Single Plan Slug', 'lsx-health-plan' ), |
|
| 78 | + 'id' => 'plan_single_slug', |
|
| 79 | + 'type' => 'input', |
|
| 80 | + 'value' => '', |
|
| 81 | + 'default' => 'plan', |
|
| 82 | + ) |
|
| 83 | + ); |
|
| 84 | + $cmb->add_field( |
|
| 85 | + array( |
|
| 86 | + 'name' => __( 'Plans Archive Slug', 'lsx-health-plan' ), |
|
| 87 | + 'id' => 'endpoint_plan_archive', |
|
| 88 | + 'type' => 'input', |
|
| 89 | + 'value' => '', |
|
| 90 | + 'default' => 'plans', |
|
| 91 | + ) |
|
| 92 | + ); |
|
| 93 | 93 | |
| 94 | - $cmb->add_field( |
|
| 95 | - array( |
|
| 96 | - 'before_row' => '<h4><b><u>My Stats Options</u></b></h4>', |
|
| 97 | - 'name' => __( 'Disable All Stats', 'lsx-health-plan' ), |
|
| 98 | - 'desc' => 'Disable All Stats', |
|
| 99 | - 'id' => 'disable_all_stats', |
|
| 100 | - 'type' => 'checkbox', |
|
| 101 | - 'value' => 1, |
|
| 102 | - 'default' => 0, |
|
| 103 | - ) |
|
| 104 | - ); |
|
| 105 | - $cmb->add_field( |
|
| 106 | - array( |
|
| 107 | - 'name' => __( 'Disable Weight', 'lsx-health-plan' ), |
|
| 108 | - 'id' => 'disable_weight_checkbox', |
|
| 109 | - 'type' => 'checkbox', |
|
| 110 | - 'value' => 1, |
|
| 111 | - 'default' => 0, |
|
| 112 | - ) |
|
| 113 | - ); |
|
| 114 | - $cmb->add_field( |
|
| 115 | - array( |
|
| 116 | - 'name' => __( 'Disable Height', 'lsx-health-plan' ), |
|
| 117 | - 'id' => 'disable_height_checkbox', |
|
| 118 | - 'type' => 'checkbox', |
|
| 119 | - 'value' => 1, |
|
| 120 | - 'default' => 0, |
|
| 121 | - ) |
|
| 122 | - ); |
|
| 123 | - $cmb->add_field( |
|
| 124 | - array( |
|
| 125 | - 'name' => __( 'Disable Waist', 'lsx-health-plan' ), |
|
| 126 | - 'id' => 'disable_waist_checkbox', |
|
| 127 | - 'type' => 'checkbox', |
|
| 128 | - 'value' => 1, |
|
| 129 | - 'default' => 0, |
|
| 130 | - ) |
|
| 131 | - ); |
|
| 132 | - $cmb->add_field( |
|
| 133 | - array( |
|
| 134 | - 'name' => __( 'Disable BMI', 'lsx-health-plan' ), |
|
| 135 | - 'id' => 'disable_bmi_checkbox', |
|
| 136 | - 'type' => 'checkbox', |
|
| 137 | - 'value' => 1, |
|
| 138 | - 'default' => 0, |
|
| 139 | - 'after_row' => __( '<p style="font-style: italic;">If you have changed any URL slugs, please remember re-save your permalinks in Settings > Permalinks.</p>', 'lsx-health-plan' ), |
|
| 140 | - ) |
|
| 141 | - ); |
|
| 142 | - } |
|
| 94 | + $cmb->add_field( |
|
| 95 | + array( |
|
| 96 | + 'before_row' => '<h4><b><u>My Stats Options</u></b></h4>', |
|
| 97 | + 'name' => __( 'Disable All Stats', 'lsx-health-plan' ), |
|
| 98 | + 'desc' => 'Disable All Stats', |
|
| 99 | + 'id' => 'disable_all_stats', |
|
| 100 | + 'type' => 'checkbox', |
|
| 101 | + 'value' => 1, |
|
| 102 | + 'default' => 0, |
|
| 103 | + ) |
|
| 104 | + ); |
|
| 105 | + $cmb->add_field( |
|
| 106 | + array( |
|
| 107 | + 'name' => __( 'Disable Weight', 'lsx-health-plan' ), |
|
| 108 | + 'id' => 'disable_weight_checkbox', |
|
| 109 | + 'type' => 'checkbox', |
|
| 110 | + 'value' => 1, |
|
| 111 | + 'default' => 0, |
|
| 112 | + ) |
|
| 113 | + ); |
|
| 114 | + $cmb->add_field( |
|
| 115 | + array( |
|
| 116 | + 'name' => __( 'Disable Height', 'lsx-health-plan' ), |
|
| 117 | + 'id' => 'disable_height_checkbox', |
|
| 118 | + 'type' => 'checkbox', |
|
| 119 | + 'value' => 1, |
|
| 120 | + 'default' => 0, |
|
| 121 | + ) |
|
| 122 | + ); |
|
| 123 | + $cmb->add_field( |
|
| 124 | + array( |
|
| 125 | + 'name' => __( 'Disable Waist', 'lsx-health-plan' ), |
|
| 126 | + 'id' => 'disable_waist_checkbox', |
|
| 127 | + 'type' => 'checkbox', |
|
| 128 | + 'value' => 1, |
|
| 129 | + 'default' => 0, |
|
| 130 | + ) |
|
| 131 | + ); |
|
| 132 | + $cmb->add_field( |
|
| 133 | + array( |
|
| 134 | + 'name' => __( 'Disable BMI', 'lsx-health-plan' ), |
|
| 135 | + 'id' => 'disable_bmi_checkbox', |
|
| 136 | + 'type' => 'checkbox', |
|
| 137 | + 'value' => 1, |
|
| 138 | + 'default' => 0, |
|
| 139 | + 'after_row' => __( '<p style="font-style: italic;">If you have changed any URL slugs, please remember re-save your permalinks in Settings > Permalinks.</p>', 'lsx-health-plan' ), |
|
| 140 | + ) |
|
| 141 | + ); |
|
| 142 | + } |
|
| 143 | 143 | } |
| 144 | 144 | Plan::get_instance(); |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | * Constructor |
| 26 | 26 | */ |
| 27 | 27 | public function __construct() { |
| 28 | - add_action( 'lsx_hp_settings_page_plan_top', array( $this, 'settings' ), 1, 1 ); |
|
| 28 | + add_action('lsx_hp_settings_page_plan_top', array($this, 'settings'), 1, 1); |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | /** |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | */ |
| 38 | 38 | public static function get_instance() { |
| 39 | 39 | // If the single instance hasn't been set, set it now. |
| 40 | - if ( null === self::$instance ) { |
|
| 40 | + if (null === self::$instance) { |
|
| 41 | 41 | self::$instance = new self(); |
| 42 | 42 | } |
| 43 | 43 | return self::$instance; |
@@ -49,23 +49,23 @@ discard block |
||
| 49 | 49 | * @param object $cmb new_cmb2_box(). |
| 50 | 50 | * @return void |
| 51 | 51 | */ |
| 52 | - public function settings( $cmb ) { |
|
| 52 | + public function settings($cmb) { |
|
| 53 | 53 | $cmb->add_field( |
| 54 | 54 | array( |
| 55 | - 'name' => __( 'Plan Filters', 'lsx-health-plan' ), |
|
| 55 | + 'name' => __('Plan Filters', 'lsx-health-plan'), |
|
| 56 | 56 | 'id' => 'plan_filters_disabled', |
| 57 | 57 | 'type' => 'checkbox', |
| 58 | 58 | 'value' => 1, |
| 59 | 59 | 'default' => 0, |
| 60 | - 'description' => __( 'Toggle the display of the tab filters on the post type archive.', 'lsx-health-plan' ), |
|
| 60 | + 'description' => __('Toggle the display of the tab filters on the post type archive.', 'lsx-health-plan'), |
|
| 61 | 61 | ) |
| 62 | 62 | ); |
| 63 | 63 | |
| 64 | 64 | $cmb->add_field( |
| 65 | 65 | array( |
| 66 | 66 | 'before_row' => '<h4><b><u>URL Slug Options</u></b></h4><p style="font-style: italic;">If you need to translate the custom slug for this custom post type, do so below.</p>', |
| 67 | - 'name' => __( 'My Plan Slug', 'lsx-health-plan' ), |
|
| 68 | - 'description' => __( 'This will be the slug url for redirecting users after login, use the login page slug.', 'lsx-health-plan' ), |
|
| 67 | + 'name' => __('My Plan Slug', 'lsx-health-plan'), |
|
| 68 | + 'description' => __('This will be the slug url for redirecting users after login, use the login page slug.', 'lsx-health-plan'), |
|
| 69 | 69 | 'id' => 'my_plan_slug', |
| 70 | 70 | 'type' => 'input', |
| 71 | 71 | 'value' => '', |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | ); |
| 75 | 75 | $cmb->add_field( |
| 76 | 76 | array( |
| 77 | - 'name' => __( 'Single Plan Slug', 'lsx-health-plan' ), |
|
| 77 | + 'name' => __('Single Plan Slug', 'lsx-health-plan'), |
|
| 78 | 78 | 'id' => 'plan_single_slug', |
| 79 | 79 | 'type' => 'input', |
| 80 | 80 | 'value' => '', |
@@ -83,7 +83,7 @@ discard block |
||
| 83 | 83 | ); |
| 84 | 84 | $cmb->add_field( |
| 85 | 85 | array( |
| 86 | - 'name' => __( 'Plans Archive Slug', 'lsx-health-plan' ), |
|
| 86 | + 'name' => __('Plans Archive Slug', 'lsx-health-plan'), |
|
| 87 | 87 | 'id' => 'endpoint_plan_archive', |
| 88 | 88 | 'type' => 'input', |
| 89 | 89 | 'value' => '', |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | $cmb->add_field( |
| 95 | 95 | array( |
| 96 | 96 | 'before_row' => '<h4><b><u>My Stats Options</u></b></h4>', |
| 97 | - 'name' => __( 'Disable All Stats', 'lsx-health-plan' ), |
|
| 97 | + 'name' => __('Disable All Stats', 'lsx-health-plan'), |
|
| 98 | 98 | 'desc' => 'Disable All Stats', |
| 99 | 99 | 'id' => 'disable_all_stats', |
| 100 | 100 | 'type' => 'checkbox', |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | ); |
| 105 | 105 | $cmb->add_field( |
| 106 | 106 | array( |
| 107 | - 'name' => __( 'Disable Weight', 'lsx-health-plan' ), |
|
| 107 | + 'name' => __('Disable Weight', 'lsx-health-plan'), |
|
| 108 | 108 | 'id' => 'disable_weight_checkbox', |
| 109 | 109 | 'type' => 'checkbox', |
| 110 | 110 | 'value' => 1, |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | ); |
| 114 | 114 | $cmb->add_field( |
| 115 | 115 | array( |
| 116 | - 'name' => __( 'Disable Height', 'lsx-health-plan' ), |
|
| 116 | + 'name' => __('Disable Height', 'lsx-health-plan'), |
|
| 117 | 117 | 'id' => 'disable_height_checkbox', |
| 118 | 118 | 'type' => 'checkbox', |
| 119 | 119 | 'value' => 1, |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | ); |
| 123 | 123 | $cmb->add_field( |
| 124 | 124 | array( |
| 125 | - 'name' => __( 'Disable Waist', 'lsx-health-plan' ), |
|
| 125 | + 'name' => __('Disable Waist', 'lsx-health-plan'), |
|
| 126 | 126 | 'id' => 'disable_waist_checkbox', |
| 127 | 127 | 'type' => 'checkbox', |
| 128 | 128 | 'value' => 1, |
@@ -131,12 +131,12 @@ discard block |
||
| 131 | 131 | ); |
| 132 | 132 | $cmb->add_field( |
| 133 | 133 | array( |
| 134 | - 'name' => __( 'Disable BMI', 'lsx-health-plan' ), |
|
| 134 | + 'name' => __('Disable BMI', 'lsx-health-plan'), |
|
| 135 | 135 | 'id' => 'disable_bmi_checkbox', |
| 136 | 136 | 'type' => 'checkbox', |
| 137 | 137 | 'value' => 1, |
| 138 | 138 | 'default' => 0, |
| 139 | - 'after_row' => __( '<p style="font-style: italic;">If you have changed any URL slugs, please remember re-save your permalinks in Settings > Permalinks.</p>', 'lsx-health-plan' ), |
|
| 139 | + 'after_row' => __('<p style="font-style: italic;">If you have changed any URL slugs, please remember re-save your permalinks in Settings > Permalinks.</p>', 'lsx-health-plan'), |
|
| 140 | 140 | ) |
| 141 | 141 | ); |
| 142 | 142 | } |