@@ -32,39 +32,39 @@ |
||
| 32 | 32 | |
| 33 | 33 | <div class="entry-content"> |
| 34 | 34 | <?php |
| 35 | - if ( function_exists( 'is_wc_endpoint_url' ) && is_wc_endpoint_url( 'edit-account' ) ) { |
|
| 36 | - $classes = get_body_class(); |
|
| 37 | - if ( in_array( 'has-block-banner', $classes ) ) { |
|
| 38 | - $blocks = parse_blocks( get_the_content() ); |
|
| 39 | - foreach ( $blocks as $block ) { |
|
| 40 | - if ( 'lsx-blocks/lsx-banner-box' === $block['blockName'] ) { |
|
| 41 | - echo wp_kses_post( $block['innerHTML'] ); |
|
| 42 | - } |
|
| 43 | - } |
|
| 44 | - } elseif ( in_array( 'has-block-cover', $classes ) ) { |
|
| 45 | - $blocks = parse_blocks( get_the_content() ); |
|
| 46 | - foreach ( $blocks as $block ) { |
|
| 47 | - //print( '<pre>' . print_r( $block, true ) . '</pre>' ); |
|
| 48 | - if ( 'core/cover' === $block['blockName'] ) { |
|
| 49 | - echo wp_kses_post( render_block( $block ) ); |
|
| 50 | - } |
|
| 51 | - } |
|
| 52 | - } else { |
|
| 53 | - $my_plan_string = esc_html__( 'My Dashboard', 'lsx-health-plan' ); |
|
| 54 | - echo wp_kses_post( '<div class="lsx-health-plan my-profile-block wp-block-cover alignfull"><div class="wp-block-cover__inner-container"><h2>' . $my_plan_string . '</h2></div></div>' ); |
|
| 55 | - } |
|
| 56 | - |
|
| 57 | - if ( is_user_logged_in() ) { |
|
| 58 | - $my_profile_string = esc_html__( 'My Profile', 'lsx-health-plan' ); |
|
| 59 | - $my_profile_tagline = esc_html__( 'Update your details below', 'lsx-health-plan' ); |
|
| 60 | - } |
|
| 61 | - echo do_shortcode( '<div id="edit-account-tab">[lsx_health_plan_my_profile_tabs]<div class="edit-account-section"><h2 class="title-lined">' . $my_profile_string . '</h2><p>' . $my_profile_tagline . '</p>[woocommerce_my_account]</div></div>' ); |
|
| 62 | - } else if ( function_exists( 'is_wc_endpoint_url' ) && is_wc_endpoint_url( 'lost-password' ) ) { |
|
| 63 | - echo do_shortcode( '[woocommerce_my_account]' ); |
|
| 64 | - } else { |
|
| 65 | - the_content(); |
|
| 66 | - } |
|
| 67 | - ?> |
|
| 35 | + if ( function_exists( 'is_wc_endpoint_url' ) && is_wc_endpoint_url( 'edit-account' ) ) { |
|
| 36 | + $classes = get_body_class(); |
|
| 37 | + if ( in_array( 'has-block-banner', $classes ) ) { |
|
| 38 | + $blocks = parse_blocks( get_the_content() ); |
|
| 39 | + foreach ( $blocks as $block ) { |
|
| 40 | + if ( 'lsx-blocks/lsx-banner-box' === $block['blockName'] ) { |
|
| 41 | + echo wp_kses_post( $block['innerHTML'] ); |
|
| 42 | + } |
|
| 43 | + } |
|
| 44 | + } elseif ( in_array( 'has-block-cover', $classes ) ) { |
|
| 45 | + $blocks = parse_blocks( get_the_content() ); |
|
| 46 | + foreach ( $blocks as $block ) { |
|
| 47 | + //print( '<pre>' . print_r( $block, true ) . '</pre>' ); |
|
| 48 | + if ( 'core/cover' === $block['blockName'] ) { |
|
| 49 | + echo wp_kses_post( render_block( $block ) ); |
|
| 50 | + } |
|
| 51 | + } |
|
| 52 | + } else { |
|
| 53 | + $my_plan_string = esc_html__( 'My Dashboard', 'lsx-health-plan' ); |
|
| 54 | + echo wp_kses_post( '<div class="lsx-health-plan my-profile-block wp-block-cover alignfull"><div class="wp-block-cover__inner-container"><h2>' . $my_plan_string . '</h2></div></div>' ); |
|
| 55 | + } |
|
| 56 | + |
|
| 57 | + if ( is_user_logged_in() ) { |
|
| 58 | + $my_profile_string = esc_html__( 'My Profile', 'lsx-health-plan' ); |
|
| 59 | + $my_profile_tagline = esc_html__( 'Update your details below', 'lsx-health-plan' ); |
|
| 60 | + } |
|
| 61 | + echo do_shortcode( '<div id="edit-account-tab">[lsx_health_plan_my_profile_tabs]<div class="edit-account-section"><h2 class="title-lined">' . $my_profile_string . '</h2><p>' . $my_profile_tagline . '</p>[woocommerce_my_account]</div></div>' ); |
|
| 62 | + } else if ( function_exists( 'is_wc_endpoint_url' ) && is_wc_endpoint_url( 'lost-password' ) ) { |
|
| 63 | + echo do_shortcode( '[woocommerce_my_account]' ); |
|
| 64 | + } else { |
|
| 65 | + the_content(); |
|
| 66 | + } |
|
| 67 | + ?> |
|
| 68 | 68 | </div><!-- .entry-content --> |
| 69 | 69 | |
| 70 | 70 | <?php lsx_entry_bottom(); ?> |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | <?php lsx_content_wrap_before(); ?> |
| 14 | 14 | |
| 15 | -<div id="primary" class="content-area <?php echo esc_attr( lsx_main_class() ); ?>"> |
|
| 15 | +<div id="primary" class="content-area <?php echo esc_attr(lsx_main_class()); ?>"> |
|
| 16 | 16 | |
| 17 | 17 | <?php lsx_content_before(); ?> |
| 18 | 18 | |
@@ -20,9 +20,9 @@ discard block |
||
| 20 | 20 | |
| 21 | 21 | <?php lsx_content_top(); ?> |
| 22 | 22 | |
| 23 | - <?php if ( have_posts() ) : ?> |
|
| 23 | + <?php if (have_posts()) : ?> |
|
| 24 | 24 | |
| 25 | - <?php while ( have_posts() ) : the_post(); ?> |
|
| 25 | + <?php while (have_posts()) : the_post(); ?> |
|
| 26 | 26 | |
| 27 | 27 | <?php lsx_entry_before(); ?> |
| 28 | 28 | |
@@ -32,35 +32,35 @@ discard block |
||
| 32 | 32 | |
| 33 | 33 | <div class="entry-content"> |
| 34 | 34 | <?php |
| 35 | - if ( function_exists( 'is_wc_endpoint_url' ) && is_wc_endpoint_url( 'edit-account' ) ) { |
|
| 35 | + if (function_exists('is_wc_endpoint_url') && is_wc_endpoint_url('edit-account')) { |
|
| 36 | 36 | $classes = get_body_class(); |
| 37 | - if ( in_array( 'has-block-banner', $classes ) ) { |
|
| 38 | - $blocks = parse_blocks( get_the_content() ); |
|
| 39 | - foreach ( $blocks as $block ) { |
|
| 40 | - if ( 'lsx-blocks/lsx-banner-box' === $block['blockName'] ) { |
|
| 41 | - echo wp_kses_post( $block['innerHTML'] ); |
|
| 37 | + if (in_array('has-block-banner', $classes)) { |
|
| 38 | + $blocks = parse_blocks(get_the_content()); |
|
| 39 | + foreach ($blocks as $block) { |
|
| 40 | + if ('lsx-blocks/lsx-banner-box' === $block['blockName']) { |
|
| 41 | + echo wp_kses_post($block['innerHTML']); |
|
| 42 | 42 | } |
| 43 | 43 | } |
| 44 | - } elseif ( in_array( 'has-block-cover', $classes ) ) { |
|
| 45 | - $blocks = parse_blocks( get_the_content() ); |
|
| 46 | - foreach ( $blocks as $block ) { |
|
| 44 | + } elseif (in_array('has-block-cover', $classes)) { |
|
| 45 | + $blocks = parse_blocks(get_the_content()); |
|
| 46 | + foreach ($blocks as $block) { |
|
| 47 | 47 | //print( '<pre>' . print_r( $block, true ) . '</pre>' ); |
| 48 | - if ( 'core/cover' === $block['blockName'] ) { |
|
| 49 | - echo wp_kses_post( render_block( $block ) ); |
|
| 48 | + if ('core/cover' === $block['blockName']) { |
|
| 49 | + echo wp_kses_post(render_block($block)); |
|
| 50 | 50 | } |
| 51 | 51 | } |
| 52 | 52 | } else { |
| 53 | - $my_plan_string = esc_html__( 'My Dashboard', 'lsx-health-plan' ); |
|
| 54 | - echo wp_kses_post( '<div class="lsx-health-plan my-profile-block wp-block-cover alignfull"><div class="wp-block-cover__inner-container"><h2>' . $my_plan_string . '</h2></div></div>' ); |
|
| 53 | + $my_plan_string = esc_html__('My Dashboard', 'lsx-health-plan'); |
|
| 54 | + echo wp_kses_post('<div class="lsx-health-plan my-profile-block wp-block-cover alignfull"><div class="wp-block-cover__inner-container"><h2>' . $my_plan_string . '</h2></div></div>'); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - if ( is_user_logged_in() ) { |
|
| 58 | - $my_profile_string = esc_html__( 'My Profile', 'lsx-health-plan' ); |
|
| 59 | - $my_profile_tagline = esc_html__( 'Update your details below', 'lsx-health-plan' ); |
|
| 57 | + if (is_user_logged_in()) { |
|
| 58 | + $my_profile_string = esc_html__('My Profile', 'lsx-health-plan'); |
|
| 59 | + $my_profile_tagline = esc_html__('Update your details below', 'lsx-health-plan'); |
|
| 60 | 60 | } |
| 61 | - echo do_shortcode( '<div id="edit-account-tab">[lsx_health_plan_my_profile_tabs]<div class="edit-account-section"><h2 class="title-lined">' . $my_profile_string . '</h2><p>' . $my_profile_tagline . '</p>[woocommerce_my_account]</div></div>' ); |
|
| 62 | - } else if ( function_exists( 'is_wc_endpoint_url' ) && is_wc_endpoint_url( 'lost-password' ) ) { |
|
| 63 | - echo do_shortcode( '[woocommerce_my_account]' ); |
|
| 61 | + echo do_shortcode('<div id="edit-account-tab">[lsx_health_plan_my_profile_tabs]<div class="edit-account-section"><h2 class="title-lined">' . $my_profile_string . '</h2><p>' . $my_profile_tagline . '</p>[woocommerce_my_account]</div></div>'); |
|
| 62 | + } else if (function_exists('is_wc_endpoint_url') && is_wc_endpoint_url('lost-password')) { |
|
| 63 | + echo do_shortcode('[woocommerce_my_account]'); |
|
| 64 | 64 | } else { |
| 65 | 65 | the_content(); |
| 66 | 66 | } |
@@ -11,29 +11,29 @@ discard block |
||
| 11 | 11 | * @return void |
| 12 | 12 | */ |
| 13 | 13 | function lsx_health_plan_workout_box() { |
| 14 | - if ( ! post_type_exists( 'workout' ) ) { |
|
| 15 | - return; |
|
| 16 | - } |
|
| 17 | - $intro_text = \lsx_health_plan\functions\get_option( 'workout_intro', false ); |
|
| 18 | - ?> |
|
| 14 | + if ( ! post_type_exists( 'workout' ) ) { |
|
| 15 | + return; |
|
| 16 | + } |
|
| 17 | + $intro_text = \lsx_health_plan\functions\get_option( 'workout_intro', false ); |
|
| 18 | + ?> |
|
| 19 | 19 | <div class="workout-instructions"> |
| 20 | 20 | <div class="row"> |
| 21 | 21 | <div class="col-md-12"> |
| 22 | 22 | <?php |
| 23 | - if ( false !== $intro_text ) { |
|
| 24 | - ?> |
|
| 23 | + if ( false !== $intro_text ) { |
|
| 24 | + ?> |
|
| 25 | 25 | <div class="excerpt"> |
| 26 | 26 | <p><?php echo wp_kses_post( wpautop( $intro_text ) ); ?></p> |
| 27 | 27 | </div> |
| 28 | 28 | <?php |
| 29 | - } else { |
|
| 30 | - ?> |
|
| 29 | + } else { |
|
| 30 | + ?> |
|
| 31 | 31 | <div class="content-intro"> |
| 32 | 32 | <h3><?php esc_html_e( "Don't forget your warm up!", 'lsx-health-plan' ); ?></h3> |
| 33 | 33 | <p><?php esc_html_e( 'Be sure to do the warm-up before every workout session.', 'lsx-health-plan' ); ?></p> |
| 34 | 34 | </div> |
| 35 | 35 | <?php |
| 36 | - } ?> |
|
| 36 | + } ?> |
|
| 37 | 37 | </div> |
| 38 | 38 | </div> |
| 39 | 39 | </div> |
@@ -46,28 +46,28 @@ discard block |
||
| 46 | 46 | * @return void |
| 47 | 47 | */ |
| 48 | 48 | function lsx_health_plan_meal_box() { |
| 49 | - if ( ! post_type_exists( 'meal' ) ) { |
|
| 50 | - return; |
|
| 51 | - } |
|
| 52 | - ?> |
|
| 49 | + if ( ! post_type_exists( 'meal' ) ) { |
|
| 50 | + return; |
|
| 51 | + } |
|
| 52 | + ?> |
|
| 53 | 53 | <div class="col-md-4" > |
| 54 | 54 | <div class="lsx-health-plan-box"> |
| 55 | 55 | <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> |
| 56 | 56 | <div class="spacer"></div> |
| 57 | 57 | <?php |
| 58 | - $intro_text = \lsx_health_plan\functions\get_option( 'meal_plan_intro', false ); |
|
| 59 | - if ( false !== $intro_text ) { |
|
| 60 | - ?> |
|
| 58 | + $intro_text = \lsx_health_plan\functions\get_option( 'meal_plan_intro', false ); |
|
| 59 | + if ( false !== $intro_text ) { |
|
| 60 | + ?> |
|
| 61 | 61 | <div class="excerpt"> |
| 62 | 62 | <p><?php echo wp_kses_post( $intro_text ); ?></p> |
| 63 | 63 | </div> |
| 64 | 64 | <?php |
| 65 | - } |
|
| 66 | - $meal = \lsx_health_plan\functions\get_option( 'endpoint_meal', false ); |
|
| 67 | - if ( false === $meal ) { |
|
| 68 | - $meal = 'meal'; |
|
| 69 | - } |
|
| 70 | - ?> |
|
| 65 | + } |
|
| 66 | + $meal = \lsx_health_plan\functions\get_option( 'endpoint_meal', false ); |
|
| 67 | + if ( false === $meal ) { |
|
| 68 | + $meal = 'meal'; |
|
| 69 | + } |
|
| 70 | + ?> |
|
| 71 | 71 | <a href="<?php the_permalink(); ?><?php echo esc_attr( $meal ); ?>/" class="btn"><?php esc_html_e( 'View your meal plan', 'lsx-health-plan' ); ?></a> |
| 72 | 72 | </div> |
| 73 | 73 | </div> |
@@ -80,28 +80,28 @@ discard block |
||
| 80 | 80 | * @return void |
| 81 | 81 | */ |
| 82 | 82 | function lsx_health_plan_recipe_box() { |
| 83 | - if ( ! post_type_exists( 'recipe' ) ) { |
|
| 84 | - return; |
|
| 85 | - } |
|
| 86 | - ?> |
|
| 83 | + if ( ! post_type_exists( 'recipe' ) ) { |
|
| 84 | + return; |
|
| 85 | + } |
|
| 86 | + ?> |
|
| 87 | 87 | <div class="col-md-4" > |
| 88 | 88 | <div class="lsx-health-plan-box"> |
| 89 | 89 | <h3 class="title recipes-title title-lined"><?php esc_html_e( 'Recipes', 'lsx-health-plan' ); ?><?php lsx_get_svg_icon( 'recipes.svg' ); ?></h3> |
| 90 | 90 | <div class="spacer"></div> |
| 91 | 91 | <?php |
| 92 | - $intro_text = \lsx_health_plan\functions\get_option( 'recipes_intro', false ); |
|
| 93 | - if ( false !== $intro_text ) { |
|
| 94 | - ?> |
|
| 92 | + $intro_text = \lsx_health_plan\functions\get_option( 'recipes_intro', false ); |
|
| 93 | + if ( false !== $intro_text ) { |
|
| 94 | + ?> |
|
| 95 | 95 | <div class="excerpt"> |
| 96 | 96 | <p><?php echo wp_kses_post( $intro_text ); ?></p> |
| 97 | 97 | </div> |
| 98 | 98 | <?php |
| 99 | - } |
|
| 100 | - $recipes = \lsx_health_plan\functions\get_option( 'endpoint_recipe', false ); |
|
| 101 | - if ( false === $recipes ) { |
|
| 102 | - $recipes = 'recipes'; |
|
| 103 | - } |
|
| 104 | - ?> |
|
| 99 | + } |
|
| 100 | + $recipes = \lsx_health_plan\functions\get_option( 'endpoint_recipe', false ); |
|
| 101 | + if ( false === $recipes ) { |
|
| 102 | + $recipes = 'recipes'; |
|
| 103 | + } |
|
| 104 | + ?> |
|
| 105 | 105 | <a href="<?php the_permalink(); ?><?php echo esc_attr( $recipes ); ?>/" class="btn"><?php esc_html_e( 'View all recipes', 'lsx-health-plan' ); ?></a> |
| 106 | 106 | </div> |
| 107 | 107 | </div> |
@@ -114,8 +114,8 @@ discard block |
||
| 114 | 114 | * @return void |
| 115 | 115 | */ |
| 116 | 116 | function lsx_health_plan_downloads_box() { |
| 117 | - global $current_user; |
|
| 118 | - ?> |
|
| 117 | + global $current_user; |
|
| 118 | + ?> |
|
| 119 | 119 | <div class="col-md-4 day-download-box" > |
| 120 | 120 | <div class="lsx-health-plan-box"> |
| 121 | 121 | <h3 class="title downloads-title title-lined"><?php esc_html_e( 'Downloads', 'lsx-health-plan' ); ?><?php lsx_get_svg_icon( 'download.svg' ); ?></h3> |
@@ -123,13 +123,13 @@ discard block |
||
| 123 | 123 | <div class="download-list"> |
| 124 | 124 | <ul> |
| 125 | 125 | <?php |
| 126 | - $downloads = \lsx_health_plan\functions\get_downloads(); |
|
| 127 | - if ( ! empty( $downloads ) ) { |
|
| 128 | - foreach ( $downloads as $download ) { |
|
| 129 | - echo wp_kses_post( '<li><a href=""><i class="fa fa-file-pdf"></i>' . do_shortcode( '[download id="' . $download . '"]' ) . '</a></li>' ); |
|
| 130 | - } |
|
| 131 | - } |
|
| 132 | - ?> |
|
| 126 | + $downloads = \lsx_health_plan\functions\get_downloads(); |
|
| 127 | + if ( ! empty( $downloads ) ) { |
|
| 128 | + foreach ( $downloads as $download ) { |
|
| 129 | + echo wp_kses_post( '<li><a href=""><i class="fa fa-file-pdf"></i>' . do_shortcode( '[download id="' . $download . '"]' ) . '</a></li>' ); |
|
| 130 | + } |
|
| 131 | + } |
|
| 132 | + ?> |
|
| 133 | 133 | </ul> |
| 134 | 134 | </div> |
| 135 | 135 | </div> |
@@ -144,15 +144,15 @@ discard block |
||
| 144 | 144 | * @return void |
| 145 | 145 | */ |
| 146 | 146 | function lsx_health_plan_nav_class( $tab = '' ) { |
| 147 | - $nav_classes = array(); |
|
| 148 | - if ( function_exists( 'is_wc_endpoint_url' ) && 'edit-account' === $tab && is_wc_endpoint_url( 'edit-account' ) ) { |
|
| 149 | - $nav_classes[] = 'active'; |
|
| 150 | - } elseif ( lsx_health_plan_is_current_tab( $tab ) ) { |
|
| 151 | - $nav_classes[] = 'active'; |
|
| 152 | - } |
|
| 153 | - if ( ! empty( $nav_classes ) ) { |
|
| 154 | - echo wp_kses_post( implode( ' ', $nav_classes ) ); |
|
| 155 | - } |
|
| 147 | + $nav_classes = array(); |
|
| 148 | + if ( function_exists( 'is_wc_endpoint_url' ) && 'edit-account' === $tab && is_wc_endpoint_url( 'edit-account' ) ) { |
|
| 149 | + $nav_classes[] = 'active'; |
|
| 150 | + } elseif ( lsx_health_plan_is_current_tab( $tab ) ) { |
|
| 151 | + $nav_classes[] = 'active'; |
|
| 152 | + } |
|
| 153 | + if ( ! empty( $nav_classes ) ) { |
|
| 154 | + echo wp_kses_post( implode( ' ', $nav_classes ) ); |
|
| 155 | + } |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | /** |
@@ -161,34 +161,34 @@ discard block |
||
| 161 | 161 | * @return void |
| 162 | 162 | */ |
| 163 | 163 | function lsx_health_plan_my_profile_tabs() { |
| 164 | - ?> |
|
| 164 | + ?> |
|
| 165 | 165 | <div id="account-nav"> |
| 166 | 166 | <ul class="nav nav-pills"> |
| 167 | 167 | <li class=" |
| 168 | 168 | <?php |
| 169 | - if ( ( function_exists( 'is_wc_endpoint_url' ) && ! is_wc_endpoint_url( 'edit-account' ) ) || ! function_exists( 'is_wc_endpoint_url' ) ) { |
|
| 170 | - echo esc_attr( 'active' ); |
|
| 171 | - } |
|
| 172 | - ?> |
|
| 169 | + if ( ( function_exists( 'is_wc_endpoint_url' ) && ! is_wc_endpoint_url( 'edit-account' ) ) || ! function_exists( 'is_wc_endpoint_url' ) ) { |
|
| 170 | + echo esc_attr( 'active' ); |
|
| 171 | + } |
|
| 172 | + ?> |
|
| 173 | 173 | "><a class="my-plan-tab" href="<?php the_permalink(); ?>"><?php esc_html_e( 'My Plans', 'lsx-health-plan' ); ?></a></li> |
| 174 | 174 | <?php |
| 175 | - if ( function_exists( 'WC' ) ) { |
|
| 176 | - ?> |
|
| 175 | + if ( function_exists( 'WC' ) ) { |
|
| 176 | + ?> |
|
| 177 | 177 | <li class=" |
| 178 | 178 | <?php |
| 179 | - if ( function_exists( 'is_wc_endpoint_url' ) && is_wc_endpoint_url( 'edit-account' ) ) { |
|
| 180 | - echo esc_attr( 'active' ); |
|
| 181 | - } |
|
| 182 | - ?> |
|
| 179 | + if ( function_exists( 'is_wc_endpoint_url' ) && is_wc_endpoint_url( 'edit-account' ) ) { |
|
| 180 | + echo esc_attr( 'active' ); |
|
| 181 | + } |
|
| 182 | + ?> |
|
| 183 | 183 | "><a class="account-details-tab" href="<?php the_permalink(); ?>edit-account/"><?php esc_html_e( 'Account Details', 'lsx-health-plan' ); ?></a></li> |
| 184 | 184 | <?php |
| 185 | - } |
|
| 186 | - if ( is_user_logged_in() ) { |
|
| 187 | - ?> |
|
| 185 | + } |
|
| 186 | + if ( is_user_logged_in() ) { |
|
| 187 | + ?> |
|
| 188 | 188 | <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> |
| 189 | 189 | <?php |
| 190 | - } |
|
| 191 | - ?> |
|
| 190 | + } |
|
| 191 | + ?> |
|
| 192 | 192 | </ul> |
| 193 | 193 | </div> |
| 194 | 194 | <?php |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | * @return void |
| 201 | 201 | */ |
| 202 | 202 | function lsx_health_plan_my_profile_box() { |
| 203 | - ?> |
|
| 203 | + ?> |
|
| 204 | 204 | <div class="lsx-health-plan my-profile-block wp-block-cover alignfull"> |
| 205 | 205 | <div class="wp-block-cover__inner-container"> |
| 206 | 206 | <h2><?php esc_html_e( 'My Dashboard', 'lsx-health-plan' ); ?></h2> |
@@ -210,14 +210,14 @@ discard block |
||
| 210 | 210 | <div class="profile-navigation"> |
| 211 | 211 | <div class="profile-photo"> |
| 212 | 212 | <?php |
| 213 | - global $current_user; |
|
| 214 | - if ( function_exists( 'WC' ) ) { |
|
| 215 | - get_current_user(); |
|
| 216 | - } |
|
| 217 | - if ( class_exists( 'WP_User_Avatar_Setup' ) ) { |
|
| 218 | - echo get_avatar( $current_user->ID, 240 ); |
|
| 219 | - } |
|
| 220 | - ?> |
|
| 213 | + global $current_user; |
|
| 214 | + if ( function_exists( 'WC' ) ) { |
|
| 215 | + get_current_user(); |
|
| 216 | + } |
|
| 217 | + if ( class_exists( 'WP_User_Avatar_Setup' ) ) { |
|
| 218 | + echo get_avatar( $current_user->ID, 240 ); |
|
| 219 | + } |
|
| 220 | + ?> |
|
| 221 | 221 | </div> |
| 222 | 222 | </div> |
| 223 | 223 | <?php } ?> |
@@ -225,88 +225,88 @@ discard block |
||
| 225 | 225 | <div class="profile-details"> |
| 226 | 226 | <h1 class="title-lined has-text-color"><?php echo esc_html( $current_user->display_name ); ?></h1> |
| 227 | 227 | <?php |
| 228 | - $disable_stats = \lsx_health_plan\functions\get_option( 'disable_all_stats', false ); |
|
| 229 | - if ( 'on' !== $disable_stats && function_exists( 'WC' ) ) { |
|
| 228 | + $disable_stats = \lsx_health_plan\functions\get_option( 'disable_all_stats', false ); |
|
| 229 | + if ( 'on' !== $disable_stats && function_exists( 'WC' ) ) { |
|
| 230 | 230 | |
| 231 | - $is_weight_disabled = \lsx_health_plan\functions\get_option( 'disable_weight_checkbox', false ); |
|
| 232 | - $is_height_disabled = \lsx_health_plan\functions\get_option( 'disable_height_checkbox', false ); |
|
| 233 | - $is_waist_disabled = \lsx_health_plan\functions\get_option( 'disable_waist_checkbox', false ); |
|
| 234 | - $is_bmi_disabled = \lsx_health_plan\functions\get_option( 'disable_bmi_checkbox', false ); |
|
| 231 | + $is_weight_disabled = \lsx_health_plan\functions\get_option( 'disable_weight_checkbox', false ); |
|
| 232 | + $is_height_disabled = \lsx_health_plan\functions\get_option( 'disable_height_checkbox', false ); |
|
| 233 | + $is_waist_disabled = \lsx_health_plan\functions\get_option( 'disable_waist_checkbox', false ); |
|
| 234 | + $is_bmi_disabled = \lsx_health_plan\functions\get_option( 'disable_bmi_checkbox', false ); |
|
| 235 | 235 | |
| 236 | - $weight = get_user_meta( get_current_user_id(), 'weight', true ); |
|
| 237 | - $waist = get_user_meta( get_current_user_id(), 'waist', true ); |
|
| 238 | - $height = get_user_meta( get_current_user_id(), 'height', true ); |
|
| 236 | + $weight = get_user_meta( get_current_user_id(), 'weight', true ); |
|
| 237 | + $waist = get_user_meta( get_current_user_id(), 'waist', true ); |
|
| 238 | + $height = get_user_meta( get_current_user_id(), 'height', true ); |
|
| 239 | 239 | |
| 240 | - $height_m = 0; |
|
| 241 | - if ( is_numeric( $height ) ) { |
|
| 242 | - $height_m = $height / 100; |
|
| 243 | - } |
|
| 240 | + $height_m = 0; |
|
| 241 | + if ( is_numeric( $height ) ) { |
|
| 242 | + $height_m = $height / 100; |
|
| 243 | + } |
|
| 244 | 244 | |
| 245 | - if ( 1 < $weight && 1 < $height_m ) { |
|
| 246 | - $bmi = $weight / ( $height_m * $height_m ); |
|
| 247 | - $bmi = number_format( $bmi, 1 ); |
|
| 248 | - } else { |
|
| 249 | - $bmi = __( 'Add more data', 'lsx-health-plan' ); |
|
| 250 | - } |
|
| 245 | + if ( 1 < $weight && 1 < $height_m ) { |
|
| 246 | + $bmi = $weight / ( $height_m * $height_m ); |
|
| 247 | + $bmi = number_format( $bmi, 1 ); |
|
| 248 | + } else { |
|
| 249 | + $bmi = __( 'Add more data', 'lsx-health-plan' ); |
|
| 250 | + } |
|
| 251 | 251 | |
| 252 | - ?> |
|
| 252 | + ?> |
|
| 253 | 253 | |
| 254 | 254 | <div> |
| 255 | 255 | <?php if ( 'on' !== $is_weight_disabled ) { ?> |
| 256 | 256 | <span><strong><?php esc_html_e( 'Weight:', 'lsx-health-plan' ); ?></strong> |
| 257 | 257 | <?php |
| 258 | - if ( '' !== $weight ) { |
|
| 259 | - echo wp_kses_post( $weight . ' kg' ); |
|
| 260 | - } else { |
|
| 261 | - echo '/'; |
|
| 262 | - } |
|
| 263 | - ?> |
|
| 258 | + if ( '' !== $weight ) { |
|
| 259 | + echo wp_kses_post( $weight . ' kg' ); |
|
| 260 | + } else { |
|
| 261 | + echo '/'; |
|
| 262 | + } |
|
| 263 | + ?> |
|
| 264 | 264 | </span> |
| 265 | 265 | <?php } |
| 266 | - if ( 'on' !== $is_waist_disabled ) { |
|
| 267 | - ?> |
|
| 266 | + if ( 'on' !== $is_waist_disabled ) { |
|
| 267 | + ?> |
|
| 268 | 268 | <span><strong><?php esc_html_e( 'Waist:', 'lsx-health-plan' ); ?></strong> |
| 269 | 269 | <?php |
| 270 | - if ( '' !== $waist ) { |
|
| 271 | - echo wp_kses_post( $waist . ' cm' ); |
|
| 272 | - } else { |
|
| 273 | - echo '/'; |
|
| 274 | - } |
|
| 275 | - ?> |
|
| 270 | + if ( '' !== $waist ) { |
|
| 271 | + echo wp_kses_post( $waist . ' cm' ); |
|
| 272 | + } else { |
|
| 273 | + echo '/'; |
|
| 274 | + } |
|
| 275 | + ?> |
|
| 276 | 276 | </span> |
| 277 | 277 | <?php } |
| 278 | - if ( 'on' !== $is_bmi_disabled ) { |
|
| 279 | - ?> |
|
| 278 | + if ( 'on' !== $is_bmi_disabled ) { |
|
| 279 | + ?> |
|
| 280 | 280 | <span><strong><?php esc_html_e( 'BMI:', 'lsx-health-plan' ); ?></strong> |
| 281 | 281 | <?php |
| 282 | - if ( '' !== $bmi ) { |
|
| 283 | - echo wp_kses_post( $bmi ); |
|
| 284 | - } else { |
|
| 285 | - echo '/'; |
|
| 286 | - } |
|
| 287 | - ?> |
|
| 282 | + if ( '' !== $bmi ) { |
|
| 283 | + echo wp_kses_post( $bmi ); |
|
| 284 | + } else { |
|
| 285 | + echo '/'; |
|
| 286 | + } |
|
| 287 | + ?> |
|
| 288 | 288 | </span> |
| 289 | 289 | <?php } ?> |
| 290 | 290 | </div> |
| 291 | 291 | <?php |
| 292 | - } |
|
| 292 | + } |
|
| 293 | 293 | |
| 294 | - // Only display the edit account link if woocommerce is active. |
|
| 295 | - if ( function_exists( 'WC' ) ) { |
|
| 296 | - ?> |
|
| 294 | + // Only display the edit account link if woocommerce is active. |
|
| 295 | + if ( function_exists( 'WC' ) ) { |
|
| 296 | + ?> |
|
| 297 | 297 | <div class="edit-profile"> |
| 298 | 298 | <?php |
| 299 | - if ( function_exists( 'wc_get_page_id' ) ) { |
|
| 300 | - $url_id = wc_get_page_id( 'myaccount' ); |
|
| 301 | - } else { |
|
| 302 | - $url_id = ''; |
|
| 303 | - } |
|
| 304 | - ?> |
|
| 299 | + if ( function_exists( 'wc_get_page_id' ) ) { |
|
| 300 | + $url_id = wc_get_page_id( 'myaccount' ); |
|
| 301 | + } else { |
|
| 302 | + $url_id = ''; |
|
| 303 | + } |
|
| 304 | + ?> |
|
| 305 | 305 | <a href="<?php echo esc_url( get_permalink( $url_id ) ); ?>edit-account/"><?php esc_html_e( 'Edit', 'lsx-health-plan' ); ?></a> |
| 306 | 306 | </div> |
| 307 | 307 | <?php |
| 308 | - } |
|
| 309 | - ?> |
|
| 308 | + } |
|
| 309 | + ?> |
|
| 310 | 310 | </div> |
| 311 | 311 | <?php } ?> |
| 312 | 312 | </section> |
@@ -322,65 +322,65 @@ discard block |
||
| 322 | 322 | * @return void |
| 323 | 323 | */ |
| 324 | 324 | function lsx_health_plan_all_plans_block() { |
| 325 | - global $post, $product; |
|
| 326 | - |
|
| 327 | - $args = array( |
|
| 328 | - 'orderby' => 'menu_order', |
|
| 329 | - 'order' => 'ASC', |
|
| 330 | - 'post_type' => 'plan', |
|
| 331 | - 'nopagin' => true, |
|
| 332 | - 'post_parent' => 0, |
|
| 333 | - ); |
|
| 334 | - |
|
| 335 | - if ( function_exists( '\lsx_health_plan\functions\woocommerce\get_membership_products' ) ) { |
|
| 336 | - $product_ids = \lsx_health_plan\functions\woocommerce\get_membership_products(); |
|
| 337 | - if ( ! empty( $product_ids ) ) { |
|
| 338 | - $args['meta_query'] = array( |
|
| 339 | - 'relation' => 'OR', |
|
| 340 | - array( |
|
| 341 | - 'key' => '_plan_product_id', |
|
| 342 | - 'value' => $product_ids, |
|
| 343 | - 'compare' => 'IN', |
|
| 344 | - ), |
|
| 345 | - array( |
|
| 346 | - 'key' => '_plan_product_id', |
|
| 347 | - 'compare' => 'NOT EXISTS', |
|
| 348 | - ), |
|
| 349 | - ); |
|
| 350 | - } |
|
| 351 | - } |
|
| 352 | - |
|
| 353 | - $the_query = new WP_Query( $args ); |
|
| 354 | - ?> |
|
| 325 | + global $post, $product; |
|
| 326 | + |
|
| 327 | + $args = array( |
|
| 328 | + 'orderby' => 'menu_order', |
|
| 329 | + 'order' => 'ASC', |
|
| 330 | + 'post_type' => 'plan', |
|
| 331 | + 'nopagin' => true, |
|
| 332 | + 'post_parent' => 0, |
|
| 333 | + ); |
|
| 334 | + |
|
| 335 | + if ( function_exists( '\lsx_health_plan\functions\woocommerce\get_membership_products' ) ) { |
|
| 336 | + $product_ids = \lsx_health_plan\functions\woocommerce\get_membership_products(); |
|
| 337 | + if ( ! empty( $product_ids ) ) { |
|
| 338 | + $args['meta_query'] = array( |
|
| 339 | + 'relation' => 'OR', |
|
| 340 | + array( |
|
| 341 | + 'key' => '_plan_product_id', |
|
| 342 | + 'value' => $product_ids, |
|
| 343 | + 'compare' => 'IN', |
|
| 344 | + ), |
|
| 345 | + array( |
|
| 346 | + 'key' => '_plan_product_id', |
|
| 347 | + 'compare' => 'NOT EXISTS', |
|
| 348 | + ), |
|
| 349 | + ); |
|
| 350 | + } |
|
| 351 | + } |
|
| 352 | + |
|
| 353 | + $the_query = new WP_Query( $args ); |
|
| 354 | + ?> |
|
| 355 | 355 | <div class="all-plans-block plan-grid block-all-plans-block"> |
| 356 | 356 | <div class="row"> |
| 357 | 357 | <?php |
| 358 | - if ( $the_query->have_posts() ) : |
|
| 359 | - while ( $the_query->have_posts() ) : |
|
| 360 | - $the_query->the_post(); |
|
| 361 | - lsx_entry_before(); |
|
| 362 | - $completed_class = ''; |
|
| 363 | - $linked_product = false; |
|
| 364 | - $restricted = false; |
|
| 365 | - $product = null; |
|
| 366 | - if ( function_exists( 'lsx_health_plan\functions\woocommerce\plan_has_products' ) && \lsx_health_plan\functions\woocommerce\plan_has_products() ) { |
|
| 367 | - $products = \lsx_health_plan\functions\woocommerce\get_plan_products(); |
|
| 368 | - $linked_product = wc_get_product( $products[0] ); |
|
| 369 | - $product = $linked_product; |
|
| 370 | - } |
|
| 371 | - if ( function_exists( 'wc_memberships_is_post_content_restricted' ) ) { |
|
| 372 | - $restricted = wc_memberships_is_post_content_restricted( get_the_ID() ) && ! current_user_can( 'wc_memberships_view_restricted_post_content', get_the_ID() ); |
|
| 373 | - } |
|
| 374 | - |
|
| 375 | - if ( lsx_health_plan_is_plan_complete() ) { |
|
| 376 | - $completed_class = 'completed'; |
|
| 377 | - } |
|
| 378 | - $round_progress = ''; |
|
| 379 | - $completed_progress = '100'; |
|
| 380 | - if ( false === $restricted ) { |
|
| 381 | - $round_progress = round( \lsx_health_plan\functions\get_progress( get_the_ID() ), 0 ); |
|
| 382 | - } |
|
| 383 | - ?> |
|
| 358 | + if ( $the_query->have_posts() ) : |
|
| 359 | + while ( $the_query->have_posts() ) : |
|
| 360 | + $the_query->the_post(); |
|
| 361 | + lsx_entry_before(); |
|
| 362 | + $completed_class = ''; |
|
| 363 | + $linked_product = false; |
|
| 364 | + $restricted = false; |
|
| 365 | + $product = null; |
|
| 366 | + if ( function_exists( 'lsx_health_plan\functions\woocommerce\plan_has_products' ) && \lsx_health_plan\functions\woocommerce\plan_has_products() ) { |
|
| 367 | + $products = \lsx_health_plan\functions\woocommerce\get_plan_products(); |
|
| 368 | + $linked_product = wc_get_product( $products[0] ); |
|
| 369 | + $product = $linked_product; |
|
| 370 | + } |
|
| 371 | + if ( function_exists( 'wc_memberships_is_post_content_restricted' ) ) { |
|
| 372 | + $restricted = wc_memberships_is_post_content_restricted( get_the_ID() ) && ! current_user_can( 'wc_memberships_view_restricted_post_content', get_the_ID() ); |
|
| 373 | + } |
|
| 374 | + |
|
| 375 | + if ( lsx_health_plan_is_plan_complete() ) { |
|
| 376 | + $completed_class = 'completed'; |
|
| 377 | + } |
|
| 378 | + $round_progress = ''; |
|
| 379 | + $completed_progress = '100'; |
|
| 380 | + if ( false === $restricted ) { |
|
| 381 | + $round_progress = round( \lsx_health_plan\functions\get_progress( get_the_ID() ), 0 ); |
|
| 382 | + } |
|
| 383 | + ?> |
|
| 384 | 384 | <div class="col-xs-12 col-sm-6 col-md-4"> |
| 385 | 385 | <article class="lsx-slot lsx-hp-shadow <?php echo esc_html( 'progress-') . $round_progress; ?>"> |
| 386 | 386 | <div class="plan-feature-img"> |
@@ -389,45 +389,45 @@ discard block |
||
| 389 | 389 | <?php } ?> |
| 390 | 390 | <a href="<?php echo esc_url( get_permalink() ); ?>"> |
| 391 | 391 | <?php |
| 392 | - $featured_image = get_the_post_thumbnail(); |
|
| 393 | - if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
| 394 | - the_post_thumbnail( 'lsx-thumbnail', array( |
|
| 395 | - 'class' => 'aligncenter', |
|
| 396 | - ) ); |
|
| 397 | - } else { |
|
| 398 | - ?> |
|
| 392 | + $featured_image = get_the_post_thumbnail(); |
|
| 393 | + if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
| 394 | + the_post_thumbnail( 'lsx-thumbnail', array( |
|
| 395 | + 'class' => 'aligncenter', |
|
| 396 | + ) ); |
|
| 397 | + } else { |
|
| 398 | + ?> |
|
| 399 | 399 | <img loading="lazy" class="placeholder" src="<?php echo esc_attr( plugin_dir_url( __FILE__ ) . '../assets/images/placeholder.jpg' ); ?>"> |
| 400 | 400 | <?php |
| 401 | - } |
|
| 402 | - ?> |
|
| 401 | + } |
|
| 402 | + ?> |
|
| 403 | 403 | </a> |
| 404 | 404 | </div> |
| 405 | 405 | <div class="content-box plan-content-box"> |
| 406 | 406 | <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> |
| 407 | 407 | <?php |
| 408 | - echo wp_kses_post( \lsx_health_plan\functions\hp_get_plan_type_meta( $post ) ); |
|
| 409 | - ?> |
|
| 408 | + echo wp_kses_post( \lsx_health_plan\functions\hp_get_plan_type_meta( $post ) ); |
|
| 409 | + ?> |
|
| 410 | 410 | <?php |
| 411 | - if ( false !== $linked_product && false !== $restricted ) { |
|
| 412 | - echo wp_kses_post( $linked_product->get_price_html() ); |
|
| 413 | - } |
|
| 414 | - ?> |
|
| 411 | + if ( false !== $linked_product && false !== $restricted ) { |
|
| 412 | + echo wp_kses_post( $linked_product->get_price_html() ); |
|
| 413 | + } |
|
| 414 | + ?> |
|
| 415 | 415 | <div class="excerpt"> |
| 416 | 416 | <?php |
| 417 | - if ( ! has_excerpt() ) { |
|
| 418 | - $content = wp_trim_words( get_the_content(), 20 ); |
|
| 419 | - $content = '<p>' . $content . '</pre>'; |
|
| 420 | - } else { |
|
| 421 | - $content = apply_filters( 'the_excerpt', get_the_excerpt() ); |
|
| 422 | - } |
|
| 423 | - echo wp_kses_post( $content ); |
|
| 424 | - ?> |
|
| 417 | + if ( ! has_excerpt() ) { |
|
| 418 | + $content = wp_trim_words( get_the_content(), 20 ); |
|
| 419 | + $content = '<p>' . $content . '</pre>'; |
|
| 420 | + } else { |
|
| 421 | + $content = apply_filters( 'the_excerpt', get_the_excerpt() ); |
|
| 422 | + } |
|
| 423 | + echo wp_kses_post( $content ); |
|
| 424 | + ?> |
|
| 425 | 425 | </div> |
| 426 | 426 | <?php |
| 427 | - if ( false === $restricted ) { |
|
| 428 | - 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 | - } |
|
| 430 | - ?> |
|
| 427 | + if ( false === $restricted ) { |
|
| 428 | + 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 | + } |
|
| 430 | + ?> |
|
| 431 | 431 | </div> |
| 432 | 432 | </article> |
| 433 | 433 | </div> |
@@ -446,36 +446,36 @@ discard block |
||
| 446 | 446 | * @return void |
| 447 | 447 | */ |
| 448 | 448 | function lsx_health_plan_day_plan_block( $args = array() ) { |
| 449 | - $defaults = array( |
|
| 450 | - 'plan' => '', |
|
| 451 | - ); |
|
| 452 | - $args = wp_parse_args( $args, $defaults ); |
|
| 453 | - |
|
| 454 | - if ( isset( $args['plan'] ) && '' !== $args['plan'] && \lsx_health_plan\functions\plan\has_sections( $args['plan'] ) ) { |
|
| 455 | - $sections = \lsx_health_plan\functions\plan\get_sections(); |
|
| 456 | - ?> |
|
| 449 | + $defaults = array( |
|
| 450 | + 'plan' => '', |
|
| 451 | + ); |
|
| 452 | + $args = wp_parse_args( $args, $defaults ); |
|
| 453 | + |
|
| 454 | + if ( isset( $args['plan'] ) && '' !== $args['plan'] && \lsx_health_plan\functions\plan\has_sections( $args['plan'] ) ) { |
|
| 455 | + $sections = \lsx_health_plan\functions\plan\get_sections(); |
|
| 456 | + ?> |
|
| 457 | 457 | <div class="daily-plan-block day-grid"> |
| 458 | 458 | <?php |
| 459 | - foreach ( $sections as $section_key => $section_values ) { |
|
| 460 | - $defaults = array( |
|
| 461 | - 'title' => __( 'Day', 'lsx-health-plan' ) . ' ' . ( $section_key + 1 ), |
|
| 462 | - ); |
|
| 463 | - $section_args = wp_parse_args( $section_values, $defaults ); |
|
| 464 | - |
|
| 465 | - $completed_class = ''; |
|
| 466 | - if ( lsx_health_plan_is_day_complete() ) { |
|
| 467 | - $completed_class = 'completed'; |
|
| 468 | - } |
|
| 469 | - ?> |
|
| 459 | + foreach ( $sections as $section_key => $section_values ) { |
|
| 460 | + $defaults = array( |
|
| 461 | + 'title' => __( 'Day', 'lsx-health-plan' ) . ' ' . ( $section_key + 1 ), |
|
| 462 | + ); |
|
| 463 | + $section_args = wp_parse_args( $section_values, $defaults ); |
|
| 464 | + |
|
| 465 | + $completed_class = ''; |
|
| 466 | + if ( lsx_health_plan_is_day_complete() ) { |
|
| 467 | + $completed_class = 'completed'; |
|
| 468 | + } |
|
| 469 | + ?> |
|
| 470 | 470 | <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 ); ?>"> |
| 471 | 471 | <div class="plan-content"><?php echo esc_attr( $section_args['title'] ); ?></div> |
| 472 | 472 | </a> |
| 473 | 473 | <?php |
| 474 | - } |
|
| 475 | - ?> |
|
| 474 | + } |
|
| 475 | + ?> |
|
| 476 | 476 | </div> |
| 477 | 477 | <?php |
| 478 | - } |
|
| 478 | + } |
|
| 479 | 479 | } |
| 480 | 480 | |
| 481 | 481 | /** |
@@ -485,44 +485,44 @@ discard block |
||
| 485 | 485 | * @return void |
| 486 | 486 | */ |
| 487 | 487 | function lsx_health_plan_week_plan_block( $args = array() ) { |
| 488 | - $defaults = array( |
|
| 489 | - 'show_downloads' => false, |
|
| 490 | - 'plan' => '', |
|
| 491 | - ); |
|
| 492 | - $args = wp_parse_args( $args, $defaults ); |
|
| 493 | - |
|
| 494 | - if ( isset( $args['plan'] ) && '' !== $args['plan'] && \lsx_health_plan\functions\plan\has_sections( $args['plan'] ) ) { |
|
| 495 | - $groups = \lsx_health_plan\functions\plan\get_sections( true ); |
|
| 496 | - |
|
| 497 | - if ( ! empty( $groups ) ) { |
|
| 498 | - $counter = 1; |
|
| 499 | - $group_open = false; |
|
| 500 | - |
|
| 501 | - foreach ( $groups as $group_key => $sections ) { |
|
| 502 | - $collapse_class = ''; |
|
| 503 | - $group_title = \lsx_health_plan\functions\plan\get_group_title( $sections ); |
|
| 504 | - |
|
| 505 | - // Determine if the current week is complete. |
|
| 506 | - $day_ids = wp_list_pluck( $sections, 'title' ); |
|
| 507 | - if ( false === $group_open ) { |
|
| 508 | - if ( 1 === $counter && ! \lsx_health_plan\functions\is_week_complete( false, $day_ids, $group_title ) ) { |
|
| 509 | - $collapse_class = 'in'; |
|
| 510 | - $group_open = true; |
|
| 511 | - } elseif ( ! \lsx_health_plan\functions\is_week_complete( false, $day_ids, $group_title ) ) { |
|
| 512 | - $collapse_class = 'in'; |
|
| 513 | - $group_open = true; |
|
| 514 | - } |
|
| 515 | - } |
|
| 516 | - |
|
| 517 | - // Determine if there are any weekly downloads. |
|
| 518 | - $week_downloads_view = ''; |
|
| 519 | - if ( isset( $args['show_downloads'] ) && false !== $args['show_downloads'] ) { |
|
| 520 | - $weekly_downloads = \lsx_health_plan\functions\get_weekly_downloads( $group_key ); |
|
| 521 | - if ( ! empty( $weekly_downloads ) ) { |
|
| 522 | - $week_downloads_view = 'week-downloads-view-on'; |
|
| 523 | - } |
|
| 524 | - } |
|
| 525 | - ?> |
|
| 488 | + $defaults = array( |
|
| 489 | + 'show_downloads' => false, |
|
| 490 | + 'plan' => '', |
|
| 491 | + ); |
|
| 492 | + $args = wp_parse_args( $args, $defaults ); |
|
| 493 | + |
|
| 494 | + if ( isset( $args['plan'] ) && '' !== $args['plan'] && \lsx_health_plan\functions\plan\has_sections( $args['plan'] ) ) { |
|
| 495 | + $groups = \lsx_health_plan\functions\plan\get_sections( true ); |
|
| 496 | + |
|
| 497 | + if ( ! empty( $groups ) ) { |
|
| 498 | + $counter = 1; |
|
| 499 | + $group_open = false; |
|
| 500 | + |
|
| 501 | + foreach ( $groups as $group_key => $sections ) { |
|
| 502 | + $collapse_class = ''; |
|
| 503 | + $group_title = \lsx_health_plan\functions\plan\get_group_title( $sections ); |
|
| 504 | + |
|
| 505 | + // Determine if the current week is complete. |
|
| 506 | + $day_ids = wp_list_pluck( $sections, 'title' ); |
|
| 507 | + if ( false === $group_open ) { |
|
| 508 | + if ( 1 === $counter && ! \lsx_health_plan\functions\is_week_complete( false, $day_ids, $group_title ) ) { |
|
| 509 | + $collapse_class = 'in'; |
|
| 510 | + $group_open = true; |
|
| 511 | + } elseif ( ! \lsx_health_plan\functions\is_week_complete( false, $day_ids, $group_title ) ) { |
|
| 512 | + $collapse_class = 'in'; |
|
| 513 | + $group_open = true; |
|
| 514 | + } |
|
| 515 | + } |
|
| 516 | + |
|
| 517 | + // Determine if there are any weekly downloads. |
|
| 518 | + $week_downloads_view = ''; |
|
| 519 | + if ( isset( $args['show_downloads'] ) && false !== $args['show_downloads'] ) { |
|
| 520 | + $weekly_downloads = \lsx_health_plan\functions\get_weekly_downloads( $group_key ); |
|
| 521 | + if ( ! empty( $weekly_downloads ) ) { |
|
| 522 | + $week_downloads_view = 'week-downloads-view-on'; |
|
| 523 | + } |
|
| 524 | + } |
|
| 525 | + ?> |
|
| 526 | 526 | <div class="daily-plan-block week-grid"> |
| 527 | 527 | <a href="#group-<?php echo esc_attr( $group_key ); ?>" data-toggle="collapse" class="week-title"><?php echo esc_attr( $group_title ); ?></a> |
| 528 | 528 | <div id="group-<?php echo esc_attr( $group_key ); ?>" class="week-row collapse <?php echo esc_attr( $collapse_class ); ?>"> |
@@ -536,46 +536,46 @@ discard block |
||
| 536 | 536 | <div class="week-meals-recipes-box-inner"> |
| 537 | 537 | <?php |
| 538 | 538 | |
| 539 | - foreach ( $sections as $section_key => $section_values ) { |
|
| 539 | + foreach ( $sections as $section_key => $section_values ) { |
|
| 540 | 540 | |
| 541 | - $defaults = array( |
|
| 542 | - 'title' => __( 'Day', 'lsx-health-plan' ) . ' ' . ( $section_key + 1 ), |
|
| 543 | - ); |
|
| 544 | - $section_args = wp_parse_args( $section_values, $defaults ); |
|
| 541 | + $defaults = array( |
|
| 542 | + 'title' => __( 'Day', 'lsx-health-plan' ) . ' ' . ( $section_key + 1 ), |
|
| 543 | + ); |
|
| 544 | + $section_args = wp_parse_args( $section_values, $defaults ); |
|
| 545 | 545 | |
| 546 | - $completed_class = ''; |
|
| 547 | - if ( lsx_health_plan_is_day_complete( $args['plan'], $section_args['title'] ) ) { |
|
| 548 | - $completed_class = 'completed'; |
|
| 549 | - } |
|
| 550 | - if ( $section_args['rest_day_enabled'] && ! $section_args['connected_meals'] ) { |
|
| 551 | - ?> |
|
| 546 | + $completed_class = ''; |
|
| 547 | + if ( lsx_health_plan_is_day_complete( $args['plan'], $section_args['title'] ) ) { |
|
| 548 | + $completed_class = 'completed'; |
|
| 549 | + } |
|
| 550 | + if ( $section_args['rest_day_enabled'] && ! $section_args['connected_meals'] ) { |
|
| 551 | + ?> |
|
| 552 | 552 | <span class="day id-<?php echo esc_attr( $section_key + 1 ); ?> <?php echo esc_attr( $completed_class ); ?>"> |
| 553 | 553 | <div class="plan-content"><?php echo esc_attr( $section_args['title'] ); ?></div> |
| 554 | 554 | </span> |
| 555 | 555 | <?php |
| 556 | - } else { |
|
| 557 | - ?> |
|
| 556 | + } else { |
|
| 557 | + ?> |
|
| 558 | 558 | <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 ); ?>"> |
| 559 | 559 | <div class="plan-content"><?php echo esc_attr( $section_args['title'] ); ?></div> |
| 560 | 560 | </a> |
| 561 | 561 | <?php |
| 562 | - } |
|
| 563 | - } |
|
| 564 | - ?> |
|
| 562 | + } |
|
| 563 | + } |
|
| 564 | + ?> |
|
| 565 | 565 | </div> |
| 566 | 566 | </div> |
| 567 | 567 | <?php |
| 568 | - if ( ! empty( $week_downloads_view ) ) { |
|
| 569 | - lsx_health_plan_weekly_downloads( $weekly_downloads ); |
|
| 570 | - } |
|
| 571 | - ?> |
|
| 568 | + if ( ! empty( $week_downloads_view ) ) { |
|
| 569 | + lsx_health_plan_weekly_downloads( $weekly_downloads ); |
|
| 570 | + } |
|
| 571 | + ?> |
|
| 572 | 572 | </div> |
| 573 | 573 | </div> |
| 574 | 574 | </div> |
| 575 | 575 | <?php |
| 576 | - } |
|
| 577 | - } |
|
| 578 | - } |
|
| 576 | + } |
|
| 577 | + } |
|
| 578 | + } |
|
| 579 | 579 | } |
| 580 | 580 | |
| 581 | 581 | /** |
@@ -585,22 +585,22 @@ discard block |
||
| 585 | 585 | * @return void |
| 586 | 586 | */ |
| 587 | 587 | function lsx_health_plan_weekly_downloads( $weekly_downloads = array() ) { |
| 588 | - if ( ! empty( $weekly_downloads ) ) { |
|
| 589 | - ?> |
|
| 588 | + if ( ! empty( $weekly_downloads ) ) { |
|
| 589 | + ?> |
|
| 590 | 590 | <div class="week-download-box"> |
| 591 | 591 | <h3 class="title"><?php lsx_get_svg_icon( 'download.svg' ); ?><?php echo esc_html_e( 'Downloads', 'lsx-health-plan' ); ?></h3> |
| 592 | 592 | <ul class="week-download-box-list"> |
| 593 | 593 | <?php |
| 594 | - foreach ( $weekly_downloads as $weekly_download ) { |
|
| 595 | - ?> |
|
| 594 | + foreach ( $weekly_downloads as $weekly_download ) { |
|
| 595 | + ?> |
|
| 596 | 596 | <li><?php echo wp_kses_post( do_shortcode( '[download id="' . $weekly_download . '"]' ) ); ?></li> |
| 597 | 597 | <?php |
| 598 | - } |
|
| 599 | - ?> |
|
| 598 | + } |
|
| 599 | + ?> |
|
| 600 | 600 | </ul> |
| 601 | 601 | </div> |
| 602 | 602 | <?php |
| 603 | - } |
|
| 603 | + } |
|
| 604 | 604 | } |
| 605 | 605 | |
| 606 | 606 | /** |
@@ -609,9 +609,9 @@ discard block |
||
| 609 | 609 | * @return void |
| 610 | 610 | */ |
| 611 | 611 | function lsx_health_plan_items( $args = array() ) { |
| 612 | - global $shortcode_args; |
|
| 613 | - $shortcode_args = $args; |
|
| 614 | - include LSX_HEALTH_PLAN_PATH . '/templates/partials/shortcode-loop.php'; |
|
| 612 | + global $shortcode_args; |
|
| 613 | + $shortcode_args = $args; |
|
| 614 | + include LSX_HEALTH_PLAN_PATH . '/templates/partials/shortcode-loop.php'; |
|
| 615 | 615 | } |
| 616 | 616 | |
| 617 | 617 | /** |
@@ -620,10 +620,10 @@ discard block |
||
| 620 | 620 | * @return void |
| 621 | 621 | */ |
| 622 | 622 | function lsx_health_plan_featured_video_block() { |
| 623 | - if ( ! post_type_exists( 'video' ) ) { |
|
| 624 | - return; |
|
| 625 | - } |
|
| 626 | - include LSX_HEALTH_PLAN_PATH . '/templates/featured-videos.php'; |
|
| 623 | + if ( ! post_type_exists( 'video' ) ) { |
|
| 624 | + return; |
|
| 625 | + } |
|
| 626 | + include LSX_HEALTH_PLAN_PATH . '/templates/featured-videos.php'; |
|
| 627 | 627 | } |
| 628 | 628 | |
| 629 | 629 | /** |
@@ -632,10 +632,10 @@ discard block |
||
| 632 | 632 | * @return void |
| 633 | 633 | */ |
| 634 | 634 | function lsx_health_plan_featured_recipes_block() { |
| 635 | - if ( ! post_type_exists( 'recipe' ) ) { |
|
| 636 | - return; |
|
| 637 | - } |
|
| 638 | - include LSX_HEALTH_PLAN_PATH . '/templates/featured-recipes.php'; |
|
| 635 | + if ( ! post_type_exists( 'recipe' ) ) { |
|
| 636 | + return; |
|
| 637 | + } |
|
| 638 | + include LSX_HEALTH_PLAN_PATH . '/templates/featured-recipes.php'; |
|
| 639 | 639 | } |
| 640 | 640 | |
| 641 | 641 | /** |
@@ -644,7 +644,7 @@ discard block |
||
| 644 | 644 | * @return void |
| 645 | 645 | */ |
| 646 | 646 | function lsx_health_plan_featured_tips_block() { |
| 647 | - include LSX_HEALTH_PLAN_PATH . '/templates/featured-tips.php'; |
|
| 647 | + include LSX_HEALTH_PLAN_PATH . '/templates/featured-tips.php'; |
|
| 648 | 648 | } |
| 649 | 649 | |
| 650 | 650 | /** |
@@ -654,11 +654,11 @@ discard block |
||
| 654 | 654 | * @return void |
| 655 | 655 | */ |
| 656 | 656 | function lsx_health_plan_day_button() { |
| 657 | - if ( lsx_health_plan_is_day_complete() ) { |
|
| 658 | - lsx_health_plan_unlock_button(); |
|
| 659 | - } else { |
|
| 660 | - lsx_health_plan_complete_button(); |
|
| 661 | - } |
|
| 657 | + if ( lsx_health_plan_is_day_complete() ) { |
|
| 658 | + lsx_health_plan_unlock_button(); |
|
| 659 | + } else { |
|
| 660 | + lsx_health_plan_complete_button(); |
|
| 661 | + } |
|
| 662 | 662 | } |
| 663 | 663 | |
| 664 | 664 | /** |
@@ -667,7 +667,7 @@ discard block |
||
| 667 | 667 | * @return void |
| 668 | 668 | */ |
| 669 | 669 | function lsx_health_plan_complete_button() { |
| 670 | - ?> |
|
| 670 | + ?> |
|
| 671 | 671 | <div class="single-plan-inner-buttons"> |
| 672 | 672 | <form action="<?php the_permalink(); ?>" method="post" class="form-complete-day complete-plan-btn"> |
| 673 | 673 | <?php wp_nonce_field( 'complete', 'lsx-health-plan-actions' ); ?> |
@@ -685,7 +685,7 @@ discard block |
||
| 685 | 685 | * @return void |
| 686 | 686 | */ |
| 687 | 687 | function lsx_health_plan_unlock_button() { |
| 688 | - ?> |
|
| 688 | + ?> |
|
| 689 | 689 | <div class="single-plan-inner-buttons"> |
| 690 | 690 | <form action="<?php the_permalink(); ?>" method="post" class="form-complete-day complete-plan-btn"> |
| 691 | 691 | <?php wp_nonce_field( 'unlock', 'lsx-health-plan-actions' ); ?> |
@@ -704,10 +704,10 @@ discard block |
||
| 704 | 704 | * @return void |
| 705 | 705 | */ |
| 706 | 706 | function lsx_health_plan_single_nav() { |
| 707 | - $tab_template_path = apply_filters( 'lsx_health_plan_single_nav_path', LSX_HEALTH_PLAN_PATH . '/templates/single-plan-tabs.php' ); |
|
| 708 | - if ( '' !== $tab_template_path ) { |
|
| 709 | - require $tab_template_path; |
|
| 710 | - } |
|
| 707 | + $tab_template_path = apply_filters( 'lsx_health_plan_single_nav_path', LSX_HEALTH_PLAN_PATH . '/templates/single-plan-tabs.php' ); |
|
| 708 | + if ( '' !== $tab_template_path ) { |
|
| 709 | + require $tab_template_path; |
|
| 710 | + } |
|
| 711 | 711 | } |
| 712 | 712 | |
| 713 | 713 | /** |
@@ -717,32 +717,32 @@ discard block |
||
| 717 | 717 | * @return void |
| 718 | 718 | */ |
| 719 | 719 | function lsx_health_plan_single_tabs() { |
| 720 | - $endpoint = get_query_var( 'endpoint' ); |
|
| 721 | - switch ( $endpoint ) { |
|
| 722 | - case 'meal': |
|
| 723 | - $tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-meal.php'; |
|
| 724 | - break; |
|
| 725 | - |
|
| 726 | - case 'recipes': |
|
| 727 | - $tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-recipes.php'; |
|
| 728 | - break; |
|
| 729 | - |
|
| 730 | - case 'workout': |
|
| 731 | - $tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-workout.php'; |
|
| 732 | - break; |
|
| 733 | - |
|
| 734 | - case 'warm-up': |
|
| 735 | - $tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-warm-up.php'; |
|
| 736 | - break; |
|
| 737 | - |
|
| 738 | - default: |
|
| 739 | - $tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-plan.php'; |
|
| 740 | - break; |
|
| 741 | - } |
|
| 742 | - $tab_template_path = apply_filters( 'lsx_health_plan_single_tab_path', $tab_template_path ); |
|
| 743 | - if ( '' !== $tab_template_path ) { |
|
| 744 | - include $tab_template_path; |
|
| 745 | - } |
|
| 720 | + $endpoint = get_query_var( 'endpoint' ); |
|
| 721 | + switch ( $endpoint ) { |
|
| 722 | + case 'meal': |
|
| 723 | + $tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-meal.php'; |
|
| 724 | + break; |
|
| 725 | + |
|
| 726 | + case 'recipes': |
|
| 727 | + $tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-recipes.php'; |
|
| 728 | + break; |
|
| 729 | + |
|
| 730 | + case 'workout': |
|
| 731 | + $tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-workout.php'; |
|
| 732 | + break; |
|
| 733 | + |
|
| 734 | + case 'warm-up': |
|
| 735 | + $tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-warm-up.php'; |
|
| 736 | + break; |
|
| 737 | + |
|
| 738 | + default: |
|
| 739 | + $tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-plan.php'; |
|
| 740 | + break; |
|
| 741 | + } |
|
| 742 | + $tab_template_path = apply_filters( 'lsx_health_plan_single_tab_path', $tab_template_path ); |
|
| 743 | + if ( '' !== $tab_template_path ) { |
|
| 744 | + include $tab_template_path; |
|
| 745 | + } |
|
| 746 | 746 | } |
| 747 | 747 | |
| 748 | 748 | /** |
@@ -751,7 +751,7 @@ discard block |
||
| 751 | 751 | * @return void |
| 752 | 752 | */ |
| 753 | 753 | function lsx_health_plan_recipe_data() { |
| 754 | - include LSX_HEALTH_PLAN_PATH . '/templates/table-recipe-data.php'; |
|
| 754 | + include LSX_HEALTH_PLAN_PATH . '/templates/table-recipe-data.php'; |
|
| 755 | 755 | } |
| 756 | 756 | |
| 757 | 757 | /** |
@@ -760,11 +760,11 @@ discard block |
||
| 760 | 760 | * @return recipe_type |
| 761 | 761 | */ |
| 762 | 762 | function lsx_health_plan_recipe_type() { |
| 763 | - $term_obj_list = get_the_terms( get_the_ID(), 'recipe-type' ); |
|
| 764 | - $recipe_type = $term_obj_list[0]->name; |
|
| 765 | - if ( ! empty( $recipe_type ) ) { |
|
| 766 | - return $recipe_type; |
|
| 767 | - } |
|
| 763 | + $term_obj_list = get_the_terms( get_the_ID(), 'recipe-type' ); |
|
| 764 | + $recipe_type = $term_obj_list[0]->name; |
|
| 765 | + if ( ! empty( $recipe_type ) ) { |
|
| 766 | + return $recipe_type; |
|
| 767 | + } |
|
| 768 | 768 | } |
| 769 | 769 | |
| 770 | 770 | /** |
@@ -775,35 +775,35 @@ discard block |
||
| 775 | 775 | * @return void |
| 776 | 776 | */ |
| 777 | 777 | function lsx_health_plan_workout_video_play_button( $m, $group, $echo = true ) { |
| 778 | - $workout_video = ''; |
|
| 779 | - $giphy = ''; |
|
| 780 | - $youtube = ''; |
|
| 781 | - if ( isset( $group['connected_videos'] ) && '' !== $group['connected_videos'] ) { |
|
| 782 | - $workout_video = esc_html( $group['connected_videos'] ); |
|
| 783 | - $giphy = get_post_meta( $workout_video, 'video_giphy_source', true ); |
|
| 784 | - $youtube = esc_url( get_post_meta( $workout_video, 'video_youtube_source', 1 ) ); |
|
| 785 | - $content = get_post_field( 'post_content', $workout_video ); |
|
| 786 | - $play_button = '<button data-toggle="modal" data-target="#workout-video-modal-' . $m . '"><span class="fa fa-play-circle"></span></button>'; |
|
| 787 | - |
|
| 788 | - $modal_body = ''; |
|
| 789 | - if ( ! empty( $giphy ) ) { |
|
| 790 | - $giphy = \lsx_health_plan\functions\get_video_url( $giphy ); |
|
| 791 | - $modal_body = $giphy; // WPCS: XSS OK. |
|
| 792 | - } elseif ( ! empty( $youtube ) ) { |
|
| 793 | - $modal_body = wp_oembed_get( $youtube, array( // WPCS: XSS OK. |
|
| 794 | - 'width' => 480, |
|
| 795 | - ) ); |
|
| 796 | - } |
|
| 797 | - $modal_body .= '<h5 class="modal-title title-lined">' . $group['name'] . '</h5>'; |
|
| 798 | - $modal_body .= $content; |
|
| 799 | - \lsx_health_plan\functions\register_modal( 'workout-video-modal-' . $m, '', $modal_body ); |
|
| 800 | - |
|
| 801 | - if ( true === $echo ) { |
|
| 802 | - echo wp_kses_post( $play_button ); |
|
| 803 | - } else { |
|
| 804 | - return $play_button; |
|
| 805 | - } |
|
| 806 | - } |
|
| 778 | + $workout_video = ''; |
|
| 779 | + $giphy = ''; |
|
| 780 | + $youtube = ''; |
|
| 781 | + if ( isset( $group['connected_videos'] ) && '' !== $group['connected_videos'] ) { |
|
| 782 | + $workout_video = esc_html( $group['connected_videos'] ); |
|
| 783 | + $giphy = get_post_meta( $workout_video, 'video_giphy_source', true ); |
|
| 784 | + $youtube = esc_url( get_post_meta( $workout_video, 'video_youtube_source', 1 ) ); |
|
| 785 | + $content = get_post_field( 'post_content', $workout_video ); |
|
| 786 | + $play_button = '<button data-toggle="modal" data-target="#workout-video-modal-' . $m . '"><span class="fa fa-play-circle"></span></button>'; |
|
| 787 | + |
|
| 788 | + $modal_body = ''; |
|
| 789 | + if ( ! empty( $giphy ) ) { |
|
| 790 | + $giphy = \lsx_health_plan\functions\get_video_url( $giphy ); |
|
| 791 | + $modal_body = $giphy; // WPCS: XSS OK. |
|
| 792 | + } elseif ( ! empty( $youtube ) ) { |
|
| 793 | + $modal_body = wp_oembed_get( $youtube, array( // WPCS: XSS OK. |
|
| 794 | + 'width' => 480, |
|
| 795 | + ) ); |
|
| 796 | + } |
|
| 797 | + $modal_body .= '<h5 class="modal-title title-lined">' . $group['name'] . '</h5>'; |
|
| 798 | + $modal_body .= $content; |
|
| 799 | + \lsx_health_plan\functions\register_modal( 'workout-video-modal-' . $m, '', $modal_body ); |
|
| 800 | + |
|
| 801 | + if ( true === $echo ) { |
|
| 802 | + echo wp_kses_post( $play_button ); |
|
| 803 | + } else { |
|
| 804 | + return $play_button; |
|
| 805 | + } |
|
| 806 | + } |
|
| 807 | 807 | } |
| 808 | 808 | |
| 809 | 809 | /** |
@@ -812,21 +812,21 @@ discard block |
||
| 812 | 812 | * @return void |
| 813 | 813 | */ |
| 814 | 814 | function lsx_health_plan_recipe_archive_description() { |
| 815 | - $description = ''; |
|
| 816 | - if ( is_post_type_archive( 'recipe' ) ) { |
|
| 817 | - $description = \lsx_health_plan\functions\get_option( 'recipe_archive_description', '' ); |
|
| 818 | - } elseif ( is_post_type_archive( 'exercise' ) ) { |
|
| 819 | - $description = \lsx_health_plan\functions\get_option( 'exercise_archive_description', '' ); |
|
| 820 | - } elseif ( is_tax() ) { |
|
| 821 | - $description = get_the_archive_description(); |
|
| 822 | - } |
|
| 823 | - if ( '' !== $description ) { |
|
| 824 | - ?> |
|
| 815 | + $description = ''; |
|
| 816 | + if ( is_post_type_archive( 'recipe' ) ) { |
|
| 817 | + $description = \lsx_health_plan\functions\get_option( 'recipe_archive_description', '' ); |
|
| 818 | + } elseif ( is_post_type_archive( 'exercise' ) ) { |
|
| 819 | + $description = \lsx_health_plan\functions\get_option( 'exercise_archive_description', '' ); |
|
| 820 | + } elseif ( is_tax() ) { |
|
| 821 | + $description = get_the_archive_description(); |
|
| 822 | + } |
|
| 823 | + if ( '' !== $description ) { |
|
| 824 | + ?> |
|
| 825 | 825 | <div class="lsx-hp-archive-description row"> |
| 826 | 826 | <div class="col-xs-12 description-wrapper"><?php echo wp_kses_post( wpautop( $description ) ); ?></div> |
| 827 | 827 | </div> |
| 828 | 828 | <?php |
| 829 | - } |
|
| 829 | + } |
|
| 830 | 830 | } |
| 831 | 831 | |
| 832 | 832 | /** |
@@ -835,23 +835,23 @@ discard block |
||
| 835 | 835 | * @return void |
| 836 | 836 | */ |
| 837 | 837 | function lsx_health_plan_workout_main_content() { |
| 838 | - // Getting translated endpoint. |
|
| 839 | - $workout = \lsx_health_plan\functions\get_option( 'endpoint_workout', 'workout' ); |
|
| 840 | - |
|
| 841 | - $connected_members = get_post_meta( get_the_ID(), ( $workout . '_connected_team_member' ), true ); |
|
| 842 | - $small_description = get_post_meta( get_the_ID(), ( $workout . '_short_description' ), true ); |
|
| 843 | - |
|
| 844 | - $content = ''; |
|
| 845 | - if ( $small_description || $connected_members || lsx_health_plan_has_tips() ) { |
|
| 846 | - $content .= '<div class="short-desc set-box set content-box entry-content">'; |
|
| 847 | - $content .= '<div class="the-content">'; |
|
| 848 | - $content .= lsx_hp_member_connected( $connected_members, $workout ); |
|
| 849 | - $content .= '<span>' . $small_description . '</span>'; |
|
| 850 | - $content .= '</div>'; |
|
| 851 | - $content .= do_shortcode( '[lsx_health_plan_featured_tips_block]' ); |
|
| 852 | - $content .= '</div>'; |
|
| 853 | - } |
|
| 854 | - return $content; |
|
| 838 | + // Getting translated endpoint. |
|
| 839 | + $workout = \lsx_health_plan\functions\get_option( 'endpoint_workout', 'workout' ); |
|
| 840 | + |
|
| 841 | + $connected_members = get_post_meta( get_the_ID(), ( $workout . '_connected_team_member' ), true ); |
|
| 842 | + $small_description = get_post_meta( get_the_ID(), ( $workout . '_short_description' ), true ); |
|
| 843 | + |
|
| 844 | + $content = ''; |
|
| 845 | + if ( $small_description || $connected_members || lsx_health_plan_has_tips() ) { |
|
| 846 | + $content .= '<div class="short-desc set-box set content-box entry-content">'; |
|
| 847 | + $content .= '<div class="the-content">'; |
|
| 848 | + $content .= lsx_hp_member_connected( $connected_members, $workout ); |
|
| 849 | + $content .= '<span>' . $small_description . '</span>'; |
|
| 850 | + $content .= '</div>'; |
|
| 851 | + $content .= do_shortcode( '[lsx_health_plan_featured_tips_block]' ); |
|
| 852 | + $content .= '</div>'; |
|
| 853 | + } |
|
| 854 | + return $content; |
|
| 855 | 855 | } |
| 856 | 856 | |
| 857 | 857 | /** |
@@ -860,23 +860,23 @@ discard block |
||
| 860 | 860 | * @return void |
| 861 | 861 | */ |
| 862 | 862 | function lsx_health_plan_meal_main_content() { |
| 863 | - // Getting translated endpoint. |
|
| 864 | - $meal = \lsx_health_plan\functions\get_option( 'endpoint_meal', 'meal' ); |
|
| 865 | - |
|
| 866 | - $connected_members = get_post_meta( get_the_ID(), ( $meal . '_connected_team_member' ), true ); |
|
| 867 | - $small_description = get_post_meta( get_the_ID(), ( $meal . '_short_description' ), true ); |
|
| 868 | - |
|
| 869 | - $content_meal = ''; |
|
| 870 | - if ( $small_description || $connected_members || lsx_health_plan_has_tips() ) { |
|
| 871 | - $content_meal .= '<div class="set-box set content-box entry-content">'; |
|
| 872 | - $content_meal .= '<div class="the-content">'; |
|
| 873 | - $content_meal .= lsx_hp_member_connected( $connected_members, $meal ); |
|
| 874 | - $content_meal .= '<span>' . $small_description . '</span>'; |
|
| 875 | - $content_meal .= '</div>'; |
|
| 876 | - $content_meal .= do_shortcode( '[lsx_health_plan_featured_tips_block]' ); |
|
| 877 | - $content_meal .= '</div>'; |
|
| 878 | - } |
|
| 879 | - return $content_meal; |
|
| 863 | + // Getting translated endpoint. |
|
| 864 | + $meal = \lsx_health_plan\functions\get_option( 'endpoint_meal', 'meal' ); |
|
| 865 | + |
|
| 866 | + $connected_members = get_post_meta( get_the_ID(), ( $meal . '_connected_team_member' ), true ); |
|
| 867 | + $small_description = get_post_meta( get_the_ID(), ( $meal . '_short_description' ), true ); |
|
| 868 | + |
|
| 869 | + $content_meal = ''; |
|
| 870 | + if ( $small_description || $connected_members || lsx_health_plan_has_tips() ) { |
|
| 871 | + $content_meal .= '<div class="set-box set content-box entry-content">'; |
|
| 872 | + $content_meal .= '<div class="the-content">'; |
|
| 873 | + $content_meal .= lsx_hp_member_connected( $connected_members, $meal ); |
|
| 874 | + $content_meal .= '<span>' . $small_description . '</span>'; |
|
| 875 | + $content_meal .= '</div>'; |
|
| 876 | + $content_meal .= do_shortcode( '[lsx_health_plan_featured_tips_block]' ); |
|
| 877 | + $content_meal .= '</div>'; |
|
| 878 | + } |
|
| 879 | + return $content_meal; |
|
| 880 | 880 | } |
| 881 | 881 | |
| 882 | 882 | |
@@ -887,36 +887,36 @@ discard block |
||
| 887 | 887 | * @return void |
| 888 | 888 | */ |
| 889 | 889 | function lsx_health_plan_workout_tab_content( $index = 1 ) { |
| 890 | - global $group_name,$shortcode_args; |
|
| 891 | - $group_name = 'workout_section_' . $index; |
|
| 892 | - if ( false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) { |
|
| 893 | - $layout = strtolower( \lsx_health_plan\functions\get_option( 'workout_tab_layout', 'table' ) ); |
|
| 894 | - |
|
| 895 | - // Check for shortcode overrides. |
|
| 896 | - if ( null !== $shortcode_args && isset( $shortcode_args['layout'] ) ) { |
|
| 897 | - $layout = $shortcode_args['layout']; |
|
| 898 | - } |
|
| 899 | - } else { |
|
| 900 | - $layout = 'table'; |
|
| 901 | - } |
|
| 902 | - |
|
| 903 | - switch ( $layout ) { |
|
| 904 | - case 'list': |
|
| 905 | - $tab_template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-list.php'; |
|
| 906 | - break; |
|
| 907 | - |
|
| 908 | - case 'grid': |
|
| 909 | - $tab_template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-grid.php'; |
|
| 910 | - break; |
|
| 911 | - |
|
| 912 | - case 'table': |
|
| 913 | - $tab_template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-table.php'; |
|
| 914 | - break; |
|
| 915 | - } |
|
| 916 | - $tab_template_path = apply_filters( 'lsx_health_plan_workout_tab_content_path', $tab_template_path ); |
|
| 917 | - if ( '' !== $tab_template_path ) { |
|
| 918 | - include $tab_template_path; |
|
| 919 | - } |
|
| 890 | + global $group_name,$shortcode_args; |
|
| 891 | + $group_name = 'workout_section_' . $index; |
|
| 892 | + if ( false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) { |
|
| 893 | + $layout = strtolower( \lsx_health_plan\functions\get_option( 'workout_tab_layout', 'table' ) ); |
|
| 894 | + |
|
| 895 | + // Check for shortcode overrides. |
|
| 896 | + if ( null !== $shortcode_args && isset( $shortcode_args['layout'] ) ) { |
|
| 897 | + $layout = $shortcode_args['layout']; |
|
| 898 | + } |
|
| 899 | + } else { |
|
| 900 | + $layout = 'table'; |
|
| 901 | + } |
|
| 902 | + |
|
| 903 | + switch ( $layout ) { |
|
| 904 | + case 'list': |
|
| 905 | + $tab_template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-list.php'; |
|
| 906 | + break; |
|
| 907 | + |
|
| 908 | + case 'grid': |
|
| 909 | + $tab_template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-grid.php'; |
|
| 910 | + break; |
|
| 911 | + |
|
| 912 | + case 'table': |
|
| 913 | + $tab_template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-table.php'; |
|
| 914 | + break; |
|
| 915 | + } |
|
| 916 | + $tab_template_path = apply_filters( 'lsx_health_plan_workout_tab_content_path', $tab_template_path ); |
|
| 917 | + if ( '' !== $tab_template_path ) { |
|
| 918 | + include $tab_template_path; |
|
| 919 | + } |
|
| 920 | 920 | } |
| 921 | 921 | |
| 922 | 922 | /** |
@@ -925,28 +925,28 @@ discard block |
||
| 925 | 925 | * @return void |
| 926 | 926 | */ |
| 927 | 927 | function lsx_health_plan_workout_sets() { |
| 928 | - if ( is_singular( 'workout' ) ) { |
|
| 929 | - global $connected_workouts; |
|
| 930 | - $connected_workouts = array( get_the_ID() ); |
|
| 931 | - } |
|
| 932 | - if ( is_singular( 'plan' ) ) { |
|
| 933 | - |
|
| 934 | - global $connected_workouts; |
|
| 935 | - |
|
| 936 | - $section_key = get_query_var( 'section' ); |
|
| 937 | - if ( '' !== $section && \lsx_health_plan\functions\plan\has_sections() ) { |
|
| 938 | - $section_info = \lsx_health_plan\functions\plan\get_section_info( $section_key ); |
|
| 939 | - if ( isset( $section_info['connected_workouts'] ) && '' !== $section_info['connected_workouts'] ) { |
|
| 940 | - |
|
| 941 | - $connected_workouts = \lsx_health_plan\functions\prep_array( $section_info['connected_workouts'] ); |
|
| 942 | - } |
|
| 943 | - } |
|
| 944 | - } |
|
| 945 | - $template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-sets.php'; |
|
| 946 | - $template_path = apply_filters( 'lsx_health_plan_workout_set_template_path', $template_path ); |
|
| 947 | - if ( '' !== $template_path && ! empty( $template_path ) ) { |
|
| 948 | - include $template_path; |
|
| 949 | - } |
|
| 928 | + if ( is_singular( 'workout' ) ) { |
|
| 929 | + global $connected_workouts; |
|
| 930 | + $connected_workouts = array( get_the_ID() ); |
|
| 931 | + } |
|
| 932 | + if ( is_singular( 'plan' ) ) { |
|
| 933 | + |
|
| 934 | + global $connected_workouts; |
|
| 935 | + |
|
| 936 | + $section_key = get_query_var( 'section' ); |
|
| 937 | + if ( '' !== $section && \lsx_health_plan\functions\plan\has_sections() ) { |
|
| 938 | + $section_info = \lsx_health_plan\functions\plan\get_section_info( $section_key ); |
|
| 939 | + if ( isset( $section_info['connected_workouts'] ) && '' !== $section_info['connected_workouts'] ) { |
|
| 940 | + |
|
| 941 | + $connected_workouts = \lsx_health_plan\functions\prep_array( $section_info['connected_workouts'] ); |
|
| 942 | + } |
|
| 943 | + } |
|
| 944 | + } |
|
| 945 | + $template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-sets.php'; |
|
| 946 | + $template_path = apply_filters( 'lsx_health_plan_workout_set_template_path', $template_path ); |
|
| 947 | + if ( '' !== $template_path && ! empty( $template_path ) ) { |
|
| 948 | + include $template_path; |
|
| 949 | + } |
|
| 950 | 950 | } |
| 951 | 951 | |
| 952 | 952 | /** |
@@ -957,11 +957,11 @@ discard block |
||
| 957 | 957 | */ |
| 958 | 958 | function lsx_health_plan_warmup_sets( $connected_workouts ) { |
| 959 | 959 | |
| 960 | - $template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-sets.php'; |
|
| 961 | - $template_path = apply_filters( 'lsx_health_plan_workout_set_template_path', $template_path ); |
|
| 962 | - if ( '' !== $template_path && ! empty( $template_path ) ) { |
|
| 963 | - include $template_path; |
|
| 964 | - } |
|
| 960 | + $template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-sets.php'; |
|
| 961 | + $template_path = apply_filters( 'lsx_health_plan_workout_set_template_path', $template_path ); |
|
| 962 | + if ( '' !== $template_path && ! empty( $template_path ) ) { |
|
| 963 | + include $template_path; |
|
| 964 | + } |
|
| 965 | 965 | } |
| 966 | 966 | |
| 967 | 967 | /** |
@@ -971,48 +971,48 @@ discard block |
||
| 971 | 971 | * @return void |
| 972 | 972 | */ |
| 973 | 973 | function lsx_hp_meal_plan_recipes( $args = array() ) { |
| 974 | - $defaults = array( |
|
| 975 | - 'meal_id' => false, |
|
| 976 | - 'meal_time' => '', |
|
| 977 | - 'modal' => true, |
|
| 978 | - ); |
|
| 979 | - $args = wp_parse_args( $args, $defaults ); |
|
| 980 | - // Looking for recipes. |
|
| 981 | - $connected_recipes = get_post_meta( $args['meal_id'], $args['meal_time'] . '_recipes', true ); |
|
| 982 | - if ( ! empty( $connected_recipes ) ) { |
|
| 983 | - $query_args = array( |
|
| 984 | - 'orderby' => 'date', |
|
| 985 | - 'order' => 'DESC', |
|
| 986 | - 'post_type' => 'recipe', |
|
| 987 | - 'post__in' => $connected_recipes, |
|
| 988 | - ); |
|
| 989 | - $recipes = new WP_Query( $query_args ); |
|
| 990 | - ?> |
|
| 974 | + $defaults = array( |
|
| 975 | + 'meal_id' => false, |
|
| 976 | + 'meal_time' => '', |
|
| 977 | + 'modal' => true, |
|
| 978 | + ); |
|
| 979 | + $args = wp_parse_args( $args, $defaults ); |
|
| 980 | + // Looking for recipes. |
|
| 981 | + $connected_recipes = get_post_meta( $args['meal_id'], $args['meal_time'] . '_recipes', true ); |
|
| 982 | + if ( ! empty( $connected_recipes ) ) { |
|
| 983 | + $query_args = array( |
|
| 984 | + 'orderby' => 'date', |
|
| 985 | + 'order' => 'DESC', |
|
| 986 | + 'post_type' => 'recipe', |
|
| 987 | + 'post__in' => $connected_recipes, |
|
| 988 | + ); |
|
| 989 | + $recipes = new WP_Query( $query_args ); |
|
| 990 | + ?> |
|
| 991 | 991 | <div class="recipes"> |
| 992 | 992 | <div class="row eating-row"> |
| 993 | 993 | <?php |
| 994 | - if ( $recipes->have_posts() ) { |
|
| 995 | - while ( $recipes->have_posts() ) { |
|
| 996 | - $recipes->the_post(); |
|
| 997 | - if ( false !== $args['modal'] ) { |
|
| 998 | - \lsx_health_plan\functions\recipes\register_recipe_modal(); |
|
| 999 | - } |
|
| 1000 | - ?> |
|
| 994 | + if ( $recipes->have_posts() ) { |
|
| 995 | + while ( $recipes->have_posts() ) { |
|
| 996 | + $recipes->the_post(); |
|
| 997 | + if ( false !== $args['modal'] ) { |
|
| 998 | + \lsx_health_plan\functions\recipes\register_recipe_modal(); |
|
| 999 | + } |
|
| 1000 | + ?> |
|
| 1001 | 1001 | <div class="recipe-column"> |
| 1002 | 1002 | <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"> |
| 1003 | 1003 | <div class="recipe-feature-img"> |
| 1004 | 1004 | <?php |
| 1005 | - $featured_image = get_the_post_thumbnail(); |
|
| 1006 | - if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
| 1007 | - the_post_thumbnail( 'lsx-thumbnail-square', array( |
|
| 1008 | - 'class' => 'aligncenter', |
|
| 1009 | - ) ); |
|
| 1010 | - } else { |
|
| 1011 | - ?> |
|
| 1005 | + $featured_image = get_the_post_thumbnail(); |
|
| 1006 | + if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
| 1007 | + the_post_thumbnail( 'lsx-thumbnail-square', array( |
|
| 1008 | + 'class' => 'aligncenter', |
|
| 1009 | + ) ); |
|
| 1010 | + } else { |
|
| 1011 | + ?> |
|
| 1012 | 1012 | <img loading="lazy" class="placeholder" src="<?php echo esc_attr( plugin_dir_url( __DIR__ ) . 'assets/images/placeholder.jpg' ); ?>"> |
| 1013 | 1013 | <?php |
| 1014 | - } |
|
| 1015 | - ?> |
|
| 1014 | + } |
|
| 1015 | + ?> |
|
| 1016 | 1016 | </div> |
| 1017 | 1017 | <div class="recipe-content"> |
| 1018 | 1018 | <h3 class="recipe-title"><?php the_title(); ?></h3> |
@@ -1021,41 +1021,41 @@ discard block |
||
| 1021 | 1021 | </a> |
| 1022 | 1022 | </div> |
| 1023 | 1023 | <?php |
| 1024 | - } |
|
| 1025 | - } |
|
| 1026 | - wp_reset_postdata(); |
|
| 1027 | - ?> |
|
| 1024 | + } |
|
| 1025 | + } |
|
| 1026 | + wp_reset_postdata(); |
|
| 1027 | + ?> |
|
| 1028 | 1028 | </div> |
| 1029 | 1029 | </div> |
| 1030 | 1030 | <?php |
| 1031 | 1031 | |
| 1032 | - } |
|
| 1032 | + } |
|
| 1033 | 1033 | } |
| 1034 | 1034 | |
| 1035 | 1035 | /** |
| 1036 | 1036 | * Output the connected. |
| 1037 | 1037 | */ |
| 1038 | 1038 | function lsx_hp_recipe_plan_meta( $args = array() ) { |
| 1039 | - $defaults = array(); |
|
| 1040 | - $top_level_plans = array(); |
|
| 1041 | - // Get meals this exercise is connected to. |
|
| 1042 | - $plans = get_post_meta( get_the_ID(), 'connected_plans', true ); |
|
| 1043 | - if ( ! empty( $plans ) ) { |
|
| 1044 | - $plan = end( $plans ); |
|
| 1045 | - $has_parent = wp_get_post_parent_id( $plan ); |
|
| 1046 | - if ( 0 === $has_parent ) { |
|
| 1047 | - $top_level_plans[] = $plan; |
|
| 1048 | - } elseif ( false !== $top_level_plans ) { |
|
| 1049 | - $top_level_plans[] = $has_parent; |
|
| 1050 | - } |
|
| 1051 | - } |
|
| 1052 | - if ( ! empty( $top_level_plans ) && ( '' !== $top_level_plans ) ) { |
|
| 1053 | - $top_level_plans = array_unique( $top_level_plans ); |
|
| 1054 | - $top_level_plan = end( $top_level_plans ); |
|
| 1055 | - ?> |
|
| 1039 | + $defaults = array(); |
|
| 1040 | + $top_level_plans = array(); |
|
| 1041 | + // Get meals this exercise is connected to. |
|
| 1042 | + $plans = get_post_meta( get_the_ID(), 'connected_plans', true ); |
|
| 1043 | + if ( ! empty( $plans ) ) { |
|
| 1044 | + $plan = end( $plans ); |
|
| 1045 | + $has_parent = wp_get_post_parent_id( $plan ); |
|
| 1046 | + if ( 0 === $has_parent ) { |
|
| 1047 | + $top_level_plans[] = $plan; |
|
| 1048 | + } elseif ( false !== $top_level_plans ) { |
|
| 1049 | + $top_level_plans[] = $has_parent; |
|
| 1050 | + } |
|
| 1051 | + } |
|
| 1052 | + if ( ! empty( $top_level_plans ) && ( '' !== $top_level_plans ) ) { |
|
| 1053 | + $top_level_plans = array_unique( $top_level_plans ); |
|
| 1054 | + $top_level_plan = end( $top_level_plans ); |
|
| 1055 | + ?> |
|
| 1056 | 1056 | <span class="recipe-type recipe-parent"><?php echo esc_html( get_the_title( $top_level_plan ) ); ?></span> |
| 1057 | 1057 | <?php |
| 1058 | - } |
|
| 1058 | + } |
|
| 1059 | 1059 | } |
| 1060 | 1060 | |
| 1061 | 1061 | /** |
@@ -1063,42 +1063,42 @@ discard block |
||
| 1063 | 1063 | */ |
| 1064 | 1064 | function lsx_hp_exercise_plan_meta() { |
| 1065 | 1065 | |
| 1066 | - $top_level_plans = array(); |
|
| 1067 | - |
|
| 1068 | - // Get workouts this exercise is connected to. |
|
| 1069 | - $workouts = get_post_meta( get_the_ID(), 'connected_workouts', true ); |
|
| 1070 | - |
|
| 1071 | - if ( '' !== $workouts && ! is_array( $workouts ) ) { |
|
| 1072 | - $workouts = array( $workouts ); |
|
| 1073 | - } |
|
| 1074 | - if ( ! empty( $workouts ) ) { |
|
| 1075 | - foreach ( $workouts as $workout ) { |
|
| 1076 | - // Get the plans this workout is connected to. |
|
| 1077 | - $plans = get_post_meta( $workout, 'connected_plans', true ); |
|
| 1078 | - |
|
| 1079 | - if ( '' !== $plans && ! is_array( $plans ) ) { |
|
| 1080 | - $plans = array( $plans ); |
|
| 1081 | - } |
|
| 1082 | - if ( ! empty( $plans ) ) { |
|
| 1083 | - foreach ( $plans as $plan ) { |
|
| 1084 | - $has_parent = wp_get_post_parent_id( $plan ); |
|
| 1085 | - if ( 0 === $has_parent ) { |
|
| 1086 | - $top_level_plans = $plan; |
|
| 1087 | - } else { |
|
| 1088 | - $top_level_plans = $has_parent; |
|
| 1089 | - } |
|
| 1090 | - } |
|
| 1091 | - } |
|
| 1092 | - } |
|
| 1093 | - } |
|
| 1094 | - |
|
| 1095 | - if ( ! empty( $top_level_plans ) && ( '' !== $top_level_plans ) ) { |
|
| 1096 | - $top_level_plans = array_unique( $top_level_plans ); |
|
| 1097 | - $top_level_plan = end( $top_level_plans ); |
|
| 1098 | - ?> |
|
| 1066 | + $top_level_plans = array(); |
|
| 1067 | + |
|
| 1068 | + // Get workouts this exercise is connected to. |
|
| 1069 | + $workouts = get_post_meta( get_the_ID(), 'connected_workouts', true ); |
|
| 1070 | + |
|
| 1071 | + if ( '' !== $workouts && ! is_array( $workouts ) ) { |
|
| 1072 | + $workouts = array( $workouts ); |
|
| 1073 | + } |
|
| 1074 | + if ( ! empty( $workouts ) ) { |
|
| 1075 | + foreach ( $workouts as $workout ) { |
|
| 1076 | + // Get the plans this workout is connected to. |
|
| 1077 | + $plans = get_post_meta( $workout, 'connected_plans', true ); |
|
| 1078 | + |
|
| 1079 | + if ( '' !== $plans && ! is_array( $plans ) ) { |
|
| 1080 | + $plans = array( $plans ); |
|
| 1081 | + } |
|
| 1082 | + if ( ! empty( $plans ) ) { |
|
| 1083 | + foreach ( $plans as $plan ) { |
|
| 1084 | + $has_parent = wp_get_post_parent_id( $plan ); |
|
| 1085 | + if ( 0 === $has_parent ) { |
|
| 1086 | + $top_level_plans = $plan; |
|
| 1087 | + } else { |
|
| 1088 | + $top_level_plans = $has_parent; |
|
| 1089 | + } |
|
| 1090 | + } |
|
| 1091 | + } |
|
| 1092 | + } |
|
| 1093 | + } |
|
| 1094 | + |
|
| 1095 | + if ( ! empty( $top_level_plans ) && ( '' !== $top_level_plans ) ) { |
|
| 1096 | + $top_level_plans = array_unique( $top_level_plans ); |
|
| 1097 | + $top_level_plan = end( $top_level_plans ); |
|
| 1098 | + ?> |
|
| 1099 | 1099 | <span class="recipe-type recipe-parent"><?php echo esc_html( get_the_title( $top_level_plan ) ); ?></span> |
| 1100 | 1100 | <?php |
| 1101 | - } |
|
| 1101 | + } |
|
| 1102 | 1102 | } |
| 1103 | 1103 | |
| 1104 | 1104 | /** |
@@ -1108,7 +1108,7 @@ discard block |
||
| 1108 | 1108 | * @return void |
| 1109 | 1109 | */ |
| 1110 | 1110 | function lsx_hp_single_related( $related_content, $post_type_text ) { |
| 1111 | - ?> |
|
| 1111 | + ?> |
|
| 1112 | 1112 | <section id="lsx-hp-related"> |
| 1113 | 1113 | <div class="row lsx-related-posts lsx-related-posts-title"> |
| 1114 | 1114 | <div class="col-xs-12"> |
@@ -1119,14 +1119,14 @@ discard block |
||
| 1119 | 1119 | <div class="col-xs-12"> |
| 1120 | 1120 | <div class="lsx-related-posts-wrapper"> |
| 1121 | 1121 | <?php |
| 1122 | - $i = 0; |
|
| 1123 | - foreach ( $related_content as $article ) { |
|
| 1124 | - $post_title = get_the_title( $article ); |
|
| 1125 | - $post_categories = wp_get_post_categories( $article ); |
|
| 1126 | - $post_link = get_permalink( $article ); |
|
| 1127 | - |
|
| 1128 | - $cats = array(); |
|
| 1129 | - ?> |
|
| 1122 | + $i = 0; |
|
| 1123 | + foreach ( $related_content as $article ) { |
|
| 1124 | + $post_title = get_the_title( $article ); |
|
| 1125 | + $post_categories = wp_get_post_categories( $article ); |
|
| 1126 | + $post_link = get_permalink( $article ); |
|
| 1127 | + |
|
| 1128 | + $cats = array(); |
|
| 1129 | + ?> |
|
| 1130 | 1130 | <article id="post-<?php echo esc_html( $article ); ?>" class="lsx-slot post"> |
| 1131 | 1131 | <div class="entry-layout lsx-hp-shadow"> |
| 1132 | 1132 | <div class="entry-layout-content"> |
@@ -1134,25 +1134,25 @@ discard block |
||
| 1134 | 1134 | <div class="entry-image"> |
| 1135 | 1135 | <a href="<?php echo esc_url( $post_link ); ?>" class="thumbnail"> |
| 1136 | 1136 | <?php |
| 1137 | - $featured_image = get_the_post_thumbnail( $article, 'lsx-thumbnail-wide' ); |
|
| 1138 | - if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
| 1139 | - echo wp_kses_post( $featured_image ); |
|
| 1140 | - } else { |
|
| 1141 | - ?> |
|
| 1137 | + $featured_image = get_the_post_thumbnail( $article, 'lsx-thumbnail-wide' ); |
|
| 1138 | + if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
| 1139 | + echo wp_kses_post( $featured_image ); |
|
| 1140 | + } else { |
|
| 1141 | + ?> |
|
| 1142 | 1142 | <img loading="lazy" class="placeholder" src="<?php echo esc_attr( plugin_dir_url( __FILE__ ) . '../assets/images/placeholder.jpg' ); ?>"> |
| 1143 | 1143 | <?php |
| 1144 | - } |
|
| 1145 | - ?> |
|
| 1144 | + } |
|
| 1145 | + ?> |
|
| 1146 | 1146 | </a> |
| 1147 | 1147 | </div> |
| 1148 | 1148 | <div class="entry-meta"> |
| 1149 | 1149 | <?php |
| 1150 | - foreach ( $post_categories as $c ) { |
|
| 1151 | - $cat = get_category( $c ); |
|
| 1152 | - /* Translators: %s: category name */ |
|
| 1153 | - $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>'; |
|
| 1154 | - } |
|
| 1155 | - if ( ! empty( $cats ) ) { ?> |
|
| 1150 | + foreach ( $post_categories as $c ) { |
|
| 1151 | + $cat = get_category( $c ); |
|
| 1152 | + /* Translators: %s: category name */ |
|
| 1153 | + $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>'; |
|
| 1154 | + } |
|
| 1155 | + if ( ! empty( $cats ) ) { ?> |
|
| 1156 | 1156 | <div class="post-categories"><span></span><?php echo wp_kses_post( implode( ', ', $cats ) ); ?></div> |
| 1157 | 1157 | <?php } ?> |
| 1158 | 1158 | </div> |
@@ -1167,8 +1167,8 @@ discard block |
||
| 1167 | 1167 | </article> |
| 1168 | 1168 | |
| 1169 | 1169 | <?php |
| 1170 | - if (++$i === 3) break; |
|
| 1171 | - } ?> |
|
| 1170 | + if (++$i === 3) break; |
|
| 1171 | + } ?> |
|
| 1172 | 1172 | </div> |
| 1173 | 1173 | </div> |
| 1174 | 1174 | </div> |
@@ -1183,32 +1183,32 @@ discard block |
||
| 1183 | 1183 | * @return void |
| 1184 | 1184 | */ |
| 1185 | 1185 | function lsx_hp_member_connected( $connected_members, $post_type ) { |
| 1186 | - if ( ! empty( $connected_members ) ) { |
|
| 1187 | - $content = '<div id="hp-connected-members" class="hp-connected-members connected-' . $post_type . '">'; |
|
| 1188 | - foreach ( $connected_members as $member ) { |
|
| 1189 | - $post_link = get_permalink( $member ); |
|
| 1190 | - $member_name = get_the_title( $member ); |
|
| 1191 | - $member_name = '<span class="lsx-team-name">' . $member_name . '</span>'; |
|
| 1192 | - |
|
| 1193 | - $member_link = '<a href="' . $post_link . '" >' . $member_name . '</a>'; |
|
| 1194 | - |
|
| 1195 | - $roles = ''; |
|
| 1196 | - $terms = get_the_terms( $member, 'team_role' ); |
|
| 1197 | - |
|
| 1198 | - if ( $terms && ! is_wp_error( $terms ) ) { |
|
| 1199 | - $roles = array(); |
|
| 1200 | - |
|
| 1201 | - foreach ( $terms as $term ) { |
|
| 1202 | - $roles[] = $term->name; |
|
| 1203 | - } |
|
| 1204 | - |
|
| 1205 | - $roles = join( ', ', $roles ); |
|
| 1206 | - } |
|
| 1207 | - $member_roles = '' !== $roles ? "<small class='lsx-team-roles'>$roles</small>" : ''; |
|
| 1208 | - |
|
| 1209 | - $content .= '<p>' . $member_roles . ': ' . $member_link . '</p>'; |
|
| 1210 | - } |
|
| 1211 | - $content .= '</div>'; |
|
| 1212 | - return $content; |
|
| 1213 | - } |
|
| 1186 | + if ( ! empty( $connected_members ) ) { |
|
| 1187 | + $content = '<div id="hp-connected-members" class="hp-connected-members connected-' . $post_type . '">'; |
|
| 1188 | + foreach ( $connected_members as $member ) { |
|
| 1189 | + $post_link = get_permalink( $member ); |
|
| 1190 | + $member_name = get_the_title( $member ); |
|
| 1191 | + $member_name = '<span class="lsx-team-name">' . $member_name . '</span>'; |
|
| 1192 | + |
|
| 1193 | + $member_link = '<a href="' . $post_link . '" >' . $member_name . '</a>'; |
|
| 1194 | + |
|
| 1195 | + $roles = ''; |
|
| 1196 | + $terms = get_the_terms( $member, 'team_role' ); |
|
| 1197 | + |
|
| 1198 | + if ( $terms && ! is_wp_error( $terms ) ) { |
|
| 1199 | + $roles = array(); |
|
| 1200 | + |
|
| 1201 | + foreach ( $terms as $term ) { |
|
| 1202 | + $roles[] = $term->name; |
|
| 1203 | + } |
|
| 1204 | + |
|
| 1205 | + $roles = join( ', ', $roles ); |
|
| 1206 | + } |
|
| 1207 | + $member_roles = '' !== $roles ? "<small class='lsx-team-roles'>$roles</small>" : ''; |
|
| 1208 | + |
|
| 1209 | + $content .= '<p>' . $member_roles . ': ' . $member_link . '</p>'; |
|
| 1210 | + } |
|
| 1211 | + $content .= '</div>'; |
|
| 1212 | + return $content; |
|
| 1213 | + } |
|
| 1214 | 1214 | } |
@@ -11,26 +11,26 @@ discard block |
||
| 11 | 11 | * @return void |
| 12 | 12 | */ |
| 13 | 13 | function lsx_health_plan_workout_box() { |
| 14 | - if ( ! post_type_exists( 'workout' ) ) { |
|
| 14 | + if ( ! post_type_exists('workout')) { |
|
| 15 | 15 | return; |
| 16 | 16 | } |
| 17 | - $intro_text = \lsx_health_plan\functions\get_option( 'workout_intro', false ); |
|
| 17 | + $intro_text = \lsx_health_plan\functions\get_option('workout_intro', false); |
|
| 18 | 18 | ?> |
| 19 | 19 | <div class="workout-instructions"> |
| 20 | 20 | <div class="row"> |
| 21 | 21 | <div class="col-md-12"> |
| 22 | 22 | <?php |
| 23 | - if ( false !== $intro_text ) { |
|
| 23 | + if (false !== $intro_text) { |
|
| 24 | 24 | ?> |
| 25 | 25 | <div class="excerpt"> |
| 26 | - <p><?php echo wp_kses_post( wpautop( $intro_text ) ); ?></p> |
|
| 26 | + <p><?php echo wp_kses_post(wpautop($intro_text)); ?></p> |
|
| 27 | 27 | </div> |
| 28 | 28 | <?php |
| 29 | 29 | } else { |
| 30 | 30 | ?> |
| 31 | 31 | <div class="content-intro"> |
| 32 | - <h3><?php esc_html_e( "Don't forget your warm up!", 'lsx-health-plan' ); ?></h3> |
|
| 33 | - <p><?php esc_html_e( 'Be sure to do the warm-up before every workout session.', 'lsx-health-plan' ); ?></p> |
|
| 32 | + <h3><?php esc_html_e("Don't forget your warm up!", 'lsx-health-plan'); ?></h3> |
|
| 33 | + <p><?php esc_html_e('Be sure to do the warm-up before every workout session.', 'lsx-health-plan'); ?></p> |
|
| 34 | 34 | </div> |
| 35 | 35 | <?php |
| 36 | 36 | } ?> |
@@ -46,29 +46,29 @@ discard block |
||
| 46 | 46 | * @return void |
| 47 | 47 | */ |
| 48 | 48 | function lsx_health_plan_meal_box() { |
| 49 | - if ( ! post_type_exists( 'meal' ) ) { |
|
| 49 | + if ( ! post_type_exists('meal')) { |
|
| 50 | 50 | return; |
| 51 | 51 | } |
| 52 | 52 | ?> |
| 53 | 53 | <div class="col-md-4" > |
| 54 | 54 | <div class="lsx-health-plan-box"> |
| 55 | - <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> |
|
| 55 | + <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> |
|
| 56 | 56 | <div class="spacer"></div> |
| 57 | 57 | <?php |
| 58 | - $intro_text = \lsx_health_plan\functions\get_option( 'meal_plan_intro', false ); |
|
| 59 | - if ( false !== $intro_text ) { |
|
| 58 | + $intro_text = \lsx_health_plan\functions\get_option('meal_plan_intro', false); |
|
| 59 | + if (false !== $intro_text) { |
|
| 60 | 60 | ?> |
| 61 | 61 | <div class="excerpt"> |
| 62 | - <p><?php echo wp_kses_post( $intro_text ); ?></p> |
|
| 62 | + <p><?php echo wp_kses_post($intro_text); ?></p> |
|
| 63 | 63 | </div> |
| 64 | 64 | <?php |
| 65 | 65 | } |
| 66 | - $meal = \lsx_health_plan\functions\get_option( 'endpoint_meal', false ); |
|
| 67 | - if ( false === $meal ) { |
|
| 66 | + $meal = \lsx_health_plan\functions\get_option('endpoint_meal', false); |
|
| 67 | + if (false === $meal) { |
|
| 68 | 68 | $meal = 'meal'; |
| 69 | 69 | } |
| 70 | 70 | ?> |
| 71 | - <a href="<?php the_permalink(); ?><?php echo esc_attr( $meal ); ?>/" class="btn"><?php esc_html_e( 'View your meal plan', 'lsx-health-plan' ); ?></a> |
|
| 71 | + <a href="<?php the_permalink(); ?><?php echo esc_attr($meal); ?>/" class="btn"><?php esc_html_e('View your meal plan', 'lsx-health-plan'); ?></a> |
|
| 72 | 72 | </div> |
| 73 | 73 | </div> |
| 74 | 74 | <?php |
@@ -80,29 +80,29 @@ discard block |
||
| 80 | 80 | * @return void |
| 81 | 81 | */ |
| 82 | 82 | function lsx_health_plan_recipe_box() { |
| 83 | - if ( ! post_type_exists( 'recipe' ) ) { |
|
| 83 | + if ( ! post_type_exists('recipe')) { |
|
| 84 | 84 | return; |
| 85 | 85 | } |
| 86 | 86 | ?> |
| 87 | 87 | <div class="col-md-4" > |
| 88 | 88 | <div class="lsx-health-plan-box"> |
| 89 | - <h3 class="title recipes-title title-lined"><?php esc_html_e( 'Recipes', 'lsx-health-plan' ); ?><?php lsx_get_svg_icon( 'recipes.svg' ); ?></h3> |
|
| 89 | + <h3 class="title recipes-title title-lined"><?php esc_html_e('Recipes', 'lsx-health-plan'); ?><?php lsx_get_svg_icon('recipes.svg'); ?></h3> |
|
| 90 | 90 | <div class="spacer"></div> |
| 91 | 91 | <?php |
| 92 | - $intro_text = \lsx_health_plan\functions\get_option( 'recipes_intro', false ); |
|
| 93 | - if ( false !== $intro_text ) { |
|
| 92 | + $intro_text = \lsx_health_plan\functions\get_option('recipes_intro', false); |
|
| 93 | + if (false !== $intro_text) { |
|
| 94 | 94 | ?> |
| 95 | 95 | <div class="excerpt"> |
| 96 | - <p><?php echo wp_kses_post( $intro_text ); ?></p> |
|
| 96 | + <p><?php echo wp_kses_post($intro_text); ?></p> |
|
| 97 | 97 | </div> |
| 98 | 98 | <?php |
| 99 | 99 | } |
| 100 | - $recipes = \lsx_health_plan\functions\get_option( 'endpoint_recipe', false ); |
|
| 101 | - if ( false === $recipes ) { |
|
| 100 | + $recipes = \lsx_health_plan\functions\get_option('endpoint_recipe', false); |
|
| 101 | + if (false === $recipes) { |
|
| 102 | 102 | $recipes = 'recipes'; |
| 103 | 103 | } |
| 104 | 104 | ?> |
| 105 | - <a href="<?php the_permalink(); ?><?php echo esc_attr( $recipes ); ?>/" class="btn"><?php esc_html_e( 'View all recipes', 'lsx-health-plan' ); ?></a> |
|
| 105 | + <a href="<?php the_permalink(); ?><?php echo esc_attr($recipes); ?>/" class="btn"><?php esc_html_e('View all recipes', 'lsx-health-plan'); ?></a> |
|
| 106 | 106 | </div> |
| 107 | 107 | </div> |
| 108 | 108 | <?php |
@@ -118,15 +118,15 @@ discard block |
||
| 118 | 118 | ?> |
| 119 | 119 | <div class="col-md-4 day-download-box" > |
| 120 | 120 | <div class="lsx-health-plan-box"> |
| 121 | - <h3 class="title downloads-title title-lined"><?php esc_html_e( 'Downloads', 'lsx-health-plan' ); ?><?php lsx_get_svg_icon( 'download.svg' ); ?></h3> |
|
| 121 | + <h3 class="title downloads-title title-lined"><?php esc_html_e('Downloads', 'lsx-health-plan'); ?><?php lsx_get_svg_icon('download.svg'); ?></h3> |
|
| 122 | 122 | <div class="spacer"></div> |
| 123 | 123 | <div class="download-list"> |
| 124 | 124 | <ul> |
| 125 | 125 | <?php |
| 126 | 126 | $downloads = \lsx_health_plan\functions\get_downloads(); |
| 127 | - if ( ! empty( $downloads ) ) { |
|
| 128 | - foreach ( $downloads as $download ) { |
|
| 129 | - echo wp_kses_post( '<li><a href=""><i class="fa fa-file-pdf"></i>' . do_shortcode( '[download id="' . $download . '"]' ) . '</a></li>' ); |
|
| 127 | + if ( ! empty($downloads)) { |
|
| 128 | + foreach ($downloads as $download) { |
|
| 129 | + echo wp_kses_post('<li><a href=""><i class="fa fa-file-pdf"></i>' . do_shortcode('[download id="' . $download . '"]') . '</a></li>'); |
|
| 130 | 130 | } |
| 131 | 131 | } |
| 132 | 132 | ?> |
@@ -143,15 +143,15 @@ discard block |
||
| 143 | 143 | * @param string $tab |
| 144 | 144 | * @return void |
| 145 | 145 | */ |
| 146 | -function lsx_health_plan_nav_class( $tab = '' ) { |
|
| 146 | +function lsx_health_plan_nav_class($tab = '') { |
|
| 147 | 147 | $nav_classes = array(); |
| 148 | - if ( function_exists( 'is_wc_endpoint_url' ) && 'edit-account' === $tab && is_wc_endpoint_url( 'edit-account' ) ) { |
|
| 148 | + if (function_exists('is_wc_endpoint_url') && 'edit-account' === $tab && is_wc_endpoint_url('edit-account')) { |
|
| 149 | 149 | $nav_classes[] = 'active'; |
| 150 | - } elseif ( lsx_health_plan_is_current_tab( $tab ) ) { |
|
| 150 | + } elseif (lsx_health_plan_is_current_tab($tab)) { |
|
| 151 | 151 | $nav_classes[] = 'active'; |
| 152 | 152 | } |
| 153 | - if ( ! empty( $nav_classes ) ) { |
|
| 154 | - echo wp_kses_post( implode( ' ', $nav_classes ) ); |
|
| 153 | + if ( ! empty($nav_classes)) { |
|
| 154 | + echo wp_kses_post(implode(' ', $nav_classes)); |
|
| 155 | 155 | } |
| 156 | 156 | } |
| 157 | 157 | |
@@ -166,26 +166,26 @@ discard block |
||
| 166 | 166 | <ul class="nav nav-pills"> |
| 167 | 167 | <li class=" |
| 168 | 168 | <?php |
| 169 | - if ( ( function_exists( 'is_wc_endpoint_url' ) && ! is_wc_endpoint_url( 'edit-account' ) ) || ! function_exists( 'is_wc_endpoint_url' ) ) { |
|
| 170 | - echo esc_attr( 'active' ); |
|
| 169 | + if ((function_exists('is_wc_endpoint_url') && ! is_wc_endpoint_url('edit-account')) || ! function_exists('is_wc_endpoint_url')) { |
|
| 170 | + echo esc_attr('active'); |
|
| 171 | 171 | } |
| 172 | 172 | ?> |
| 173 | - "><a class="my-plan-tab" href="<?php the_permalink(); ?>"><?php esc_html_e( 'My Plans', 'lsx-health-plan' ); ?></a></li> |
|
| 173 | + "><a class="my-plan-tab" href="<?php the_permalink(); ?>"><?php esc_html_e('My Plans', 'lsx-health-plan'); ?></a></li> |
|
| 174 | 174 | <?php |
| 175 | - if ( function_exists( 'WC' ) ) { |
|
| 175 | + if (function_exists('WC')) { |
|
| 176 | 176 | ?> |
| 177 | 177 | <li class=" |
| 178 | 178 | <?php |
| 179 | - if ( function_exists( 'is_wc_endpoint_url' ) && is_wc_endpoint_url( 'edit-account' ) ) { |
|
| 180 | - echo esc_attr( 'active' ); |
|
| 179 | + if (function_exists('is_wc_endpoint_url') && is_wc_endpoint_url('edit-account')) { |
|
| 180 | + echo esc_attr('active'); |
|
| 181 | 181 | } |
| 182 | 182 | ?> |
| 183 | - "><a class="account-details-tab" href="<?php the_permalink(); ?>edit-account/"><?php esc_html_e( 'Account Details', 'lsx-health-plan' ); ?></a></li> |
|
| 183 | + "><a class="account-details-tab" href="<?php the_permalink(); ?>edit-account/"><?php esc_html_e('Account Details', 'lsx-health-plan'); ?></a></li> |
|
| 184 | 184 | <?php |
| 185 | 185 | } |
| 186 | - if ( is_user_logged_in() ) { |
|
| 186 | + if (is_user_logged_in()) { |
|
| 187 | 187 | ?> |
| 188 | - <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> |
|
| 188 | + <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> |
|
| 189 | 189 | <?php |
| 190 | 190 | } |
| 191 | 191 | ?> |
@@ -203,84 +203,84 @@ discard block |
||
| 203 | 203 | ?> |
| 204 | 204 | <div class="lsx-health-plan my-profile-block wp-block-cover alignfull"> |
| 205 | 205 | <div class="wp-block-cover__inner-container"> |
| 206 | - <h2><?php esc_html_e( 'My Dashboard', 'lsx-health-plan' ); ?></h2> |
|
| 207 | - <?php if ( ( function_exists( 'WC' ) || class_exists( 'WP_User_Avatar_Setup' ) ) && is_user_logged_in() ) { ?> |
|
| 206 | + <h2><?php esc_html_e('My Dashboard', 'lsx-health-plan'); ?></h2> |
|
| 207 | + <?php if ((function_exists('WC') || class_exists('WP_User_Avatar_Setup')) && is_user_logged_in()) { ?> |
|
| 208 | 208 | <section id="dashboard-card"> |
| 209 | - <?php if ( function_exists( 'WC' ) || class_exists( 'WP_User_Avatar_Setup' ) ) { ?> |
|
| 209 | + <?php if (function_exists('WC') || class_exists('WP_User_Avatar_Setup')) { ?> |
|
| 210 | 210 | <div class="profile-navigation"> |
| 211 | 211 | <div class="profile-photo"> |
| 212 | 212 | <?php |
| 213 | 213 | global $current_user; |
| 214 | - if ( function_exists( 'WC' ) ) { |
|
| 214 | + if (function_exists('WC')) { |
|
| 215 | 215 | get_current_user(); |
| 216 | 216 | } |
| 217 | - if ( class_exists( 'WP_User_Avatar_Setup' ) ) { |
|
| 218 | - echo get_avatar( $current_user->ID, 240 ); |
|
| 217 | + if (class_exists('WP_User_Avatar_Setup')) { |
|
| 218 | + echo get_avatar($current_user->ID, 240); |
|
| 219 | 219 | } |
| 220 | 220 | ?> |
| 221 | 221 | </div> |
| 222 | 222 | </div> |
| 223 | 223 | <?php } ?> |
| 224 | - <?php if ( function_exists( 'WC' ) ) { ?> |
|
| 224 | + <?php if (function_exists('WC')) { ?> |
|
| 225 | 225 | <div class="profile-details"> |
| 226 | - <h1 class="title-lined has-text-color"><?php echo esc_html( $current_user->display_name ); ?></h1> |
|
| 226 | + <h1 class="title-lined has-text-color"><?php echo esc_html($current_user->display_name); ?></h1> |
|
| 227 | 227 | <?php |
| 228 | - $disable_stats = \lsx_health_plan\functions\get_option( 'disable_all_stats', false ); |
|
| 229 | - if ( 'on' !== $disable_stats && function_exists( 'WC' ) ) { |
|
| 228 | + $disable_stats = \lsx_health_plan\functions\get_option('disable_all_stats', false); |
|
| 229 | + if ('on' !== $disable_stats && function_exists('WC')) { |
|
| 230 | 230 | |
| 231 | - $is_weight_disabled = \lsx_health_plan\functions\get_option( 'disable_weight_checkbox', false ); |
|
| 232 | - $is_height_disabled = \lsx_health_plan\functions\get_option( 'disable_height_checkbox', false ); |
|
| 233 | - $is_waist_disabled = \lsx_health_plan\functions\get_option( 'disable_waist_checkbox', false ); |
|
| 234 | - $is_bmi_disabled = \lsx_health_plan\functions\get_option( 'disable_bmi_checkbox', false ); |
|
| 231 | + $is_weight_disabled = \lsx_health_plan\functions\get_option('disable_weight_checkbox', false); |
|
| 232 | + $is_height_disabled = \lsx_health_plan\functions\get_option('disable_height_checkbox', false); |
|
| 233 | + $is_waist_disabled = \lsx_health_plan\functions\get_option('disable_waist_checkbox', false); |
|
| 234 | + $is_bmi_disabled = \lsx_health_plan\functions\get_option('disable_bmi_checkbox', false); |
|
| 235 | 235 | |
| 236 | - $weight = get_user_meta( get_current_user_id(), 'weight', true ); |
|
| 237 | - $waist = get_user_meta( get_current_user_id(), 'waist', true ); |
|
| 238 | - $height = get_user_meta( get_current_user_id(), 'height', true ); |
|
| 236 | + $weight = get_user_meta(get_current_user_id(), 'weight', true); |
|
| 237 | + $waist = get_user_meta(get_current_user_id(), 'waist', true); |
|
| 238 | + $height = get_user_meta(get_current_user_id(), 'height', true); |
|
| 239 | 239 | |
| 240 | 240 | $height_m = 0; |
| 241 | - if ( is_numeric( $height ) ) { |
|
| 241 | + if (is_numeric($height)) { |
|
| 242 | 242 | $height_m = $height / 100; |
| 243 | 243 | } |
| 244 | 244 | |
| 245 | - if ( 1 < $weight && 1 < $height_m ) { |
|
| 246 | - $bmi = $weight / ( $height_m * $height_m ); |
|
| 247 | - $bmi = number_format( $bmi, 1 ); |
|
| 245 | + if (1 < $weight && 1 < $height_m) { |
|
| 246 | + $bmi = $weight / ($height_m * $height_m); |
|
| 247 | + $bmi = number_format($bmi, 1); |
|
| 248 | 248 | } else { |
| 249 | - $bmi = __( 'Add more data', 'lsx-health-plan' ); |
|
| 249 | + $bmi = __('Add more data', 'lsx-health-plan'); |
|
| 250 | 250 | } |
| 251 | 251 | |
| 252 | 252 | ?> |
| 253 | 253 | |
| 254 | 254 | <div> |
| 255 | - <?php if ( 'on' !== $is_weight_disabled ) { ?> |
|
| 256 | - <span><strong><?php esc_html_e( 'Weight:', 'lsx-health-plan' ); ?></strong> |
|
| 255 | + <?php if ('on' !== $is_weight_disabled) { ?> |
|
| 256 | + <span><strong><?php esc_html_e('Weight:', 'lsx-health-plan'); ?></strong> |
|
| 257 | 257 | <?php |
| 258 | - if ( '' !== $weight ) { |
|
| 259 | - echo wp_kses_post( $weight . ' kg' ); |
|
| 258 | + if ('' !== $weight) { |
|
| 259 | + echo wp_kses_post($weight . ' kg'); |
|
| 260 | 260 | } else { |
| 261 | 261 | echo '/'; |
| 262 | 262 | } |
| 263 | 263 | ?> |
| 264 | 264 | </span> |
| 265 | 265 | <?php } |
| 266 | - if ( 'on' !== $is_waist_disabled ) { |
|
| 266 | + if ('on' !== $is_waist_disabled) { |
|
| 267 | 267 | ?> |
| 268 | - <span><strong><?php esc_html_e( 'Waist:', 'lsx-health-plan' ); ?></strong> |
|
| 268 | + <span><strong><?php esc_html_e('Waist:', 'lsx-health-plan'); ?></strong> |
|
| 269 | 269 | <?php |
| 270 | - if ( '' !== $waist ) { |
|
| 271 | - echo wp_kses_post( $waist . ' cm' ); |
|
| 270 | + if ('' !== $waist) { |
|
| 271 | + echo wp_kses_post($waist . ' cm'); |
|
| 272 | 272 | } else { |
| 273 | 273 | echo '/'; |
| 274 | 274 | } |
| 275 | 275 | ?> |
| 276 | 276 | </span> |
| 277 | 277 | <?php } |
| 278 | - if ( 'on' !== $is_bmi_disabled ) { |
|
| 278 | + if ('on' !== $is_bmi_disabled) { |
|
| 279 | 279 | ?> |
| 280 | - <span><strong><?php esc_html_e( 'BMI:', 'lsx-health-plan' ); ?></strong> |
|
| 280 | + <span><strong><?php esc_html_e('BMI:', 'lsx-health-plan'); ?></strong> |
|
| 281 | 281 | <?php |
| 282 | - if ( '' !== $bmi ) { |
|
| 283 | - echo wp_kses_post( $bmi ); |
|
| 282 | + if ('' !== $bmi) { |
|
| 283 | + echo wp_kses_post($bmi); |
|
| 284 | 284 | } else { |
| 285 | 285 | echo '/'; |
| 286 | 286 | } |
@@ -292,17 +292,17 @@ discard block |
||
| 292 | 292 | } |
| 293 | 293 | |
| 294 | 294 | // Only display the edit account link if woocommerce is active. |
| 295 | - if ( function_exists( 'WC' ) ) { |
|
| 295 | + if (function_exists('WC')) { |
|
| 296 | 296 | ?> |
| 297 | 297 | <div class="edit-profile"> |
| 298 | 298 | <?php |
| 299 | - if ( function_exists( 'wc_get_page_id' ) ) { |
|
| 300 | - $url_id = wc_get_page_id( 'myaccount' ); |
|
| 299 | + if (function_exists('wc_get_page_id')) { |
|
| 300 | + $url_id = wc_get_page_id('myaccount'); |
|
| 301 | 301 | } else { |
| 302 | 302 | $url_id = ''; |
| 303 | 303 | } |
| 304 | 304 | ?> |
| 305 | - <a href="<?php echo esc_url( get_permalink( $url_id ) ); ?>edit-account/"><?php esc_html_e( 'Edit', 'lsx-health-plan' ); ?></a> |
|
| 305 | + <a href="<?php echo esc_url(get_permalink($url_id)); ?>edit-account/"><?php esc_html_e('Edit', 'lsx-health-plan'); ?></a> |
|
| 306 | 306 | </div> |
| 307 | 307 | <?php |
| 308 | 308 | } |
@@ -332,9 +332,9 @@ discard block |
||
| 332 | 332 | 'post_parent' => 0, |
| 333 | 333 | ); |
| 334 | 334 | |
| 335 | - if ( function_exists( '\lsx_health_plan\functions\woocommerce\get_membership_products' ) ) { |
|
| 335 | + if (function_exists('\lsx_health_plan\functions\woocommerce\get_membership_products')) { |
|
| 336 | 336 | $product_ids = \lsx_health_plan\functions\woocommerce\get_membership_products(); |
| 337 | - if ( ! empty( $product_ids ) ) { |
|
| 337 | + if ( ! empty($product_ids)) { |
|
| 338 | 338 | $args['meta_query'] = array( |
| 339 | 339 | 'relation' => 'OR', |
| 340 | 340 | array( |
@@ -350,82 +350,82 @@ discard block |
||
| 350 | 350 | } |
| 351 | 351 | } |
| 352 | 352 | |
| 353 | - $the_query = new WP_Query( $args ); |
|
| 353 | + $the_query = new WP_Query($args); |
|
| 354 | 354 | ?> |
| 355 | 355 | <div class="all-plans-block plan-grid block-all-plans-block"> |
| 356 | 356 | <div class="row"> |
| 357 | 357 | <?php |
| 358 | - if ( $the_query->have_posts() ) : |
|
| 359 | - while ( $the_query->have_posts() ) : |
|
| 358 | + if ($the_query->have_posts()) : |
|
| 359 | + while ($the_query->have_posts()) : |
|
| 360 | 360 | $the_query->the_post(); |
| 361 | 361 | lsx_entry_before(); |
| 362 | 362 | $completed_class = ''; |
| 363 | 363 | $linked_product = false; |
| 364 | 364 | $restricted = false; |
| 365 | 365 | $product = null; |
| 366 | - if ( function_exists( 'lsx_health_plan\functions\woocommerce\plan_has_products' ) && \lsx_health_plan\functions\woocommerce\plan_has_products() ) { |
|
| 366 | + if (function_exists('lsx_health_plan\functions\woocommerce\plan_has_products') && \lsx_health_plan\functions\woocommerce\plan_has_products()) { |
|
| 367 | 367 | $products = \lsx_health_plan\functions\woocommerce\get_plan_products(); |
| 368 | - $linked_product = wc_get_product( $products[0] ); |
|
| 368 | + $linked_product = wc_get_product($products[0]); |
|
| 369 | 369 | $product = $linked_product; |
| 370 | 370 | } |
| 371 | - if ( function_exists( 'wc_memberships_is_post_content_restricted' ) ) { |
|
| 372 | - $restricted = wc_memberships_is_post_content_restricted( get_the_ID() ) && ! current_user_can( 'wc_memberships_view_restricted_post_content', get_the_ID() ); |
|
| 371 | + if (function_exists('wc_memberships_is_post_content_restricted')) { |
|
| 372 | + $restricted = wc_memberships_is_post_content_restricted(get_the_ID()) && ! current_user_can('wc_memberships_view_restricted_post_content', get_the_ID()); |
|
| 373 | 373 | } |
| 374 | 374 | |
| 375 | - if ( lsx_health_plan_is_plan_complete() ) { |
|
| 375 | + if (lsx_health_plan_is_plan_complete()) { |
|
| 376 | 376 | $completed_class = 'completed'; |
| 377 | 377 | } |
| 378 | 378 | $round_progress = ''; |
| 379 | 379 | $completed_progress = '100'; |
| 380 | - if ( false === $restricted ) { |
|
| 381 | - $round_progress = round( \lsx_health_plan\functions\get_progress( get_the_ID() ), 0 ); |
|
| 380 | + if (false === $restricted) { |
|
| 381 | + $round_progress = round(\lsx_health_plan\functions\get_progress(get_the_ID()), 0); |
|
| 382 | 382 | } |
| 383 | 383 | ?> |
| 384 | 384 | <div class="col-xs-12 col-sm-6 col-md-4"> |
| 385 | - <article class="lsx-slot lsx-hp-shadow <?php echo esc_html( 'progress-') . $round_progress; ?>"> |
|
| 385 | + <article class="lsx-slot lsx-hp-shadow <?php echo esc_html('progress-') . $round_progress; ?>"> |
|
| 386 | 386 | <div class="plan-feature-img"> |
| 387 | - <?php if ( (int)$completed_progress === (int)$round_progress ) { ?> |
|
| 388 | - <span class="featured-plan"><?php lsx_get_svg_icon( 'icon-completed.svg' ); ?></span> |
|
| 387 | + <?php if ((int) $completed_progress === (int) $round_progress) { ?> |
|
| 388 | + <span class="featured-plan"><?php lsx_get_svg_icon('icon-completed.svg'); ?></span> |
|
| 389 | 389 | <?php } ?> |
| 390 | - <a href="<?php echo esc_url( get_permalink() ); ?>"> |
|
| 390 | + <a href="<?php echo esc_url(get_permalink()); ?>"> |
|
| 391 | 391 | <?php |
| 392 | 392 | $featured_image = get_the_post_thumbnail(); |
| 393 | - if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
| 394 | - the_post_thumbnail( 'lsx-thumbnail', array( |
|
| 393 | + if ( ! empty($featured_image) && '' !== $featured_image) { |
|
| 394 | + the_post_thumbnail('lsx-thumbnail', array( |
|
| 395 | 395 | 'class' => 'aligncenter', |
| 396 | - ) ); |
|
| 396 | + )); |
|
| 397 | 397 | } else { |
| 398 | 398 | ?> |
| 399 | - <img loading="lazy" class="placeholder" src="<?php echo esc_attr( plugin_dir_url( __FILE__ ) . '../assets/images/placeholder.jpg' ); ?>"> |
|
| 399 | + <img loading="lazy" class="placeholder" src="<?php echo esc_attr(plugin_dir_url(__FILE__) . '../assets/images/placeholder.jpg'); ?>"> |
|
| 400 | 400 | <?php |
| 401 | 401 | } |
| 402 | 402 | ?> |
| 403 | 403 | </a> |
| 404 | 404 | </div> |
| 405 | 405 | <div class="content-box plan-content-box"> |
| 406 | - <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> |
|
| 406 | + <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> |
|
| 407 | 407 | <?php |
| 408 | - echo wp_kses_post( \lsx_health_plan\functions\hp_get_plan_type_meta( $post ) ); |
|
| 408 | + echo wp_kses_post(\lsx_health_plan\functions\hp_get_plan_type_meta($post)); |
|
| 409 | 409 | ?> |
| 410 | 410 | <?php |
| 411 | - if ( false !== $linked_product && false !== $restricted ) { |
|
| 412 | - echo wp_kses_post( $linked_product->get_price_html() ); |
|
| 411 | + if (false !== $linked_product && false !== $restricted) { |
|
| 412 | + echo wp_kses_post($linked_product->get_price_html()); |
|
| 413 | 413 | } |
| 414 | 414 | ?> |
| 415 | 415 | <div class="excerpt"> |
| 416 | 416 | <?php |
| 417 | - if ( ! has_excerpt() ) { |
|
| 418 | - $content = wp_trim_words( get_the_content(), 20 ); |
|
| 417 | + if ( ! has_excerpt()) { |
|
| 418 | + $content = wp_trim_words(get_the_content(), 20); |
|
| 419 | 419 | $content = '<p>' . $content . '</pre>'; |
| 420 | 420 | } else { |
| 421 | - $content = apply_filters( 'the_excerpt', get_the_excerpt() ); |
|
| 421 | + $content = apply_filters('the_excerpt', get_the_excerpt()); |
|
| 422 | 422 | } |
| 423 | - echo wp_kses_post( $content ); |
|
| 423 | + echo wp_kses_post($content); |
|
| 424 | 424 | ?> |
| 425 | 425 | </div> |
| 426 | 426 | <?php |
| 427 | - if ( false === $restricted ) { |
|
| 428 | - 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>' ); |
|
| 427 | + if (false === $restricted) { |
|
| 428 | + 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 | 429 | } |
| 430 | 430 | ?> |
| 431 | 431 | </div> |
@@ -445,30 +445,30 @@ discard block |
||
| 445 | 445 | * |
| 446 | 446 | * @return void |
| 447 | 447 | */ |
| 448 | -function lsx_health_plan_day_plan_block( $args = array() ) { |
|
| 448 | +function lsx_health_plan_day_plan_block($args = array()) { |
|
| 449 | 449 | $defaults = array( |
| 450 | 450 | 'plan' => '', |
| 451 | 451 | ); |
| 452 | - $args = wp_parse_args( $args, $defaults ); |
|
| 452 | + $args = wp_parse_args($args, $defaults); |
|
| 453 | 453 | |
| 454 | - if ( isset( $args['plan'] ) && '' !== $args['plan'] && \lsx_health_plan\functions\plan\has_sections( $args['plan'] ) ) { |
|
| 454 | + if (isset($args['plan']) && '' !== $args['plan'] && \lsx_health_plan\functions\plan\has_sections($args['plan'])) { |
|
| 455 | 455 | $sections = \lsx_health_plan\functions\plan\get_sections(); |
| 456 | 456 | ?> |
| 457 | 457 | <div class="daily-plan-block day-grid"> |
| 458 | 458 | <?php |
| 459 | - foreach ( $sections as $section_key => $section_values ) { |
|
| 460 | - $defaults = array( |
|
| 461 | - 'title' => __( 'Day', 'lsx-health-plan' ) . ' ' . ( $section_key + 1 ), |
|
| 459 | + foreach ($sections as $section_key => $section_values) { |
|
| 460 | + $defaults = array( |
|
| 461 | + 'title' => __('Day', 'lsx-health-plan') . ' ' . ($section_key + 1), |
|
| 462 | 462 | ); |
| 463 | - $section_args = wp_parse_args( $section_values, $defaults ); |
|
| 463 | + $section_args = wp_parse_args($section_values, $defaults); |
|
| 464 | 464 | |
| 465 | 465 | $completed_class = ''; |
| 466 | - if ( lsx_health_plan_is_day_complete() ) { |
|
| 466 | + if (lsx_health_plan_is_day_complete()) { |
|
| 467 | 467 | $completed_class = 'completed'; |
| 468 | 468 | } |
| 469 | 469 | ?> |
| 470 | - <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 ); ?>"> |
|
| 471 | - <div class="plan-content"><?php echo esc_attr( $section_args['title'] ); ?></div> |
|
| 470 | + <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); ?>"> |
|
| 471 | + <div class="plan-content"><?php echo esc_attr($section_args['title']); ?></div> |
|
| 472 | 472 | </a> |
| 473 | 473 | <?php |
| 474 | 474 | } |
@@ -484,31 +484,31 @@ discard block |
||
| 484 | 484 | * @param array $args An array of arguments. |
| 485 | 485 | * @return void |
| 486 | 486 | */ |
| 487 | -function lsx_health_plan_week_plan_block( $args = array() ) { |
|
| 487 | +function lsx_health_plan_week_plan_block($args = array()) { |
|
| 488 | 488 | $defaults = array( |
| 489 | 489 | 'show_downloads' => false, |
| 490 | 490 | 'plan' => '', |
| 491 | 491 | ); |
| 492 | - $args = wp_parse_args( $args, $defaults ); |
|
| 492 | + $args = wp_parse_args($args, $defaults); |
|
| 493 | 493 | |
| 494 | - if ( isset( $args['plan'] ) && '' !== $args['plan'] && \lsx_health_plan\functions\plan\has_sections( $args['plan'] ) ) { |
|
| 495 | - $groups = \lsx_health_plan\functions\plan\get_sections( true ); |
|
| 494 | + if (isset($args['plan']) && '' !== $args['plan'] && \lsx_health_plan\functions\plan\has_sections($args['plan'])) { |
|
| 495 | + $groups = \lsx_health_plan\functions\plan\get_sections(true); |
|
| 496 | 496 | |
| 497 | - if ( ! empty( $groups ) ) { |
|
| 497 | + if ( ! empty($groups)) { |
|
| 498 | 498 | $counter = 1; |
| 499 | 499 | $group_open = false; |
| 500 | 500 | |
| 501 | - foreach ( $groups as $group_key => $sections ) { |
|
| 501 | + foreach ($groups as $group_key => $sections) { |
|
| 502 | 502 | $collapse_class = ''; |
| 503 | - $group_title = \lsx_health_plan\functions\plan\get_group_title( $sections ); |
|
| 503 | + $group_title = \lsx_health_plan\functions\plan\get_group_title($sections); |
|
| 504 | 504 | |
| 505 | 505 | // Determine if the current week is complete. |
| 506 | - $day_ids = wp_list_pluck( $sections, 'title' ); |
|
| 507 | - if ( false === $group_open ) { |
|
| 508 | - if ( 1 === $counter && ! \lsx_health_plan\functions\is_week_complete( false, $day_ids, $group_title ) ) { |
|
| 506 | + $day_ids = wp_list_pluck($sections, 'title'); |
|
| 507 | + if (false === $group_open) { |
|
| 508 | + if (1 === $counter && ! \lsx_health_plan\functions\is_week_complete(false, $day_ids, $group_title)) { |
|
| 509 | 509 | $collapse_class = 'in'; |
| 510 | 510 | $group_open = true; |
| 511 | - } elseif ( ! \lsx_health_plan\functions\is_week_complete( false, $day_ids, $group_title ) ) { |
|
| 511 | + } elseif ( ! \lsx_health_plan\functions\is_week_complete(false, $day_ids, $group_title)) { |
|
| 512 | 512 | $collapse_class = 'in'; |
| 513 | 513 | $group_open = true; |
| 514 | 514 | } |
@@ -516,47 +516,47 @@ discard block |
||
| 516 | 516 | |
| 517 | 517 | // Determine if there are any weekly downloads. |
| 518 | 518 | $week_downloads_view = ''; |
| 519 | - if ( isset( $args['show_downloads'] ) && false !== $args['show_downloads'] ) { |
|
| 520 | - $weekly_downloads = \lsx_health_plan\functions\get_weekly_downloads( $group_key ); |
|
| 521 | - if ( ! empty( $weekly_downloads ) ) { |
|
| 519 | + if (isset($args['show_downloads']) && false !== $args['show_downloads']) { |
|
| 520 | + $weekly_downloads = \lsx_health_plan\functions\get_weekly_downloads($group_key); |
|
| 521 | + if ( ! empty($weekly_downloads)) { |
|
| 522 | 522 | $week_downloads_view = 'week-downloads-view-on'; |
| 523 | 523 | } |
| 524 | 524 | } |
| 525 | 525 | ?> |
| 526 | 526 | <div class="daily-plan-block week-grid"> |
| 527 | - <a href="#group-<?php echo esc_attr( $group_key ); ?>" data-toggle="collapse" class="week-title"><?php echo esc_attr( $group_title ); ?></a> |
|
| 528 | - <div id="group-<?php echo esc_attr( $group_key ); ?>" class="week-row collapse <?php echo esc_attr( $collapse_class ); ?>"> |
|
| 529 | - <div class="week-row-inner <?php echo esc_html( $week_downloads_view ); ?>"> |
|
| 527 | + <a href="#group-<?php echo esc_attr($group_key); ?>" data-toggle="collapse" class="week-title"><?php echo esc_attr($group_title); ?></a> |
|
| 528 | + <div id="group-<?php echo esc_attr($group_key); ?>" class="week-row collapse <?php echo esc_attr($collapse_class); ?>"> |
|
| 529 | + <div class="week-row-inner <?php echo esc_html($week_downloads_view); ?>"> |
|
| 530 | 530 | <div class="week-meals-recipes-box"> |
| 531 | 531 | |
| 532 | - <?php if ( ! empty( $week_downloads_view ) ) { ?> |
|
| 533 | - <h3 class="title"><?php lsx_get_svg_icon( 'daily-plan.svg' ); ?><?php echo esc_html_e( 'Plan', 'lsx-health-plan' ); ?></h3> |
|
| 532 | + <?php if ( ! empty($week_downloads_view)) { ?> |
|
| 533 | + <h3 class="title"><?php lsx_get_svg_icon('daily-plan.svg'); ?><?php echo esc_html_e('Plan', 'lsx-health-plan'); ?></h3> |
|
| 534 | 534 | <?php } ?> |
| 535 | 535 | |
| 536 | 536 | <div class="week-meals-recipes-box-inner"> |
| 537 | 537 | <?php |
| 538 | 538 | |
| 539 | - foreach ( $sections as $section_key => $section_values ) { |
|
| 539 | + foreach ($sections as $section_key => $section_values) { |
|
| 540 | 540 | |
| 541 | - $defaults = array( |
|
| 542 | - 'title' => __( 'Day', 'lsx-health-plan' ) . ' ' . ( $section_key + 1 ), |
|
| 541 | + $defaults = array( |
|
| 542 | + 'title' => __('Day', 'lsx-health-plan') . ' ' . ($section_key + 1), |
|
| 543 | 543 | ); |
| 544 | - $section_args = wp_parse_args( $section_values, $defaults ); |
|
| 544 | + $section_args = wp_parse_args($section_values, $defaults); |
|
| 545 | 545 | |
| 546 | 546 | $completed_class = ''; |
| 547 | - if ( lsx_health_plan_is_day_complete( $args['plan'], $section_args['title'] ) ) { |
|
| 547 | + if (lsx_health_plan_is_day_complete($args['plan'], $section_args['title'])) { |
|
| 548 | 548 | $completed_class = 'completed'; |
| 549 | 549 | } |
| 550 | - if ( $section_args['rest_day_enabled'] && ! $section_args['connected_meals'] ) { |
|
| 550 | + if ($section_args['rest_day_enabled'] && ! $section_args['connected_meals']) { |
|
| 551 | 551 | ?> |
| 552 | - <span class="day id-<?php echo esc_attr( $section_key + 1 ); ?> <?php echo esc_attr( $completed_class ); ?>"> |
|
| 553 | - <div class="plan-content"><?php echo esc_attr( $section_args['title'] ); ?></div> |
|
| 552 | + <span class="day id-<?php echo esc_attr($section_key + 1); ?> <?php echo esc_attr($completed_class); ?>"> |
|
| 553 | + <div class="plan-content"><?php echo esc_attr($section_args['title']); ?></div> |
|
| 554 | 554 | </span> |
| 555 | 555 | <?php |
| 556 | 556 | } else { |
| 557 | 557 | ?> |
| 558 | - <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 ); ?>"> |
|
| 559 | - <div class="plan-content"><?php echo esc_attr( $section_args['title'] ); ?></div> |
|
| 558 | + <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); ?>"> |
|
| 559 | + <div class="plan-content"><?php echo esc_attr($section_args['title']); ?></div> |
|
| 560 | 560 | </a> |
| 561 | 561 | <?php |
| 562 | 562 | } |
@@ -565,8 +565,8 @@ discard block |
||
| 565 | 565 | </div> |
| 566 | 566 | </div> |
| 567 | 567 | <?php |
| 568 | - if ( ! empty( $week_downloads_view ) ) { |
|
| 569 | - lsx_health_plan_weekly_downloads( $weekly_downloads ); |
|
| 568 | + if ( ! empty($week_downloads_view)) { |
|
| 569 | + lsx_health_plan_weekly_downloads($weekly_downloads); |
|
| 570 | 570 | } |
| 571 | 571 | ?> |
| 572 | 572 | </div> |
@@ -584,16 +584,16 @@ discard block |
||
| 584 | 584 | * @param array $weekly_downloads An array of the download ids. |
| 585 | 585 | * @return void |
| 586 | 586 | */ |
| 587 | -function lsx_health_plan_weekly_downloads( $weekly_downloads = array() ) { |
|
| 588 | - if ( ! empty( $weekly_downloads ) ) { |
|
| 587 | +function lsx_health_plan_weekly_downloads($weekly_downloads = array()) { |
|
| 588 | + if ( ! empty($weekly_downloads)) { |
|
| 589 | 589 | ?> |
| 590 | 590 | <div class="week-download-box"> |
| 591 | - <h3 class="title"><?php lsx_get_svg_icon( 'download.svg' ); ?><?php echo esc_html_e( 'Downloads', 'lsx-health-plan' ); ?></h3> |
|
| 591 | + <h3 class="title"><?php lsx_get_svg_icon('download.svg'); ?><?php echo esc_html_e('Downloads', 'lsx-health-plan'); ?></h3> |
|
| 592 | 592 | <ul class="week-download-box-list"> |
| 593 | 593 | <?php |
| 594 | - foreach ( $weekly_downloads as $weekly_download ) { |
|
| 594 | + foreach ($weekly_downloads as $weekly_download) { |
|
| 595 | 595 | ?> |
| 596 | - <li><?php echo wp_kses_post( do_shortcode( '[download id="' . $weekly_download . '"]' ) ); ?></li> |
|
| 596 | + <li><?php echo wp_kses_post(do_shortcode('[download id="' . $weekly_download . '"]')); ?></li> |
|
| 597 | 597 | <?php |
| 598 | 598 | } |
| 599 | 599 | ?> |
@@ -608,7 +608,7 @@ discard block |
||
| 608 | 608 | * |
| 609 | 609 | * @return void |
| 610 | 610 | */ |
| 611 | -function lsx_health_plan_items( $args = array() ) { |
|
| 611 | +function lsx_health_plan_items($args = array()) { |
|
| 612 | 612 | global $shortcode_args; |
| 613 | 613 | $shortcode_args = $args; |
| 614 | 614 | include LSX_HEALTH_PLAN_PATH . '/templates/partials/shortcode-loop.php'; |
@@ -620,7 +620,7 @@ discard block |
||
| 620 | 620 | * @return void |
| 621 | 621 | */ |
| 622 | 622 | function lsx_health_plan_featured_video_block() { |
| 623 | - if ( ! post_type_exists( 'video' ) ) { |
|
| 623 | + if ( ! post_type_exists('video')) { |
|
| 624 | 624 | return; |
| 625 | 625 | } |
| 626 | 626 | include LSX_HEALTH_PLAN_PATH . '/templates/featured-videos.php'; |
@@ -632,7 +632,7 @@ discard block |
||
| 632 | 632 | * @return void |
| 633 | 633 | */ |
| 634 | 634 | function lsx_health_plan_featured_recipes_block() { |
| 635 | - if ( ! post_type_exists( 'recipe' ) ) { |
|
| 635 | + if ( ! post_type_exists('recipe')) { |
|
| 636 | 636 | return; |
| 637 | 637 | } |
| 638 | 638 | include LSX_HEALTH_PLAN_PATH . '/templates/featured-recipes.php'; |
@@ -654,7 +654,7 @@ discard block |
||
| 654 | 654 | * @return void |
| 655 | 655 | */ |
| 656 | 656 | function lsx_health_plan_day_button() { |
| 657 | - if ( lsx_health_plan_is_day_complete() ) { |
|
| 657 | + if (lsx_health_plan_is_day_complete()) { |
|
| 658 | 658 | lsx_health_plan_unlock_button(); |
| 659 | 659 | } else { |
| 660 | 660 | lsx_health_plan_complete_button(); |
@@ -670,9 +670,9 @@ discard block |
||
| 670 | 670 | ?> |
| 671 | 671 | <div class="single-plan-inner-buttons"> |
| 672 | 672 | <form action="<?php the_permalink(); ?>" method="post" class="form-complete-day complete-plan-btn"> |
| 673 | - <?php wp_nonce_field( 'complete', 'lsx-health-plan-actions' ); ?> |
|
| 674 | - <input type="hidden" name="lsx-health-plan-id" value="<?php echo esc_attr( \lsx_health_plan\functions\plan\generate_section_id() ); ?>" /> |
|
| 675 | - <button class="btn cta-btn" type="submit"><?php esc_html_e( 'Complete Day', 'lsx-health-plan' ); ?></button> |
|
| 673 | + <?php wp_nonce_field('complete', 'lsx-health-plan-actions'); ?> |
|
| 674 | + <input type="hidden" name="lsx-health-plan-id" value="<?php echo esc_attr(\lsx_health_plan\functions\plan\generate_section_id()); ?>" /> |
|
| 675 | + <button class="btn cta-btn" type="submit"><?php esc_html_e('Complete Day', 'lsx-health-plan'); ?></button> |
|
| 676 | 676 | </form> |
| 677 | 677 | <?php lsx_health_plan_back_to_plan_button(); ?> |
| 678 | 678 | </div> |
@@ -688,9 +688,9 @@ discard block |
||
| 688 | 688 | ?> |
| 689 | 689 | <div class="single-plan-inner-buttons"> |
| 690 | 690 | <form action="<?php the_permalink(); ?>" method="post" class="form-complete-day complete-plan-btn"> |
| 691 | - <?php wp_nonce_field( 'unlock', 'lsx-health-plan-actions' ); ?> |
|
| 692 | - <input type="hidden" name="lsx-health-plan-id" value="<?php echo esc_attr( \lsx_health_plan\functions\plan\generate_section_id() ); ?>" /> |
|
| 693 | - <button class="btn secondary-btn" type="submit"><?php esc_html_e( 'Im not done!', 'lsx-health-plan' ); ?></button> |
|
| 691 | + <?php wp_nonce_field('unlock', 'lsx-health-plan-actions'); ?> |
|
| 692 | + <input type="hidden" name="lsx-health-plan-id" value="<?php echo esc_attr(\lsx_health_plan\functions\plan\generate_section_id()); ?>" /> |
|
| 693 | + <button class="btn secondary-btn" type="submit"><?php esc_html_e('Im not done!', 'lsx-health-plan'); ?></button> |
|
| 694 | 694 | </form> |
| 695 | 695 | <?php lsx_health_plan_back_to_plan_button(); ?> |
| 696 | 696 | </div> |
@@ -704,8 +704,8 @@ discard block |
||
| 704 | 704 | * @return void |
| 705 | 705 | */ |
| 706 | 706 | function lsx_health_plan_single_nav() { |
| 707 | - $tab_template_path = apply_filters( 'lsx_health_plan_single_nav_path', LSX_HEALTH_PLAN_PATH . '/templates/single-plan-tabs.php' ); |
|
| 708 | - if ( '' !== $tab_template_path ) { |
|
| 707 | + $tab_template_path = apply_filters('lsx_health_plan_single_nav_path', LSX_HEALTH_PLAN_PATH . '/templates/single-plan-tabs.php'); |
|
| 708 | + if ('' !== $tab_template_path) { |
|
| 709 | 709 | require $tab_template_path; |
| 710 | 710 | } |
| 711 | 711 | } |
@@ -717,8 +717,8 @@ discard block |
||
| 717 | 717 | * @return void |
| 718 | 718 | */ |
| 719 | 719 | function lsx_health_plan_single_tabs() { |
| 720 | - $endpoint = get_query_var( 'endpoint' ); |
|
| 721 | - switch ( $endpoint ) { |
|
| 720 | + $endpoint = get_query_var('endpoint'); |
|
| 721 | + switch ($endpoint) { |
|
| 722 | 722 | case 'meal': |
| 723 | 723 | $tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-meal.php'; |
| 724 | 724 | break; |
@@ -739,8 +739,8 @@ discard block |
||
| 739 | 739 | $tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-plan.php'; |
| 740 | 740 | break; |
| 741 | 741 | } |
| 742 | - $tab_template_path = apply_filters( 'lsx_health_plan_single_tab_path', $tab_template_path ); |
|
| 743 | - if ( '' !== $tab_template_path ) { |
|
| 742 | + $tab_template_path = apply_filters('lsx_health_plan_single_tab_path', $tab_template_path); |
|
| 743 | + if ('' !== $tab_template_path) { |
|
| 744 | 744 | include $tab_template_path; |
| 745 | 745 | } |
| 746 | 746 | } |
@@ -760,9 +760,9 @@ discard block |
||
| 760 | 760 | * @return recipe_type |
| 761 | 761 | */ |
| 762 | 762 | function lsx_health_plan_recipe_type() { |
| 763 | - $term_obj_list = get_the_terms( get_the_ID(), 'recipe-type' ); |
|
| 763 | + $term_obj_list = get_the_terms(get_the_ID(), 'recipe-type'); |
|
| 764 | 764 | $recipe_type = $term_obj_list[0]->name; |
| 765 | - if ( ! empty( $recipe_type ) ) { |
|
| 765 | + if ( ! empty($recipe_type)) { |
|
| 766 | 766 | return $recipe_type; |
| 767 | 767 | } |
| 768 | 768 | } |
@@ -774,32 +774,32 @@ discard block |
||
| 774 | 774 | * @param array $group |
| 775 | 775 | * @return void |
| 776 | 776 | */ |
| 777 | -function lsx_health_plan_workout_video_play_button( $m, $group, $echo = true ) { |
|
| 777 | +function lsx_health_plan_workout_video_play_button($m, $group, $echo = true) { |
|
| 778 | 778 | $workout_video = ''; |
| 779 | 779 | $giphy = ''; |
| 780 | 780 | $youtube = ''; |
| 781 | - if ( isset( $group['connected_videos'] ) && '' !== $group['connected_videos'] ) { |
|
| 782 | - $workout_video = esc_html( $group['connected_videos'] ); |
|
| 783 | - $giphy = get_post_meta( $workout_video, 'video_giphy_source', true ); |
|
| 784 | - $youtube = esc_url( get_post_meta( $workout_video, 'video_youtube_source', 1 ) ); |
|
| 785 | - $content = get_post_field( 'post_content', $workout_video ); |
|
| 781 | + if (isset($group['connected_videos']) && '' !== $group['connected_videos']) { |
|
| 782 | + $workout_video = esc_html($group['connected_videos']); |
|
| 783 | + $giphy = get_post_meta($workout_video, 'video_giphy_source', true); |
|
| 784 | + $youtube = esc_url(get_post_meta($workout_video, 'video_youtube_source', 1)); |
|
| 785 | + $content = get_post_field('post_content', $workout_video); |
|
| 786 | 786 | $play_button = '<button data-toggle="modal" data-target="#workout-video-modal-' . $m . '"><span class="fa fa-play-circle"></span></button>'; |
| 787 | 787 | |
| 788 | 788 | $modal_body = ''; |
| 789 | - if ( ! empty( $giphy ) ) { |
|
| 790 | - $giphy = \lsx_health_plan\functions\get_video_url( $giphy ); |
|
| 789 | + if ( ! empty($giphy)) { |
|
| 790 | + $giphy = \lsx_health_plan\functions\get_video_url($giphy); |
|
| 791 | 791 | $modal_body = $giphy; // WPCS: XSS OK. |
| 792 | - } elseif ( ! empty( $youtube ) ) { |
|
| 793 | - $modal_body = wp_oembed_get( $youtube, array( // WPCS: XSS OK. |
|
| 792 | + } elseif ( ! empty($youtube)) { |
|
| 793 | + $modal_body = wp_oembed_get($youtube, array( // WPCS: XSS OK. |
|
| 794 | 794 | 'width' => 480, |
| 795 | - ) ); |
|
| 795 | + )); |
|
| 796 | 796 | } |
| 797 | 797 | $modal_body .= '<h5 class="modal-title title-lined">' . $group['name'] . '</h5>'; |
| 798 | 798 | $modal_body .= $content; |
| 799 | - \lsx_health_plan\functions\register_modal( 'workout-video-modal-' . $m, '', $modal_body ); |
|
| 799 | + \lsx_health_plan\functions\register_modal('workout-video-modal-' . $m, '', $modal_body); |
|
| 800 | 800 | |
| 801 | - if ( true === $echo ) { |
|
| 802 | - echo wp_kses_post( $play_button ); |
|
| 801 | + if (true === $echo) { |
|
| 802 | + echo wp_kses_post($play_button); |
|
| 803 | 803 | } else { |
| 804 | 804 | return $play_button; |
| 805 | 805 | } |
@@ -813,17 +813,17 @@ discard block |
||
| 813 | 813 | */ |
| 814 | 814 | function lsx_health_plan_recipe_archive_description() { |
| 815 | 815 | $description = ''; |
| 816 | - if ( is_post_type_archive( 'recipe' ) ) { |
|
| 817 | - $description = \lsx_health_plan\functions\get_option( 'recipe_archive_description', '' ); |
|
| 818 | - } elseif ( is_post_type_archive( 'exercise' ) ) { |
|
| 819 | - $description = \lsx_health_plan\functions\get_option( 'exercise_archive_description', '' ); |
|
| 820 | - } elseif ( is_tax() ) { |
|
| 816 | + if (is_post_type_archive('recipe')) { |
|
| 817 | + $description = \lsx_health_plan\functions\get_option('recipe_archive_description', ''); |
|
| 818 | + } elseif (is_post_type_archive('exercise')) { |
|
| 819 | + $description = \lsx_health_plan\functions\get_option('exercise_archive_description', ''); |
|
| 820 | + } elseif (is_tax()) { |
|
| 821 | 821 | $description = get_the_archive_description(); |
| 822 | 822 | } |
| 823 | - if ( '' !== $description ) { |
|
| 823 | + if ('' !== $description) { |
|
| 824 | 824 | ?> |
| 825 | 825 | <div class="lsx-hp-archive-description row"> |
| 826 | - <div class="col-xs-12 description-wrapper"><?php echo wp_kses_post( wpautop( $description ) ); ?></div> |
|
| 826 | + <div class="col-xs-12 description-wrapper"><?php echo wp_kses_post(wpautop($description)); ?></div> |
|
| 827 | 827 | </div> |
| 828 | 828 | <?php |
| 829 | 829 | } |
@@ -836,19 +836,19 @@ discard block |
||
| 836 | 836 | */ |
| 837 | 837 | function lsx_health_plan_workout_main_content() { |
| 838 | 838 | // Getting translated endpoint. |
| 839 | - $workout = \lsx_health_plan\functions\get_option( 'endpoint_workout', 'workout' ); |
|
| 839 | + $workout = \lsx_health_plan\functions\get_option('endpoint_workout', 'workout'); |
|
| 840 | 840 | |
| 841 | - $connected_members = get_post_meta( get_the_ID(), ( $workout . '_connected_team_member' ), true ); |
|
| 842 | - $small_description = get_post_meta( get_the_ID(), ( $workout . '_short_description' ), true ); |
|
| 841 | + $connected_members = get_post_meta(get_the_ID(), ($workout . '_connected_team_member'), true); |
|
| 842 | + $small_description = get_post_meta(get_the_ID(), ($workout . '_short_description'), true); |
|
| 843 | 843 | |
| 844 | 844 | $content = ''; |
| 845 | - if ( $small_description || $connected_members || lsx_health_plan_has_tips() ) { |
|
| 845 | + if ($small_description || $connected_members || lsx_health_plan_has_tips()) { |
|
| 846 | 846 | $content .= '<div class="short-desc set-box set content-box entry-content">'; |
| 847 | 847 | $content .= '<div class="the-content">'; |
| 848 | - $content .= lsx_hp_member_connected( $connected_members, $workout ); |
|
| 848 | + $content .= lsx_hp_member_connected($connected_members, $workout); |
|
| 849 | 849 | $content .= '<span>' . $small_description . '</span>'; |
| 850 | 850 | $content .= '</div>'; |
| 851 | - $content .= do_shortcode( '[lsx_health_plan_featured_tips_block]' ); |
|
| 851 | + $content .= do_shortcode('[lsx_health_plan_featured_tips_block]'); |
|
| 852 | 852 | $content .= '</div>'; |
| 853 | 853 | } |
| 854 | 854 | return $content; |
@@ -861,19 +861,19 @@ discard block |
||
| 861 | 861 | */ |
| 862 | 862 | function lsx_health_plan_meal_main_content() { |
| 863 | 863 | // Getting translated endpoint. |
| 864 | - $meal = \lsx_health_plan\functions\get_option( 'endpoint_meal', 'meal' ); |
|
| 864 | + $meal = \lsx_health_plan\functions\get_option('endpoint_meal', 'meal'); |
|
| 865 | 865 | |
| 866 | - $connected_members = get_post_meta( get_the_ID(), ( $meal . '_connected_team_member' ), true ); |
|
| 867 | - $small_description = get_post_meta( get_the_ID(), ( $meal . '_short_description' ), true ); |
|
| 866 | + $connected_members = get_post_meta(get_the_ID(), ($meal . '_connected_team_member'), true); |
|
| 867 | + $small_description = get_post_meta(get_the_ID(), ($meal . '_short_description'), true); |
|
| 868 | 868 | |
| 869 | 869 | $content_meal = ''; |
| 870 | - if ( $small_description || $connected_members || lsx_health_plan_has_tips() ) { |
|
| 870 | + if ($small_description || $connected_members || lsx_health_plan_has_tips()) { |
|
| 871 | 871 | $content_meal .= '<div class="set-box set content-box entry-content">'; |
| 872 | 872 | $content_meal .= '<div class="the-content">'; |
| 873 | - $content_meal .= lsx_hp_member_connected( $connected_members, $meal ); |
|
| 873 | + $content_meal .= lsx_hp_member_connected($connected_members, $meal); |
|
| 874 | 874 | $content_meal .= '<span>' . $small_description . '</span>'; |
| 875 | 875 | $content_meal .= '</div>'; |
| 876 | - $content_meal .= do_shortcode( '[lsx_health_plan_featured_tips_block]' ); |
|
| 876 | + $content_meal .= do_shortcode('[lsx_health_plan_featured_tips_block]'); |
|
| 877 | 877 | $content_meal .= '</div>'; |
| 878 | 878 | } |
| 879 | 879 | return $content_meal; |
@@ -886,21 +886,21 @@ discard block |
||
| 886 | 886 | * @param string $index |
| 887 | 887 | * @return void |
| 888 | 888 | */ |
| 889 | -function lsx_health_plan_workout_tab_content( $index = 1 ) { |
|
| 890 | - global $group_name,$shortcode_args; |
|
| 889 | +function lsx_health_plan_workout_tab_content($index = 1) { |
|
| 890 | + global $group_name, $shortcode_args; |
|
| 891 | 891 | $group_name = 'workout_section_' . $index; |
| 892 | - if ( false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) { |
|
| 893 | - $layout = strtolower( \lsx_health_plan\functions\get_option( 'workout_tab_layout', 'table' ) ); |
|
| 892 | + if (false !== \lsx_health_plan\functions\get_option('exercise_enabled', false)) { |
|
| 893 | + $layout = strtolower(\lsx_health_plan\functions\get_option('workout_tab_layout', 'table')); |
|
| 894 | 894 | |
| 895 | 895 | // Check for shortcode overrides. |
| 896 | - if ( null !== $shortcode_args && isset( $shortcode_args['layout'] ) ) { |
|
| 896 | + if (null !== $shortcode_args && isset($shortcode_args['layout'])) { |
|
| 897 | 897 | $layout = $shortcode_args['layout']; |
| 898 | 898 | } |
| 899 | 899 | } else { |
| 900 | 900 | $layout = 'table'; |
| 901 | 901 | } |
| 902 | 902 | |
| 903 | - switch ( $layout ) { |
|
| 903 | + switch ($layout) { |
|
| 904 | 904 | case 'list': |
| 905 | 905 | $tab_template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-list.php'; |
| 906 | 906 | break; |
@@ -913,8 +913,8 @@ discard block |
||
| 913 | 913 | $tab_template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-table.php'; |
| 914 | 914 | break; |
| 915 | 915 | } |
| 916 | - $tab_template_path = apply_filters( 'lsx_health_plan_workout_tab_content_path', $tab_template_path ); |
|
| 917 | - if ( '' !== $tab_template_path ) { |
|
| 916 | + $tab_template_path = apply_filters('lsx_health_plan_workout_tab_content_path', $tab_template_path); |
|
| 917 | + if ('' !== $tab_template_path) { |
|
| 918 | 918 | include $tab_template_path; |
| 919 | 919 | } |
| 920 | 920 | } |
@@ -925,26 +925,26 @@ discard block |
||
| 925 | 925 | * @return void |
| 926 | 926 | */ |
| 927 | 927 | function lsx_health_plan_workout_sets() { |
| 928 | - if ( is_singular( 'workout' ) ) { |
|
| 928 | + if (is_singular('workout')) { |
|
| 929 | 929 | global $connected_workouts; |
| 930 | - $connected_workouts = array( get_the_ID() ); |
|
| 930 | + $connected_workouts = array(get_the_ID()); |
|
| 931 | 931 | } |
| 932 | - if ( is_singular( 'plan' ) ) { |
|
| 932 | + if (is_singular('plan')) { |
|
| 933 | 933 | |
| 934 | 934 | global $connected_workouts; |
| 935 | 935 | |
| 936 | - $section_key = get_query_var( 'section' ); |
|
| 937 | - if ( '' !== $section && \lsx_health_plan\functions\plan\has_sections() ) { |
|
| 938 | - $section_info = \lsx_health_plan\functions\plan\get_section_info( $section_key ); |
|
| 939 | - if ( isset( $section_info['connected_workouts'] ) && '' !== $section_info['connected_workouts'] ) { |
|
| 936 | + $section_key = get_query_var('section'); |
|
| 937 | + if ('' !== $section && \lsx_health_plan\functions\plan\has_sections()) { |
|
| 938 | + $section_info = \lsx_health_plan\functions\plan\get_section_info($section_key); |
|
| 939 | + if (isset($section_info['connected_workouts']) && '' !== $section_info['connected_workouts']) { |
|
| 940 | 940 | |
| 941 | - $connected_workouts = \lsx_health_plan\functions\prep_array( $section_info['connected_workouts'] ); |
|
| 941 | + $connected_workouts = \lsx_health_plan\functions\prep_array($section_info['connected_workouts']); |
|
| 942 | 942 | } |
| 943 | 943 | } |
| 944 | 944 | } |
| 945 | 945 | $template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-sets.php'; |
| 946 | - $template_path = apply_filters( 'lsx_health_plan_workout_set_template_path', $template_path ); |
|
| 947 | - if ( '' !== $template_path && ! empty( $template_path ) ) { |
|
| 946 | + $template_path = apply_filters('lsx_health_plan_workout_set_template_path', $template_path); |
|
| 947 | + if ('' !== $template_path && ! empty($template_path)) { |
|
| 948 | 948 | include $template_path; |
| 949 | 949 | } |
| 950 | 950 | } |
@@ -955,11 +955,11 @@ discard block |
||
| 955 | 955 | * @param [type] $connected_workouts |
| 956 | 956 | * @return void |
| 957 | 957 | */ |
| 958 | -function lsx_health_plan_warmup_sets( $connected_workouts ) { |
|
| 958 | +function lsx_health_plan_warmup_sets($connected_workouts) { |
|
| 959 | 959 | |
| 960 | 960 | $template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-sets.php'; |
| 961 | - $template_path = apply_filters( 'lsx_health_plan_workout_set_template_path', $template_path ); |
|
| 962 | - if ( '' !== $template_path && ! empty( $template_path ) ) { |
|
| 961 | + $template_path = apply_filters('lsx_health_plan_workout_set_template_path', $template_path); |
|
| 962 | + if ('' !== $template_path && ! empty($template_path)) { |
|
| 963 | 963 | include $template_path; |
| 964 | 964 | } |
| 965 | 965 | } |
@@ -970,46 +970,46 @@ discard block |
||
| 970 | 970 | * @param array $args |
| 971 | 971 | * @return void |
| 972 | 972 | */ |
| 973 | -function lsx_hp_meal_plan_recipes( $args = array() ) { |
|
| 973 | +function lsx_hp_meal_plan_recipes($args = array()) { |
|
| 974 | 974 | $defaults = array( |
| 975 | 975 | 'meal_id' => false, |
| 976 | 976 | 'meal_time' => '', |
| 977 | 977 | 'modal' => true, |
| 978 | 978 | ); |
| 979 | - $args = wp_parse_args( $args, $defaults ); |
|
| 979 | + $args = wp_parse_args($args, $defaults); |
|
| 980 | 980 | // Looking for recipes. |
| 981 | - $connected_recipes = get_post_meta( $args['meal_id'], $args['meal_time'] . '_recipes', true ); |
|
| 982 | - if ( ! empty( $connected_recipes ) ) { |
|
| 983 | - $query_args = array( |
|
| 981 | + $connected_recipes = get_post_meta($args['meal_id'], $args['meal_time'] . '_recipes', true); |
|
| 982 | + if ( ! empty($connected_recipes)) { |
|
| 983 | + $query_args = array( |
|
| 984 | 984 | 'orderby' => 'date', |
| 985 | 985 | 'order' => 'DESC', |
| 986 | 986 | 'post_type' => 'recipe', |
| 987 | 987 | 'post__in' => $connected_recipes, |
| 988 | 988 | ); |
| 989 | - $recipes = new WP_Query( $query_args ); |
|
| 989 | + $recipes = new WP_Query($query_args); |
|
| 990 | 990 | ?> |
| 991 | 991 | <div class="recipes"> |
| 992 | 992 | <div class="row eating-row"> |
| 993 | 993 | <?php |
| 994 | - if ( $recipes->have_posts() ) { |
|
| 995 | - while ( $recipes->have_posts() ) { |
|
| 994 | + if ($recipes->have_posts()) { |
|
| 995 | + while ($recipes->have_posts()) { |
|
| 996 | 996 | $recipes->the_post(); |
| 997 | - if ( false !== $args['modal'] ) { |
|
| 997 | + if (false !== $args['modal']) { |
|
| 998 | 998 | \lsx_health_plan\functions\recipes\register_recipe_modal(); |
| 999 | 999 | } |
| 1000 | 1000 | ?> |
| 1001 | 1001 | <div class="recipe-column"> |
| 1002 | - <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"> |
|
| 1002 | + <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"> |
|
| 1003 | 1003 | <div class="recipe-feature-img"> |
| 1004 | 1004 | <?php |
| 1005 | 1005 | $featured_image = get_the_post_thumbnail(); |
| 1006 | - if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
| 1007 | - the_post_thumbnail( 'lsx-thumbnail-square', array( |
|
| 1006 | + if ( ! empty($featured_image) && '' !== $featured_image) { |
|
| 1007 | + the_post_thumbnail('lsx-thumbnail-square', array( |
|
| 1008 | 1008 | 'class' => 'aligncenter', |
| 1009 | - ) ); |
|
| 1009 | + )); |
|
| 1010 | 1010 | } else { |
| 1011 | 1011 | ?> |
| 1012 | - <img loading="lazy" class="placeholder" src="<?php echo esc_attr( plugin_dir_url( __DIR__ ) . 'assets/images/placeholder.jpg' ); ?>"> |
|
| 1012 | + <img loading="lazy" class="placeholder" src="<?php echo esc_attr(plugin_dir_url(__DIR__) . 'assets/images/placeholder.jpg'); ?>"> |
|
| 1013 | 1013 | <?php |
| 1014 | 1014 | } |
| 1015 | 1015 | ?> |
@@ -1035,25 +1035,25 @@ discard block |
||
| 1035 | 1035 | /** |
| 1036 | 1036 | * Output the connected. |
| 1037 | 1037 | */ |
| 1038 | -function lsx_hp_recipe_plan_meta( $args = array() ) { |
|
| 1038 | +function lsx_hp_recipe_plan_meta($args = array()) { |
|
| 1039 | 1039 | $defaults = array(); |
| 1040 | 1040 | $top_level_plans = array(); |
| 1041 | 1041 | // Get meals this exercise is connected to. |
| 1042 | - $plans = get_post_meta( get_the_ID(), 'connected_plans', true ); |
|
| 1043 | - if ( ! empty( $plans ) ) { |
|
| 1044 | - $plan = end( $plans ); |
|
| 1045 | - $has_parent = wp_get_post_parent_id( $plan ); |
|
| 1046 | - if ( 0 === $has_parent ) { |
|
| 1042 | + $plans = get_post_meta(get_the_ID(), 'connected_plans', true); |
|
| 1043 | + if ( ! empty($plans)) { |
|
| 1044 | + $plan = end($plans); |
|
| 1045 | + $has_parent = wp_get_post_parent_id($plan); |
|
| 1046 | + if (0 === $has_parent) { |
|
| 1047 | 1047 | $top_level_plans[] = $plan; |
| 1048 | - } elseif ( false !== $top_level_plans ) { |
|
| 1048 | + } elseif (false !== $top_level_plans) { |
|
| 1049 | 1049 | $top_level_plans[] = $has_parent; |
| 1050 | 1050 | } |
| 1051 | 1051 | } |
| 1052 | - if ( ! empty( $top_level_plans ) && ( '' !== $top_level_plans ) ) { |
|
| 1053 | - $top_level_plans = array_unique( $top_level_plans ); |
|
| 1054 | - $top_level_plan = end( $top_level_plans ); |
|
| 1052 | + if ( ! empty($top_level_plans) && ('' !== $top_level_plans)) { |
|
| 1053 | + $top_level_plans = array_unique($top_level_plans); |
|
| 1054 | + $top_level_plan = end($top_level_plans); |
|
| 1055 | 1055 | ?> |
| 1056 | - <span class="recipe-type recipe-parent"><?php echo esc_html( get_the_title( $top_level_plan ) ); ?></span> |
|
| 1056 | + <span class="recipe-type recipe-parent"><?php echo esc_html(get_the_title($top_level_plan)); ?></span> |
|
| 1057 | 1057 | <?php |
| 1058 | 1058 | } |
| 1059 | 1059 | } |
@@ -1066,23 +1066,23 @@ discard block |
||
| 1066 | 1066 | $top_level_plans = array(); |
| 1067 | 1067 | |
| 1068 | 1068 | // Get workouts this exercise is connected to. |
| 1069 | - $workouts = get_post_meta( get_the_ID(), 'connected_workouts', true ); |
|
| 1069 | + $workouts = get_post_meta(get_the_ID(), 'connected_workouts', true); |
|
| 1070 | 1070 | |
| 1071 | - if ( '' !== $workouts && ! is_array( $workouts ) ) { |
|
| 1072 | - $workouts = array( $workouts ); |
|
| 1071 | + if ('' !== $workouts && ! is_array($workouts)) { |
|
| 1072 | + $workouts = array($workouts); |
|
| 1073 | 1073 | } |
| 1074 | - if ( ! empty( $workouts ) ) { |
|
| 1075 | - foreach ( $workouts as $workout ) { |
|
| 1074 | + if ( ! empty($workouts)) { |
|
| 1075 | + foreach ($workouts as $workout) { |
|
| 1076 | 1076 | // Get the plans this workout is connected to. |
| 1077 | - $plans = get_post_meta( $workout, 'connected_plans', true ); |
|
| 1077 | + $plans = get_post_meta($workout, 'connected_plans', true); |
|
| 1078 | 1078 | |
| 1079 | - if ( '' !== $plans && ! is_array( $plans ) ) { |
|
| 1080 | - $plans = array( $plans ); |
|
| 1079 | + if ('' !== $plans && ! is_array($plans)) { |
|
| 1080 | + $plans = array($plans); |
|
| 1081 | 1081 | } |
| 1082 | - if ( ! empty( $plans ) ) { |
|
| 1083 | - foreach ( $plans as $plan ) { |
|
| 1084 | - $has_parent = wp_get_post_parent_id( $plan ); |
|
| 1085 | - if ( 0 === $has_parent ) { |
|
| 1082 | + if ( ! empty($plans)) { |
|
| 1083 | + foreach ($plans as $plan) { |
|
| 1084 | + $has_parent = wp_get_post_parent_id($plan); |
|
| 1085 | + if (0 === $has_parent) { |
|
| 1086 | 1086 | $top_level_plans = $plan; |
| 1087 | 1087 | } else { |
| 1088 | 1088 | $top_level_plans = $has_parent; |
@@ -1092,11 +1092,11 @@ discard block |
||
| 1092 | 1092 | } |
| 1093 | 1093 | } |
| 1094 | 1094 | |
| 1095 | - if ( ! empty( $top_level_plans ) && ( '' !== $top_level_plans ) ) { |
|
| 1096 | - $top_level_plans = array_unique( $top_level_plans ); |
|
| 1097 | - $top_level_plan = end( $top_level_plans ); |
|
| 1095 | + if ( ! empty($top_level_plans) && ('' !== $top_level_plans)) { |
|
| 1096 | + $top_level_plans = array_unique($top_level_plans); |
|
| 1097 | + $top_level_plan = end($top_level_plans); |
|
| 1098 | 1098 | ?> |
| 1099 | - <span class="recipe-type recipe-parent"><?php echo esc_html( get_the_title( $top_level_plan ) ); ?></span> |
|
| 1099 | + <span class="recipe-type recipe-parent"><?php echo esc_html(get_the_title($top_level_plan)); ?></span> |
|
| 1100 | 1100 | <?php |
| 1101 | 1101 | } |
| 1102 | 1102 | } |
@@ -1107,12 +1107,12 @@ discard block |
||
| 1107 | 1107 | * @param [type] $related_content |
| 1108 | 1108 | * @return void |
| 1109 | 1109 | */ |
| 1110 | -function lsx_hp_single_related( $related_content, $post_type_text ) { |
|
| 1110 | +function lsx_hp_single_related($related_content, $post_type_text) { |
|
| 1111 | 1111 | ?> |
| 1112 | 1112 | <section id="lsx-hp-related"> |
| 1113 | 1113 | <div class="row lsx-related-posts lsx-related-posts-title"> |
| 1114 | 1114 | <div class="col-xs-12"> |
| 1115 | - <h2 class="lsx-related-posts-headline"><?php echo esc_html( $post_type_text ); ?></h2> |
|
| 1115 | + <h2 class="lsx-related-posts-headline"><?php echo esc_html($post_type_text); ?></h2> |
|
| 1116 | 1116 | </div> |
| 1117 | 1117 | </div> |
| 1118 | 1118 | <div class="row lsx-related-posts lsx-related-posts-content"> |
@@ -1120,26 +1120,26 @@ discard block |
||
| 1120 | 1120 | <div class="lsx-related-posts-wrapper"> |
| 1121 | 1121 | <?php |
| 1122 | 1122 | $i = 0; |
| 1123 | - foreach ( $related_content as $article ) { |
|
| 1124 | - $post_title = get_the_title( $article ); |
|
| 1125 | - $post_categories = wp_get_post_categories( $article ); |
|
| 1126 | - $post_link = get_permalink( $article ); |
|
| 1123 | + foreach ($related_content as $article) { |
|
| 1124 | + $post_title = get_the_title($article); |
|
| 1125 | + $post_categories = wp_get_post_categories($article); |
|
| 1126 | + $post_link = get_permalink($article); |
|
| 1127 | 1127 | |
| 1128 | 1128 | $cats = array(); |
| 1129 | 1129 | ?> |
| 1130 | - <article id="post-<?php echo esc_html( $article ); ?>" class="lsx-slot post"> |
|
| 1130 | + <article id="post-<?php echo esc_html($article); ?>" class="lsx-slot post"> |
|
| 1131 | 1131 | <div class="entry-layout lsx-hp-shadow"> |
| 1132 | 1132 | <div class="entry-layout-content"> |
| 1133 | 1133 | <header class="entry-header"> |
| 1134 | 1134 | <div class="entry-image"> |
| 1135 | - <a href="<?php echo esc_url( $post_link ); ?>" class="thumbnail"> |
|
| 1135 | + <a href="<?php echo esc_url($post_link); ?>" class="thumbnail"> |
|
| 1136 | 1136 | <?php |
| 1137 | - $featured_image = get_the_post_thumbnail( $article, 'lsx-thumbnail-wide' ); |
|
| 1138 | - if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
| 1139 | - echo wp_kses_post( $featured_image ); |
|
| 1137 | + $featured_image = get_the_post_thumbnail($article, 'lsx-thumbnail-wide'); |
|
| 1138 | + if ( ! empty($featured_image) && '' !== $featured_image) { |
|
| 1139 | + echo wp_kses_post($featured_image); |
|
| 1140 | 1140 | } else { |
| 1141 | 1141 | ?> |
| 1142 | - <img loading="lazy" class="placeholder" src="<?php echo esc_attr( plugin_dir_url( __FILE__ ) . '../assets/images/placeholder.jpg' ); ?>"> |
|
| 1142 | + <img loading="lazy" class="placeholder" src="<?php echo esc_attr(plugin_dir_url(__FILE__) . '../assets/images/placeholder.jpg'); ?>"> |
|
| 1143 | 1143 | <?php |
| 1144 | 1144 | } |
| 1145 | 1145 | ?> |
@@ -1147,18 +1147,18 @@ discard block |
||
| 1147 | 1147 | </div> |
| 1148 | 1148 | <div class="entry-meta"> |
| 1149 | 1149 | <?php |
| 1150 | - foreach ( $post_categories as $c ) { |
|
| 1151 | - $cat = get_category( $c ); |
|
| 1150 | + foreach ($post_categories as $c) { |
|
| 1151 | + $cat = get_category($c); |
|
| 1152 | 1152 | /* Translators: %s: category name */ |
| 1153 | - $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>'; |
|
| 1153 | + $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>'; |
|
| 1154 | 1154 | } |
| 1155 | - if ( ! empty( $cats ) ) { ?> |
|
| 1156 | - <div class="post-categories"><span></span><?php echo wp_kses_post( implode( ', ', $cats ) ); ?></div> |
|
| 1155 | + if ( ! empty($cats)) { ?> |
|
| 1156 | + <div class="post-categories"><span></span><?php echo wp_kses_post(implode(', ', $cats)); ?></div> |
|
| 1157 | 1157 | <?php } ?> |
| 1158 | 1158 | </div> |
| 1159 | 1159 | <h2 class="entry-title"> |
| 1160 | - <a href="<?php echo esc_url( $post_link ); ?>"> |
|
| 1161 | - <?php echo esc_html( $post_title ); ?> |
|
| 1160 | + <a href="<?php echo esc_url($post_link); ?>"> |
|
| 1161 | + <?php echo esc_html($post_title); ?> |
|
| 1162 | 1162 | </a> |
| 1163 | 1163 | </h2> |
| 1164 | 1164 | </header> |
@@ -1182,27 +1182,27 @@ discard block |
||
| 1182 | 1182 | * @param [type] $connected_members |
| 1183 | 1183 | * @return void |
| 1184 | 1184 | */ |
| 1185 | -function lsx_hp_member_connected( $connected_members, $post_type ) { |
|
| 1186 | - if ( ! empty( $connected_members ) ) { |
|
| 1185 | +function lsx_hp_member_connected($connected_members, $post_type) { |
|
| 1186 | + if ( ! empty($connected_members)) { |
|
| 1187 | 1187 | $content = '<div id="hp-connected-members" class="hp-connected-members connected-' . $post_type . '">'; |
| 1188 | - foreach ( $connected_members as $member ) { |
|
| 1189 | - $post_link = get_permalink( $member ); |
|
| 1190 | - $member_name = get_the_title( $member ); |
|
| 1188 | + foreach ($connected_members as $member) { |
|
| 1189 | + $post_link = get_permalink($member); |
|
| 1190 | + $member_name = get_the_title($member); |
|
| 1191 | 1191 | $member_name = '<span class="lsx-team-name">' . $member_name . '</span>'; |
| 1192 | 1192 | |
| 1193 | 1193 | $member_link = '<a href="' . $post_link . '" >' . $member_name . '</a>'; |
| 1194 | 1194 | |
| 1195 | 1195 | $roles = ''; |
| 1196 | - $terms = get_the_terms( $member, 'team_role' ); |
|
| 1196 | + $terms = get_the_terms($member, 'team_role'); |
|
| 1197 | 1197 | |
| 1198 | - if ( $terms && ! is_wp_error( $terms ) ) { |
|
| 1198 | + if ($terms && ! is_wp_error($terms)) { |
|
| 1199 | 1199 | $roles = array(); |
| 1200 | 1200 | |
| 1201 | - foreach ( $terms as $term ) { |
|
| 1201 | + foreach ($terms as $term) { |
|
| 1202 | 1202 | $roles[] = $term->name; |
| 1203 | 1203 | } |
| 1204 | 1204 | |
| 1205 | - $roles = join( ', ', $roles ); |
|
| 1205 | + $roles = join(', ', $roles); |
|
| 1206 | 1206 | } |
| 1207 | 1207 | $member_roles = '' !== $roles ? "<small class='lsx-team-roles'>$roles</small>" : ''; |
| 1208 | 1208 | |