@@ -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,29 +161,29 @@ 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 | - ?> |
|
| 185 | + } |
|
| 186 | + ?> |
|
| 187 | 187 | <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 | 188 | </ul> |
| 189 | 189 | </div> |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | * @return void |
| 197 | 197 | */ |
| 198 | 198 | function lsx_health_plan_my_profile_box() { |
| 199 | - ?> |
|
| 199 | + ?> |
|
| 200 | 200 | <div class="lsx-health-plan my-profile-block wp-block-cover alignfull"> |
| 201 | 201 | <div class="wp-block-cover__inner-container"> |
| 202 | 202 | <h2><?php esc_html_e( 'My Dashboard', 'lsx-health-plan' ); ?></h2> |
@@ -204,97 +204,97 @@ discard block |
||
| 204 | 204 | <div class="profile-navigation"> |
| 205 | 205 | <div class="profile-photo"> |
| 206 | 206 | <?php |
| 207 | - global $current_user; |
|
| 208 | - get_current_user(); |
|
| 209 | - echo get_avatar( $current_user->ID, 240 ); |
|
| 210 | - ?> |
|
| 207 | + global $current_user; |
|
| 208 | + get_current_user(); |
|
| 209 | + echo get_avatar( $current_user->ID, 240 ); |
|
| 210 | + ?> |
|
| 211 | 211 | </div> |
| 212 | 212 | </div> |
| 213 | 213 | <div class="profile-details"> |
| 214 | 214 | <h1 class="title-lined has-text-color"><?php echo esc_html( $current_user->display_name ); ?></h1> |
| 215 | 215 | <?php |
| 216 | - $disable_stats = \lsx_health_plan\functions\get_option( 'disable_all_stats', false ); |
|
| 217 | - if ( 'on' !== $disable_stats && function_exists( 'WC' ) ) { |
|
| 216 | + $disable_stats = \lsx_health_plan\functions\get_option( 'disable_all_stats', false ); |
|
| 217 | + if ( 'on' !== $disable_stats && function_exists( 'WC' ) ) { |
|
| 218 | 218 | |
| 219 | - $is_weight_disabled = \lsx_health_plan\functions\get_option( 'disable_weight_checkbox', false ); |
|
| 220 | - $is_height_disabled = \lsx_health_plan\functions\get_option( 'disable_height_checkbox', false ); |
|
| 221 | - $is_waist_disabled = \lsx_health_plan\functions\get_option( 'disable_waist_checkbox', false ); |
|
| 222 | - $is_bmi_disabled = \lsx_health_plan\functions\get_option( 'disable_bmi_checkbox', false ); |
|
| 219 | + $is_weight_disabled = \lsx_health_plan\functions\get_option( 'disable_weight_checkbox', false ); |
|
| 220 | + $is_height_disabled = \lsx_health_plan\functions\get_option( 'disable_height_checkbox', false ); |
|
| 221 | + $is_waist_disabled = \lsx_health_plan\functions\get_option( 'disable_waist_checkbox', false ); |
|
| 222 | + $is_bmi_disabled = \lsx_health_plan\functions\get_option( 'disable_bmi_checkbox', false ); |
|
| 223 | 223 | |
| 224 | - $weight = get_user_meta( get_current_user_id(), 'weight', true ); |
|
| 225 | - $waist = get_user_meta( get_current_user_id(), 'waist', true ); |
|
| 226 | - $height = get_user_meta( get_current_user_id(), 'height', true ); |
|
| 224 | + $weight = get_user_meta( get_current_user_id(), 'weight', true ); |
|
| 225 | + $waist = get_user_meta( get_current_user_id(), 'waist', true ); |
|
| 226 | + $height = get_user_meta( get_current_user_id(), 'height', true ); |
|
| 227 | 227 | |
| 228 | - $height_m = 0; |
|
| 229 | - if ( is_numeric( $height ) ) { |
|
| 230 | - $height_m = $height / 100; |
|
| 231 | - } |
|
| 228 | + $height_m = 0; |
|
| 229 | + if ( is_numeric( $height ) ) { |
|
| 230 | + $height_m = $height / 100; |
|
| 231 | + } |
|
| 232 | 232 | |
| 233 | - if ( 1 < $weight && 1 < $height_m ) { |
|
| 234 | - $bmi = $weight / ( $height_m * $height_m ); |
|
| 235 | - $bmi = number_format( $bmi, 1 ); |
|
| 236 | - } else { |
|
| 237 | - $bmi = __( 'Add more data', 'lsx-health-plan' ); |
|
| 238 | - } |
|
| 233 | + if ( 1 < $weight && 1 < $height_m ) { |
|
| 234 | + $bmi = $weight / ( $height_m * $height_m ); |
|
| 235 | + $bmi = number_format( $bmi, 1 ); |
|
| 236 | + } else { |
|
| 237 | + $bmi = __( 'Add more data', 'lsx-health-plan' ); |
|
| 238 | + } |
|
| 239 | 239 | |
| 240 | - ?> |
|
| 240 | + ?> |
|
| 241 | 241 | |
| 242 | 242 | <div> |
| 243 | 243 | <?php if ( 'on' !== $is_weight_disabled ) { ?> |
| 244 | 244 | <span><strong><?php esc_html_e( 'Weight:', 'lsx-health-plan' ); ?></strong> |
| 245 | 245 | <?php |
| 246 | - if ( '' !== $weight ) { |
|
| 247 | - echo wp_kses_post( $weight . ' kg' ); |
|
| 248 | - } else { |
|
| 249 | - echo '/'; |
|
| 250 | - } |
|
| 251 | - ?> |
|
| 246 | + if ( '' !== $weight ) { |
|
| 247 | + echo wp_kses_post( $weight . ' kg' ); |
|
| 248 | + } else { |
|
| 249 | + echo '/'; |
|
| 250 | + } |
|
| 251 | + ?> |
|
| 252 | 252 | </span> |
| 253 | 253 | <?php } |
| 254 | - if ( 'on' !== $is_waist_disabled ) { |
|
| 255 | - ?> |
|
| 254 | + if ( 'on' !== $is_waist_disabled ) { |
|
| 255 | + ?> |
|
| 256 | 256 | <span><strong><?php esc_html_e( 'Waist:', 'lsx-health-plan' ); ?></strong> |
| 257 | 257 | <?php |
| 258 | - if ( '' !== $waist ) { |
|
| 259 | - echo wp_kses_post( $waist . ' cm' ); |
|
| 260 | - } else { |
|
| 261 | - echo '/'; |
|
| 262 | - } |
|
| 263 | - ?> |
|
| 258 | + if ( '' !== $waist ) { |
|
| 259 | + echo wp_kses_post( $waist . ' cm' ); |
|
| 260 | + } else { |
|
| 261 | + echo '/'; |
|
| 262 | + } |
|
| 263 | + ?> |
|
| 264 | 264 | </span> |
| 265 | 265 | <?php } |
| 266 | - if ( 'on' !== $is_bmi_disabled ) { |
|
| 267 | - ?> |
|
| 266 | + if ( 'on' !== $is_bmi_disabled ) { |
|
| 267 | + ?> |
|
| 268 | 268 | <span><strong><?php esc_html_e( 'BMI:', 'lsx-health-plan' ); ?></strong> |
| 269 | 269 | <?php |
| 270 | - if ( '' !== $bmi ) { |
|
| 271 | - echo wp_kses_post( $bmi ); |
|
| 272 | - } else { |
|
| 273 | - echo '/'; |
|
| 274 | - } |
|
| 275 | - ?> |
|
| 270 | + if ( '' !== $bmi ) { |
|
| 271 | + echo wp_kses_post( $bmi ); |
|
| 272 | + } else { |
|
| 273 | + echo '/'; |
|
| 274 | + } |
|
| 275 | + ?> |
|
| 276 | 276 | </span> |
| 277 | 277 | <?php } ?> |
| 278 | 278 | </div> |
| 279 | 279 | <?php |
| 280 | - } |
|
| 280 | + } |
|
| 281 | 281 | |
| 282 | - // Only display the edit account link if woocommerce is active. |
|
| 283 | - if ( function_exists( 'WC' ) ) { |
|
| 284 | - ?> |
|
| 282 | + // Only display the edit account link if woocommerce is active. |
|
| 283 | + if ( function_exists( 'WC' ) ) { |
|
| 284 | + ?> |
|
| 285 | 285 | <div class="edit-profile"> |
| 286 | 286 | <?php |
| 287 | - if ( function_exists( 'wc_get_page_id' ) ) { |
|
| 288 | - $url_id = wc_get_page_id( 'myaccount' ); |
|
| 289 | - } else { |
|
| 290 | - $url_id = ''; |
|
| 291 | - } |
|
| 292 | - ?> |
|
| 287 | + if ( function_exists( 'wc_get_page_id' ) ) { |
|
| 288 | + $url_id = wc_get_page_id( 'myaccount' ); |
|
| 289 | + } else { |
|
| 290 | + $url_id = ''; |
|
| 291 | + } |
|
| 292 | + ?> |
|
| 293 | 293 | <a href="<?php echo esc_url( get_permalink( $url_id ) ); ?>edit-account/"><?php esc_html_e( 'Edit', 'lsx-health-plan' ); ?></a> |
| 294 | 294 | </div> |
| 295 | 295 | <?php |
| 296 | - } |
|
| 297 | - ?> |
|
| 296 | + } |
|
| 297 | + ?> |
|
| 298 | 298 | </div> |
| 299 | 299 | </section> |
| 300 | 300 | </div> |
@@ -308,65 +308,65 @@ discard block |
||
| 308 | 308 | * @return void |
| 309 | 309 | */ |
| 310 | 310 | function lsx_health_plan_all_plans_block() { |
| 311 | - global $post, $product; |
|
| 312 | - |
|
| 313 | - $args = array( |
|
| 314 | - 'orderby' => 'menu_order', |
|
| 315 | - 'order' => 'ASC', |
|
| 316 | - 'post_type' => 'plan', |
|
| 317 | - 'nopagin' => true, |
|
| 318 | - 'post_parent' => 0, |
|
| 319 | - ); |
|
| 320 | - |
|
| 321 | - if ( function_exists( '\lsx_health_plan\functions\woocommerce\get_membership_products' ) ) { |
|
| 322 | - $product_ids = \lsx_health_plan\functions\woocommerce\get_membership_products(); |
|
| 323 | - if ( ! empty( $product_ids ) ) { |
|
| 324 | - $args['meta_query'] = array( |
|
| 325 | - 'relation' => 'OR', |
|
| 326 | - array( |
|
| 327 | - 'key' => '_plan_product_id', |
|
| 328 | - 'value' => $product_ids, |
|
| 329 | - 'compare' => 'IN', |
|
| 330 | - ), |
|
| 331 | - array( |
|
| 332 | - 'key' => '_plan_product_id', |
|
| 333 | - 'compare' => 'NOT EXISTS', |
|
| 334 | - ), |
|
| 335 | - ); |
|
| 336 | - } |
|
| 337 | - } |
|
| 338 | - |
|
| 339 | - $the_query = new WP_Query( $args ); |
|
| 340 | - ?> |
|
| 311 | + global $post, $product; |
|
| 312 | + |
|
| 313 | + $args = array( |
|
| 314 | + 'orderby' => 'menu_order', |
|
| 315 | + 'order' => 'ASC', |
|
| 316 | + 'post_type' => 'plan', |
|
| 317 | + 'nopagin' => true, |
|
| 318 | + 'post_parent' => 0, |
|
| 319 | + ); |
|
| 320 | + |
|
| 321 | + if ( function_exists( '\lsx_health_plan\functions\woocommerce\get_membership_products' ) ) { |
|
| 322 | + $product_ids = \lsx_health_plan\functions\woocommerce\get_membership_products(); |
|
| 323 | + if ( ! empty( $product_ids ) ) { |
|
| 324 | + $args['meta_query'] = array( |
|
| 325 | + 'relation' => 'OR', |
|
| 326 | + array( |
|
| 327 | + 'key' => '_plan_product_id', |
|
| 328 | + 'value' => $product_ids, |
|
| 329 | + 'compare' => 'IN', |
|
| 330 | + ), |
|
| 331 | + array( |
|
| 332 | + 'key' => '_plan_product_id', |
|
| 333 | + 'compare' => 'NOT EXISTS', |
|
| 334 | + ), |
|
| 335 | + ); |
|
| 336 | + } |
|
| 337 | + } |
|
| 338 | + |
|
| 339 | + $the_query = new WP_Query( $args ); |
|
| 340 | + ?> |
|
| 341 | 341 | <div class="all-plans-block plan-grid block-all-plans-block"> |
| 342 | 342 | <div class="row"> |
| 343 | 343 | <?php |
| 344 | - if ( $the_query->have_posts() ) : |
|
| 345 | - while ( $the_query->have_posts() ) : |
|
| 346 | - $the_query->the_post(); |
|
| 347 | - lsx_entry_before(); |
|
| 348 | - $completed_class = ''; |
|
| 349 | - $linked_product = false; |
|
| 350 | - $restricted = false; |
|
| 351 | - $product = null; |
|
| 352 | - if ( function_exists( 'lsx_health_plan\functions\woocommerce\plan_has_products' ) && \lsx_health_plan\functions\woocommerce\plan_has_products() ) { |
|
| 353 | - $products = \lsx_health_plan\functions\woocommerce\get_plan_products(); |
|
| 354 | - $linked_product = wc_get_product( $products[0] ); |
|
| 355 | - $product = $linked_product; |
|
| 356 | - } |
|
| 357 | - if ( function_exists( 'wc_memberships_is_post_content_restricted' ) ) { |
|
| 358 | - $restricted = wc_memberships_is_post_content_restricted( get_the_ID() ) && ! current_user_can( 'wc_memberships_view_restricted_post_content', get_the_ID() ); |
|
| 359 | - } |
|
| 360 | - |
|
| 361 | - if ( lsx_health_plan_is_plan_complete() ) { |
|
| 362 | - $completed_class = 'completed'; |
|
| 363 | - } |
|
| 364 | - $round_progress = ''; |
|
| 365 | - $completed_progress = '100'; |
|
| 366 | - if ( false === $restricted ) { |
|
| 367 | - $round_progress = round( \lsx_health_plan\functions\get_progress( get_the_ID() ), 0 ); |
|
| 368 | - } |
|
| 369 | - ?> |
|
| 344 | + if ( $the_query->have_posts() ) : |
|
| 345 | + while ( $the_query->have_posts() ) : |
|
| 346 | + $the_query->the_post(); |
|
| 347 | + lsx_entry_before(); |
|
| 348 | + $completed_class = ''; |
|
| 349 | + $linked_product = false; |
|
| 350 | + $restricted = false; |
|
| 351 | + $product = null; |
|
| 352 | + if ( function_exists( 'lsx_health_plan\functions\woocommerce\plan_has_products' ) && \lsx_health_plan\functions\woocommerce\plan_has_products() ) { |
|
| 353 | + $products = \lsx_health_plan\functions\woocommerce\get_plan_products(); |
|
| 354 | + $linked_product = wc_get_product( $products[0] ); |
|
| 355 | + $product = $linked_product; |
|
| 356 | + } |
|
| 357 | + if ( function_exists( 'wc_memberships_is_post_content_restricted' ) ) { |
|
| 358 | + $restricted = wc_memberships_is_post_content_restricted( get_the_ID() ) && ! current_user_can( 'wc_memberships_view_restricted_post_content', get_the_ID() ); |
|
| 359 | + } |
|
| 360 | + |
|
| 361 | + if ( lsx_health_plan_is_plan_complete() ) { |
|
| 362 | + $completed_class = 'completed'; |
|
| 363 | + } |
|
| 364 | + $round_progress = ''; |
|
| 365 | + $completed_progress = '100'; |
|
| 366 | + if ( false === $restricted ) { |
|
| 367 | + $round_progress = round( \lsx_health_plan\functions\get_progress( get_the_ID() ), 0 ); |
|
| 368 | + } |
|
| 369 | + ?> |
|
| 370 | 370 | <div class="col-xs-12 col-sm-6 col-md-4"> |
| 371 | 371 | <article class="lsx-slot lsx-hp-shadow <?php echo esc_html( 'progress-') . $round_progress; ?>"> |
| 372 | 372 | <div class="plan-feature-img"> |
@@ -375,45 +375,45 @@ discard block |
||
| 375 | 375 | <?php } ?> |
| 376 | 376 | <a href="<?php echo esc_url( get_permalink() ); ?>"> |
| 377 | 377 | <?php |
| 378 | - $featured_image = get_the_post_thumbnail(); |
|
| 379 | - if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
| 380 | - the_post_thumbnail( 'lsx-thumbnail', array( |
|
| 381 | - 'class' => 'aligncenter', |
|
| 382 | - ) ); |
|
| 383 | - } else { |
|
| 384 | - ?> |
|
| 378 | + $featured_image = get_the_post_thumbnail(); |
|
| 379 | + if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
| 380 | + the_post_thumbnail( 'lsx-thumbnail', array( |
|
| 381 | + 'class' => 'aligncenter', |
|
| 382 | + ) ); |
|
| 383 | + } else { |
|
| 384 | + ?> |
|
| 385 | 385 | <img loading="lazy" class="placeholder" src="<?php echo esc_attr( plugin_dir_url( __FILE__ ) . '../assets/images/placeholder.jpg' ); ?>"> |
| 386 | 386 | <?php |
| 387 | - } |
|
| 388 | - ?> |
|
| 387 | + } |
|
| 388 | + ?> |
|
| 389 | 389 | </a> |
| 390 | 390 | </div> |
| 391 | 391 | <div class="content-box plan-content-box"> |
| 392 | 392 | <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> |
| 393 | 393 | <?php |
| 394 | - echo wp_kses_post( \lsx_health_plan\functions\hp_get_plan_type_meta( $post ) ); |
|
| 395 | - ?> |
|
| 394 | + echo wp_kses_post( \lsx_health_plan\functions\hp_get_plan_type_meta( $post ) ); |
|
| 395 | + ?> |
|
| 396 | 396 | <?php |
| 397 | - if ( false !== $linked_product && false !== $restricted ) { |
|
| 398 | - echo wp_kses_post( $linked_product->get_price_html() ); |
|
| 399 | - } |
|
| 400 | - ?> |
|
| 397 | + if ( false !== $linked_product && false !== $restricted ) { |
|
| 398 | + echo wp_kses_post( $linked_product->get_price_html() ); |
|
| 399 | + } |
|
| 400 | + ?> |
|
| 401 | 401 | <div class="excerpt"> |
| 402 | 402 | <?php |
| 403 | - if ( ! has_excerpt() ) { |
|
| 404 | - $content = wp_trim_words( get_the_content(), 20 ); |
|
| 405 | - $content = '<p>' . $content . '</pre>'; |
|
| 406 | - } else { |
|
| 407 | - $content = apply_filters( 'the_excerpt', get_the_excerpt() ); |
|
| 408 | - } |
|
| 409 | - echo wp_kses_post( $content ); |
|
| 410 | - ?> |
|
| 403 | + if ( ! has_excerpt() ) { |
|
| 404 | + $content = wp_trim_words( get_the_content(), 20 ); |
|
| 405 | + $content = '<p>' . $content . '</pre>'; |
|
| 406 | + } else { |
|
| 407 | + $content = apply_filters( 'the_excerpt', get_the_excerpt() ); |
|
| 408 | + } |
|
| 409 | + echo wp_kses_post( $content ); |
|
| 410 | + ?> |
|
| 411 | 411 | </div> |
| 412 | 412 | <?php |
| 413 | - if ( false === $restricted ) { |
|
| 414 | - 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>' ); |
|
| 415 | - } |
|
| 416 | - ?> |
|
| 413 | + if ( false === $restricted ) { |
|
| 414 | + 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>' ); |
|
| 415 | + } |
|
| 416 | + ?> |
|
| 417 | 417 | </div> |
| 418 | 418 | </article> |
| 419 | 419 | </div> |
@@ -432,36 +432,36 @@ discard block |
||
| 432 | 432 | * @return void |
| 433 | 433 | */ |
| 434 | 434 | function lsx_health_plan_day_plan_block( $args = array() ) { |
| 435 | - $defaults = array( |
|
| 436 | - 'plan' => '', |
|
| 437 | - ); |
|
| 438 | - $args = wp_parse_args( $args, $defaults ); |
|
| 439 | - |
|
| 440 | - if ( isset( $args['plan'] ) && '' !== $args['plan'] && \lsx_health_plan\functions\plan\has_sections( $args['plan'] ) ) { |
|
| 441 | - $sections = \lsx_health_plan\functions\plan\get_sections(); |
|
| 442 | - ?> |
|
| 435 | + $defaults = array( |
|
| 436 | + 'plan' => '', |
|
| 437 | + ); |
|
| 438 | + $args = wp_parse_args( $args, $defaults ); |
|
| 439 | + |
|
| 440 | + if ( isset( $args['plan'] ) && '' !== $args['plan'] && \lsx_health_plan\functions\plan\has_sections( $args['plan'] ) ) { |
|
| 441 | + $sections = \lsx_health_plan\functions\plan\get_sections(); |
|
| 442 | + ?> |
|
| 443 | 443 | <div class="daily-plan-block day-grid"> |
| 444 | 444 | <?php |
| 445 | - foreach ( $sections as $section_key => $section_values ) { |
|
| 446 | - $defaults = array( |
|
| 447 | - 'title' => __( 'Day', 'lsx-health-plan' ) . ' ' . ( $section_key + 1 ), |
|
| 448 | - ); |
|
| 449 | - $section_args = wp_parse_args( $section_values, $defaults ); |
|
| 450 | - |
|
| 451 | - $completed_class = ''; |
|
| 452 | - if ( lsx_health_plan_is_day_complete() ) { |
|
| 453 | - $completed_class = 'completed'; |
|
| 454 | - } |
|
| 455 | - ?> |
|
| 445 | + foreach ( $sections as $section_key => $section_values ) { |
|
| 446 | + $defaults = array( |
|
| 447 | + 'title' => __( 'Day', 'lsx-health-plan' ) . ' ' . ( $section_key + 1 ), |
|
| 448 | + ); |
|
| 449 | + $section_args = wp_parse_args( $section_values, $defaults ); |
|
| 450 | + |
|
| 451 | + $completed_class = ''; |
|
| 452 | + if ( lsx_health_plan_is_day_complete() ) { |
|
| 453 | + $completed_class = 'completed'; |
|
| 454 | + } |
|
| 455 | + ?> |
|
| 456 | 456 | <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 ); ?>"> |
| 457 | 457 | <div class="plan-content"><?php echo esc_attr( $section_args['title'] ); ?></div> |
| 458 | 458 | </a> |
| 459 | 459 | <?php |
| 460 | - } |
|
| 461 | - ?> |
|
| 460 | + } |
|
| 461 | + ?> |
|
| 462 | 462 | </div> |
| 463 | 463 | <?php |
| 464 | - } |
|
| 464 | + } |
|
| 465 | 465 | } |
| 466 | 466 | |
| 467 | 467 | /** |
@@ -471,44 +471,44 @@ discard block |
||
| 471 | 471 | * @return void |
| 472 | 472 | */ |
| 473 | 473 | function lsx_health_plan_week_plan_block( $args = array() ) { |
| 474 | - $defaults = array( |
|
| 475 | - 'show_downloads' => false, |
|
| 476 | - 'plan' => '', |
|
| 477 | - ); |
|
| 478 | - $args = wp_parse_args( $args, $defaults ); |
|
| 479 | - |
|
| 480 | - if ( isset( $args['plan'] ) && '' !== $args['plan'] && \lsx_health_plan\functions\plan\has_sections( $args['plan'] ) ) { |
|
| 481 | - $groups = \lsx_health_plan\functions\plan\get_sections( true ); |
|
| 482 | - |
|
| 483 | - if ( ! empty( $groups ) ) { |
|
| 484 | - $counter = 1; |
|
| 485 | - $group_open = false; |
|
| 486 | - |
|
| 487 | - foreach ( $groups as $group_key => $sections ) { |
|
| 488 | - $collapse_class = ''; |
|
| 489 | - $group_title = \lsx_health_plan\functions\plan\get_group_title( $sections ); |
|
| 490 | - |
|
| 491 | - // Determine if the current week is complete. |
|
| 492 | - $day_ids = wp_list_pluck( $sections, 'title' ); |
|
| 493 | - if ( false === $group_open ) { |
|
| 494 | - if ( 1 === $counter && ! \lsx_health_plan\functions\is_week_complete( false, $day_ids, $group_title ) ) { |
|
| 495 | - $collapse_class = 'in'; |
|
| 496 | - $group_open = true; |
|
| 497 | - } elseif ( ! \lsx_health_plan\functions\is_week_complete( false, $day_ids, $group_title ) ) { |
|
| 498 | - $collapse_class = 'in'; |
|
| 499 | - $group_open = true; |
|
| 500 | - } |
|
| 501 | - } |
|
| 502 | - |
|
| 503 | - // Determine if there are any weekly downloads. |
|
| 504 | - $week_downloads_view = ''; |
|
| 505 | - if ( isset( $args['show_downloads'] ) && false !== $args['show_downloads'] ) { |
|
| 506 | - $weekly_downloads = \lsx_health_plan\functions\get_weekly_downloads( $group_key ); |
|
| 507 | - if ( ! empty( $weekly_downloads ) ) { |
|
| 508 | - $week_downloads_view = 'week-downloads-view-on'; |
|
| 509 | - } |
|
| 510 | - } |
|
| 511 | - ?> |
|
| 474 | + $defaults = array( |
|
| 475 | + 'show_downloads' => false, |
|
| 476 | + 'plan' => '', |
|
| 477 | + ); |
|
| 478 | + $args = wp_parse_args( $args, $defaults ); |
|
| 479 | + |
|
| 480 | + if ( isset( $args['plan'] ) && '' !== $args['plan'] && \lsx_health_plan\functions\plan\has_sections( $args['plan'] ) ) { |
|
| 481 | + $groups = \lsx_health_plan\functions\plan\get_sections( true ); |
|
| 482 | + |
|
| 483 | + if ( ! empty( $groups ) ) { |
|
| 484 | + $counter = 1; |
|
| 485 | + $group_open = false; |
|
| 486 | + |
|
| 487 | + foreach ( $groups as $group_key => $sections ) { |
|
| 488 | + $collapse_class = ''; |
|
| 489 | + $group_title = \lsx_health_plan\functions\plan\get_group_title( $sections ); |
|
| 490 | + |
|
| 491 | + // Determine if the current week is complete. |
|
| 492 | + $day_ids = wp_list_pluck( $sections, 'title' ); |
|
| 493 | + if ( false === $group_open ) { |
|
| 494 | + if ( 1 === $counter && ! \lsx_health_plan\functions\is_week_complete( false, $day_ids, $group_title ) ) { |
|
| 495 | + $collapse_class = 'in'; |
|
| 496 | + $group_open = true; |
|
| 497 | + } elseif ( ! \lsx_health_plan\functions\is_week_complete( false, $day_ids, $group_title ) ) { |
|
| 498 | + $collapse_class = 'in'; |
|
| 499 | + $group_open = true; |
|
| 500 | + } |
|
| 501 | + } |
|
| 502 | + |
|
| 503 | + // Determine if there are any weekly downloads. |
|
| 504 | + $week_downloads_view = ''; |
|
| 505 | + if ( isset( $args['show_downloads'] ) && false !== $args['show_downloads'] ) { |
|
| 506 | + $weekly_downloads = \lsx_health_plan\functions\get_weekly_downloads( $group_key ); |
|
| 507 | + if ( ! empty( $weekly_downloads ) ) { |
|
| 508 | + $week_downloads_view = 'week-downloads-view-on'; |
|
| 509 | + } |
|
| 510 | + } |
|
| 511 | + ?> |
|
| 512 | 512 | <div class="daily-plan-block week-grid"> |
| 513 | 513 | <a href="#group-<?php echo esc_attr( $group_key ); ?>" data-toggle="collapse" class="week-title"><?php echo esc_attr( $group_title ); ?></a> |
| 514 | 514 | <div id="group-<?php echo esc_attr( $group_key ); ?>" class="week-row collapse <?php echo esc_attr( $collapse_class ); ?>"> |
@@ -522,46 +522,46 @@ discard block |
||
| 522 | 522 | <div class="week-meals-recipes-box-inner"> |
| 523 | 523 | <?php |
| 524 | 524 | |
| 525 | - foreach ( $sections as $section_key => $section_values ) { |
|
| 525 | + foreach ( $sections as $section_key => $section_values ) { |
|
| 526 | 526 | |
| 527 | - $defaults = array( |
|
| 528 | - 'title' => __( 'Day', 'lsx-health-plan' ) . ' ' . ( $section_key + 1 ), |
|
| 529 | - ); |
|
| 530 | - $section_args = wp_parse_args( $section_values, $defaults ); |
|
| 527 | + $defaults = array( |
|
| 528 | + 'title' => __( 'Day', 'lsx-health-plan' ) . ' ' . ( $section_key + 1 ), |
|
| 529 | + ); |
|
| 530 | + $section_args = wp_parse_args( $section_values, $defaults ); |
|
| 531 | 531 | |
| 532 | - $completed_class = ''; |
|
| 533 | - if ( lsx_health_plan_is_day_complete( $args['plan'], $section_args['title'] ) ) { |
|
| 534 | - $completed_class = 'completed'; |
|
| 535 | - } |
|
| 536 | - if ( $section_args['rest_day_enabled'] && ! $section_args['connected_meals'] ) { |
|
| 537 | - ?> |
|
| 532 | + $completed_class = ''; |
|
| 533 | + if ( lsx_health_plan_is_day_complete( $args['plan'], $section_args['title'] ) ) { |
|
| 534 | + $completed_class = 'completed'; |
|
| 535 | + } |
|
| 536 | + if ( $section_args['rest_day_enabled'] && ! $section_args['connected_meals'] ) { |
|
| 537 | + ?> |
|
| 538 | 538 | <span class="day id-<?php echo esc_attr( $section_key + 1 ); ?> <?php echo esc_attr( $completed_class ); ?>"> |
| 539 | 539 | <div class="plan-content"><?php echo esc_attr( $section_args['title'] ); ?></div> |
| 540 | 540 | </span> |
| 541 | 541 | <?php |
| 542 | - } else { |
|
| 543 | - ?> |
|
| 542 | + } else { |
|
| 543 | + ?> |
|
| 544 | 544 | <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 ); ?>"> |
| 545 | 545 | <div class="plan-content"><?php echo esc_attr( $section_args['title'] ); ?></div> |
| 546 | 546 | </a> |
| 547 | 547 | <?php |
| 548 | - } |
|
| 549 | - } |
|
| 550 | - ?> |
|
| 548 | + } |
|
| 549 | + } |
|
| 550 | + ?> |
|
| 551 | 551 | </div> |
| 552 | 552 | </div> |
| 553 | 553 | <?php |
| 554 | - if ( ! empty( $week_downloads_view ) ) { |
|
| 555 | - lsx_health_plan_weekly_downloads( $weekly_downloads ); |
|
| 556 | - } |
|
| 557 | - ?> |
|
| 554 | + if ( ! empty( $week_downloads_view ) ) { |
|
| 555 | + lsx_health_plan_weekly_downloads( $weekly_downloads ); |
|
| 556 | + } |
|
| 557 | + ?> |
|
| 558 | 558 | </div> |
| 559 | 559 | </div> |
| 560 | 560 | </div> |
| 561 | 561 | <?php |
| 562 | - } |
|
| 563 | - } |
|
| 564 | - } |
|
| 562 | + } |
|
| 563 | + } |
|
| 564 | + } |
|
| 565 | 565 | } |
| 566 | 566 | |
| 567 | 567 | /** |
@@ -571,22 +571,22 @@ discard block |
||
| 571 | 571 | * @return void |
| 572 | 572 | */ |
| 573 | 573 | function lsx_health_plan_weekly_downloads( $weekly_downloads = array() ) { |
| 574 | - if ( ! empty( $weekly_downloads ) ) { |
|
| 575 | - ?> |
|
| 574 | + if ( ! empty( $weekly_downloads ) ) { |
|
| 575 | + ?> |
|
| 576 | 576 | <div class="week-download-box"> |
| 577 | 577 | <h3 class="title"><?php lsx_get_svg_icon( 'download.svg' ); ?><?php echo esc_html_e( 'Downloads', 'lsx-health-plan' ); ?></h3> |
| 578 | 578 | <ul class="week-download-box-list"> |
| 579 | 579 | <?php |
| 580 | - foreach ( $weekly_downloads as $weekly_download ) { |
|
| 581 | - ?> |
|
| 580 | + foreach ( $weekly_downloads as $weekly_download ) { |
|
| 581 | + ?> |
|
| 582 | 582 | <li><?php echo wp_kses_post( do_shortcode( '[download id="' . $weekly_download . '"]' ) ); ?></li> |
| 583 | 583 | <?php |
| 584 | - } |
|
| 585 | - ?> |
|
| 584 | + } |
|
| 585 | + ?> |
|
| 586 | 586 | </ul> |
| 587 | 587 | </div> |
| 588 | 588 | <?php |
| 589 | - } |
|
| 589 | + } |
|
| 590 | 590 | } |
| 591 | 591 | |
| 592 | 592 | /** |
@@ -595,9 +595,9 @@ discard block |
||
| 595 | 595 | * @return void |
| 596 | 596 | */ |
| 597 | 597 | function lsx_health_plan_items( $args = array() ) { |
| 598 | - global $shortcode_args; |
|
| 599 | - $shortcode_args = $args; |
|
| 600 | - include LSX_HEALTH_PLAN_PATH . '/templates/partials/shortcode-loop.php'; |
|
| 598 | + global $shortcode_args; |
|
| 599 | + $shortcode_args = $args; |
|
| 600 | + include LSX_HEALTH_PLAN_PATH . '/templates/partials/shortcode-loop.php'; |
|
| 601 | 601 | } |
| 602 | 602 | |
| 603 | 603 | /** |
@@ -606,10 +606,10 @@ discard block |
||
| 606 | 606 | * @return void |
| 607 | 607 | */ |
| 608 | 608 | function lsx_health_plan_featured_video_block() { |
| 609 | - if ( ! post_type_exists( 'video' ) ) { |
|
| 610 | - return; |
|
| 611 | - } |
|
| 612 | - include LSX_HEALTH_PLAN_PATH . '/templates/featured-videos.php'; |
|
| 609 | + if ( ! post_type_exists( 'video' ) ) { |
|
| 610 | + return; |
|
| 611 | + } |
|
| 612 | + include LSX_HEALTH_PLAN_PATH . '/templates/featured-videos.php'; |
|
| 613 | 613 | } |
| 614 | 614 | |
| 615 | 615 | /** |
@@ -618,10 +618,10 @@ discard block |
||
| 618 | 618 | * @return void |
| 619 | 619 | */ |
| 620 | 620 | function lsx_health_plan_featured_recipes_block() { |
| 621 | - if ( ! post_type_exists( 'recipe' ) ) { |
|
| 622 | - return; |
|
| 623 | - } |
|
| 624 | - include LSX_HEALTH_PLAN_PATH . '/templates/featured-recipes.php'; |
|
| 621 | + if ( ! post_type_exists( 'recipe' ) ) { |
|
| 622 | + return; |
|
| 623 | + } |
|
| 624 | + include LSX_HEALTH_PLAN_PATH . '/templates/featured-recipes.php'; |
|
| 625 | 625 | } |
| 626 | 626 | |
| 627 | 627 | /** |
@@ -630,7 +630,7 @@ discard block |
||
| 630 | 630 | * @return void |
| 631 | 631 | */ |
| 632 | 632 | function lsx_health_plan_featured_tips_block() { |
| 633 | - include LSX_HEALTH_PLAN_PATH . '/templates/featured-tips.php'; |
|
| 633 | + include LSX_HEALTH_PLAN_PATH . '/templates/featured-tips.php'; |
|
| 634 | 634 | } |
| 635 | 635 | |
| 636 | 636 | /** |
@@ -640,11 +640,11 @@ discard block |
||
| 640 | 640 | * @return void |
| 641 | 641 | */ |
| 642 | 642 | function lsx_health_plan_day_button() { |
| 643 | - if ( lsx_health_plan_is_day_complete() ) { |
|
| 644 | - lsx_health_plan_unlock_button(); |
|
| 645 | - } else { |
|
| 646 | - lsx_health_plan_complete_button(); |
|
| 647 | - } |
|
| 643 | + if ( lsx_health_plan_is_day_complete() ) { |
|
| 644 | + lsx_health_plan_unlock_button(); |
|
| 645 | + } else { |
|
| 646 | + lsx_health_plan_complete_button(); |
|
| 647 | + } |
|
| 648 | 648 | } |
| 649 | 649 | |
| 650 | 650 | /** |
@@ -653,7 +653,7 @@ discard block |
||
| 653 | 653 | * @return void |
| 654 | 654 | */ |
| 655 | 655 | function lsx_health_plan_complete_button() { |
| 656 | - ?> |
|
| 656 | + ?> |
|
| 657 | 657 | <div class="single-plan-inner-buttons"> |
| 658 | 658 | <form action="<?php the_permalink(); ?>" method="post" class="form-complete-day complete-plan-btn"> |
| 659 | 659 | <?php wp_nonce_field( 'complete', 'lsx-health-plan-actions' ); ?> |
@@ -671,7 +671,7 @@ discard block |
||
| 671 | 671 | * @return void |
| 672 | 672 | */ |
| 673 | 673 | function lsx_health_plan_unlock_button() { |
| 674 | - ?> |
|
| 674 | + ?> |
|
| 675 | 675 | <div class="single-plan-inner-buttons"> |
| 676 | 676 | <form action="<?php the_permalink(); ?>" method="post" class="form-complete-day complete-plan-btn"> |
| 677 | 677 | <?php wp_nonce_field( 'unlock', 'lsx-health-plan-actions' ); ?> |
@@ -690,10 +690,10 @@ discard block |
||
| 690 | 690 | * @return void |
| 691 | 691 | */ |
| 692 | 692 | function lsx_health_plan_single_nav() { |
| 693 | - $tab_template_path = apply_filters( 'lsx_health_plan_single_nav_path', LSX_HEALTH_PLAN_PATH . '/templates/single-plan-tabs.php' ); |
|
| 694 | - if ( '' !== $tab_template_path ) { |
|
| 695 | - require $tab_template_path; |
|
| 696 | - } |
|
| 693 | + $tab_template_path = apply_filters( 'lsx_health_plan_single_nav_path', LSX_HEALTH_PLAN_PATH . '/templates/single-plan-tabs.php' ); |
|
| 694 | + if ( '' !== $tab_template_path ) { |
|
| 695 | + require $tab_template_path; |
|
| 696 | + } |
|
| 697 | 697 | } |
| 698 | 698 | |
| 699 | 699 | /** |
@@ -703,32 +703,32 @@ discard block |
||
| 703 | 703 | * @return void |
| 704 | 704 | */ |
| 705 | 705 | function lsx_health_plan_single_tabs() { |
| 706 | - $endpoint = get_query_var( 'endpoint' ); |
|
| 707 | - switch ( $endpoint ) { |
|
| 708 | - case 'meal': |
|
| 709 | - $tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-meal.php'; |
|
| 710 | - break; |
|
| 711 | - |
|
| 712 | - case 'recipes': |
|
| 713 | - $tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-recipes.php'; |
|
| 714 | - break; |
|
| 715 | - |
|
| 716 | - case 'workout': |
|
| 717 | - $tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-workout.php'; |
|
| 718 | - break; |
|
| 719 | - |
|
| 720 | - case 'warm-up': |
|
| 721 | - $tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-warm-up.php'; |
|
| 722 | - break; |
|
| 723 | - |
|
| 724 | - default: |
|
| 725 | - $tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-plan.php'; |
|
| 726 | - break; |
|
| 727 | - } |
|
| 728 | - $tab_template_path = apply_filters( 'lsx_health_plan_single_tab_path', $tab_template_path ); |
|
| 729 | - if ( '' !== $tab_template_path ) { |
|
| 730 | - include $tab_template_path; |
|
| 731 | - } |
|
| 706 | + $endpoint = get_query_var( 'endpoint' ); |
|
| 707 | + switch ( $endpoint ) { |
|
| 708 | + case 'meal': |
|
| 709 | + $tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-meal.php'; |
|
| 710 | + break; |
|
| 711 | + |
|
| 712 | + case 'recipes': |
|
| 713 | + $tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-recipes.php'; |
|
| 714 | + break; |
|
| 715 | + |
|
| 716 | + case 'workout': |
|
| 717 | + $tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-workout.php'; |
|
| 718 | + break; |
|
| 719 | + |
|
| 720 | + case 'warm-up': |
|
| 721 | + $tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-warm-up.php'; |
|
| 722 | + break; |
|
| 723 | + |
|
| 724 | + default: |
|
| 725 | + $tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-plan.php'; |
|
| 726 | + break; |
|
| 727 | + } |
|
| 728 | + $tab_template_path = apply_filters( 'lsx_health_plan_single_tab_path', $tab_template_path ); |
|
| 729 | + if ( '' !== $tab_template_path ) { |
|
| 730 | + include $tab_template_path; |
|
| 731 | + } |
|
| 732 | 732 | } |
| 733 | 733 | |
| 734 | 734 | /** |
@@ -737,7 +737,7 @@ discard block |
||
| 737 | 737 | * @return void |
| 738 | 738 | */ |
| 739 | 739 | function lsx_health_plan_recipe_data() { |
| 740 | - include LSX_HEALTH_PLAN_PATH . '/templates/table-recipe-data.php'; |
|
| 740 | + include LSX_HEALTH_PLAN_PATH . '/templates/table-recipe-data.php'; |
|
| 741 | 741 | } |
| 742 | 742 | |
| 743 | 743 | /** |
@@ -746,11 +746,11 @@ discard block |
||
| 746 | 746 | * @return recipe_type |
| 747 | 747 | */ |
| 748 | 748 | function lsx_health_plan_recipe_type() { |
| 749 | - $term_obj_list = get_the_terms( get_the_ID(), 'recipe-type' ); |
|
| 750 | - $recipe_type = $term_obj_list[0]->name; |
|
| 751 | - if ( ! empty( $recipe_type ) ) { |
|
| 752 | - return $recipe_type; |
|
| 753 | - } |
|
| 749 | + $term_obj_list = get_the_terms( get_the_ID(), 'recipe-type' ); |
|
| 750 | + $recipe_type = $term_obj_list[0]->name; |
|
| 751 | + if ( ! empty( $recipe_type ) ) { |
|
| 752 | + return $recipe_type; |
|
| 753 | + } |
|
| 754 | 754 | } |
| 755 | 755 | |
| 756 | 756 | /** |
@@ -761,35 +761,35 @@ discard block |
||
| 761 | 761 | * @return void |
| 762 | 762 | */ |
| 763 | 763 | function lsx_health_plan_workout_video_play_button( $m, $group, $echo = true ) { |
| 764 | - $workout_video = ''; |
|
| 765 | - $giphy = ''; |
|
| 766 | - $youtube = ''; |
|
| 767 | - if ( isset( $group['connected_videos'] ) && '' !== $group['connected_videos'] ) { |
|
| 768 | - $workout_video = esc_html( $group['connected_videos'] ); |
|
| 769 | - $giphy = get_post_meta( $workout_video, 'video_giphy_source', true ); |
|
| 770 | - $youtube = esc_url( get_post_meta( $workout_video, 'video_youtube_source', 1 ) ); |
|
| 771 | - $content = get_post_field( 'post_content', $workout_video ); |
|
| 772 | - $play_button = '<button data-toggle="modal" data-target="#workout-video-modal-' . $m . '"><span class="fa fa-play-circle"></span></button>'; |
|
| 773 | - |
|
| 774 | - $modal_body = ''; |
|
| 775 | - if ( ! empty( $giphy ) ) { |
|
| 776 | - $giphy = \lsx_health_plan\functions\get_video_url( $giphy ); |
|
| 777 | - $modal_body = $giphy; // WPCS: XSS OK. |
|
| 778 | - } elseif ( ! empty( $youtube ) ) { |
|
| 779 | - $modal_body = wp_oembed_get( $youtube, array( // WPCS: XSS OK. |
|
| 780 | - 'width' => 480, |
|
| 781 | - ) ); |
|
| 782 | - } |
|
| 783 | - $modal_body .= '<h5 class="modal-title title-lined">' . $group['name'] . '</h5>'; |
|
| 784 | - $modal_body .= $content; |
|
| 785 | - \lsx_health_plan\functions\register_modal( 'workout-video-modal-' . $m, '', $modal_body ); |
|
| 786 | - |
|
| 787 | - if ( true === $echo ) { |
|
| 788 | - echo wp_kses_post( $play_button ); |
|
| 789 | - } else { |
|
| 790 | - return $play_button; |
|
| 791 | - } |
|
| 792 | - } |
|
| 764 | + $workout_video = ''; |
|
| 765 | + $giphy = ''; |
|
| 766 | + $youtube = ''; |
|
| 767 | + if ( isset( $group['connected_videos'] ) && '' !== $group['connected_videos'] ) { |
|
| 768 | + $workout_video = esc_html( $group['connected_videos'] ); |
|
| 769 | + $giphy = get_post_meta( $workout_video, 'video_giphy_source', true ); |
|
| 770 | + $youtube = esc_url( get_post_meta( $workout_video, 'video_youtube_source', 1 ) ); |
|
| 771 | + $content = get_post_field( 'post_content', $workout_video ); |
|
| 772 | + $play_button = '<button data-toggle="modal" data-target="#workout-video-modal-' . $m . '"><span class="fa fa-play-circle"></span></button>'; |
|
| 773 | + |
|
| 774 | + $modal_body = ''; |
|
| 775 | + if ( ! empty( $giphy ) ) { |
|
| 776 | + $giphy = \lsx_health_plan\functions\get_video_url( $giphy ); |
|
| 777 | + $modal_body = $giphy; // WPCS: XSS OK. |
|
| 778 | + } elseif ( ! empty( $youtube ) ) { |
|
| 779 | + $modal_body = wp_oembed_get( $youtube, array( // WPCS: XSS OK. |
|
| 780 | + 'width' => 480, |
|
| 781 | + ) ); |
|
| 782 | + } |
|
| 783 | + $modal_body .= '<h5 class="modal-title title-lined">' . $group['name'] . '</h5>'; |
|
| 784 | + $modal_body .= $content; |
|
| 785 | + \lsx_health_plan\functions\register_modal( 'workout-video-modal-' . $m, '', $modal_body ); |
|
| 786 | + |
|
| 787 | + if ( true === $echo ) { |
|
| 788 | + echo wp_kses_post( $play_button ); |
|
| 789 | + } else { |
|
| 790 | + return $play_button; |
|
| 791 | + } |
|
| 792 | + } |
|
| 793 | 793 | } |
| 794 | 794 | |
| 795 | 795 | /** |
@@ -798,21 +798,21 @@ discard block |
||
| 798 | 798 | * @return void |
| 799 | 799 | */ |
| 800 | 800 | function lsx_health_plan_recipe_archive_description() { |
| 801 | - $description = ''; |
|
| 802 | - if ( is_post_type_archive( 'recipe' ) ) { |
|
| 803 | - $description = \lsx_health_plan\functions\get_option( 'recipe_archive_description', '' ); |
|
| 804 | - } elseif ( is_post_type_archive( 'exercise' ) ) { |
|
| 805 | - $description = \lsx_health_plan\functions\get_option( 'exercise_archive_description', '' ); |
|
| 806 | - } elseif ( is_tax() ) { |
|
| 807 | - $description = get_the_archive_description(); |
|
| 808 | - } |
|
| 809 | - if ( '' !== $description ) { |
|
| 810 | - ?> |
|
| 801 | + $description = ''; |
|
| 802 | + if ( is_post_type_archive( 'recipe' ) ) { |
|
| 803 | + $description = \lsx_health_plan\functions\get_option( 'recipe_archive_description', '' ); |
|
| 804 | + } elseif ( is_post_type_archive( 'exercise' ) ) { |
|
| 805 | + $description = \lsx_health_plan\functions\get_option( 'exercise_archive_description', '' ); |
|
| 806 | + } elseif ( is_tax() ) { |
|
| 807 | + $description = get_the_archive_description(); |
|
| 808 | + } |
|
| 809 | + if ( '' !== $description ) { |
|
| 810 | + ?> |
|
| 811 | 811 | <div class="lsx-hp-archive-description row"> |
| 812 | 812 | <div class="col-xs-12 description-wrapper"><?php echo wp_kses_post( wpautop( $description ) ); ?></div> |
| 813 | 813 | </div> |
| 814 | 814 | <?php |
| 815 | - } |
|
| 815 | + } |
|
| 816 | 816 | } |
| 817 | 817 | |
| 818 | 818 | /** |
@@ -821,23 +821,23 @@ discard block |
||
| 821 | 821 | * @return void |
| 822 | 822 | */ |
| 823 | 823 | function lsx_health_plan_workout_main_content() { |
| 824 | - // Getting translated endpoint. |
|
| 825 | - $workout = \lsx_health_plan\functions\get_option( 'endpoint_workout', 'workout' ); |
|
| 826 | - |
|
| 827 | - $connected_members = get_post_meta( get_the_ID(), ( $workout . '_connected_team_member' ), true ); |
|
| 828 | - $small_description = get_post_meta( get_the_ID(), ( $workout . '_short_description' ), true ); |
|
| 829 | - |
|
| 830 | - $content = ''; |
|
| 831 | - if ( $small_description || $connected_members || lsx_health_plan_has_tips() ) { |
|
| 832 | - $content .= '<div class="short-desc set-box set content-box entry-content">'; |
|
| 833 | - $content .= '<div class="the-content">'; |
|
| 834 | - $content .= lsx_hp_member_connected( $connected_members, $workout ); |
|
| 835 | - $content .= '<span>' . $small_description . '</span>'; |
|
| 836 | - $content .= '</div>'; |
|
| 837 | - $content .= do_shortcode( '[lsx_health_plan_featured_tips_block]' ); |
|
| 838 | - $content .= '</div>'; |
|
| 839 | - } |
|
| 840 | - return $content; |
|
| 824 | + // Getting translated endpoint. |
|
| 825 | + $workout = \lsx_health_plan\functions\get_option( 'endpoint_workout', 'workout' ); |
|
| 826 | + |
|
| 827 | + $connected_members = get_post_meta( get_the_ID(), ( $workout . '_connected_team_member' ), true ); |
|
| 828 | + $small_description = get_post_meta( get_the_ID(), ( $workout . '_short_description' ), true ); |
|
| 829 | + |
|
| 830 | + $content = ''; |
|
| 831 | + if ( $small_description || $connected_members || lsx_health_plan_has_tips() ) { |
|
| 832 | + $content .= '<div class="short-desc set-box set content-box entry-content">'; |
|
| 833 | + $content .= '<div class="the-content">'; |
|
| 834 | + $content .= lsx_hp_member_connected( $connected_members, $workout ); |
|
| 835 | + $content .= '<span>' . $small_description . '</span>'; |
|
| 836 | + $content .= '</div>'; |
|
| 837 | + $content .= do_shortcode( '[lsx_health_plan_featured_tips_block]' ); |
|
| 838 | + $content .= '</div>'; |
|
| 839 | + } |
|
| 840 | + return $content; |
|
| 841 | 841 | } |
| 842 | 842 | |
| 843 | 843 | /** |
@@ -846,23 +846,23 @@ discard block |
||
| 846 | 846 | * @return void |
| 847 | 847 | */ |
| 848 | 848 | function lsx_health_plan_meal_main_content() { |
| 849 | - // Getting translated endpoint. |
|
| 850 | - $meal = \lsx_health_plan\functions\get_option( 'endpoint_meal', 'meal' ); |
|
| 851 | - |
|
| 852 | - $connected_members = get_post_meta( get_the_ID(), ( $meal . '_connected_team_member' ), true ); |
|
| 853 | - $small_description = get_post_meta( get_the_ID(), ( $meal . '_short_description' ), true ); |
|
| 854 | - |
|
| 855 | - $content_meal = ''; |
|
| 856 | - if ( $small_description || $connected_members || lsx_health_plan_has_tips() ) { |
|
| 857 | - $content_meal .= '<div class="set-box set content-box entry-content">'; |
|
| 858 | - $content_meal .= '<div class="the-content">'; |
|
| 859 | - $content_meal .= lsx_hp_member_connected( $connected_members, $meal ); |
|
| 860 | - $content_meal .= '<span>' . $small_description . '</span>'; |
|
| 861 | - $content_meal .= '</div>'; |
|
| 862 | - $content_meal .= do_shortcode( '[lsx_health_plan_featured_tips_block]' ); |
|
| 863 | - $content_meal .= '</div>'; |
|
| 864 | - } |
|
| 865 | - return $content_meal; |
|
| 849 | + // Getting translated endpoint. |
|
| 850 | + $meal = \lsx_health_plan\functions\get_option( 'endpoint_meal', 'meal' ); |
|
| 851 | + |
|
| 852 | + $connected_members = get_post_meta( get_the_ID(), ( $meal . '_connected_team_member' ), true ); |
|
| 853 | + $small_description = get_post_meta( get_the_ID(), ( $meal . '_short_description' ), true ); |
|
| 854 | + |
|
| 855 | + $content_meal = ''; |
|
| 856 | + if ( $small_description || $connected_members || lsx_health_plan_has_tips() ) { |
|
| 857 | + $content_meal .= '<div class="set-box set content-box entry-content">'; |
|
| 858 | + $content_meal .= '<div class="the-content">'; |
|
| 859 | + $content_meal .= lsx_hp_member_connected( $connected_members, $meal ); |
|
| 860 | + $content_meal .= '<span>' . $small_description . '</span>'; |
|
| 861 | + $content_meal .= '</div>'; |
|
| 862 | + $content_meal .= do_shortcode( '[lsx_health_plan_featured_tips_block]' ); |
|
| 863 | + $content_meal .= '</div>'; |
|
| 864 | + } |
|
| 865 | + return $content_meal; |
|
| 866 | 866 | } |
| 867 | 867 | |
| 868 | 868 | |
@@ -873,36 +873,36 @@ discard block |
||
| 873 | 873 | * @return void |
| 874 | 874 | */ |
| 875 | 875 | function lsx_health_plan_workout_tab_content( $index = 1 ) { |
| 876 | - global $group_name,$shortcode_args; |
|
| 877 | - $group_name = 'workout_section_' . $index; |
|
| 878 | - if ( false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) { |
|
| 879 | - $layout = strtolower( \lsx_health_plan\functions\get_option( 'workout_tab_layout', 'table' ) ); |
|
| 880 | - |
|
| 881 | - // Check for shortcode overrides. |
|
| 882 | - if ( null !== $shortcode_args && isset( $shortcode_args['layout'] ) ) { |
|
| 883 | - $layout = $shortcode_args['layout']; |
|
| 884 | - } |
|
| 885 | - } else { |
|
| 886 | - $layout = 'table'; |
|
| 887 | - } |
|
| 888 | - |
|
| 889 | - switch ( $layout ) { |
|
| 890 | - case 'list': |
|
| 891 | - $tab_template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-list.php'; |
|
| 892 | - break; |
|
| 893 | - |
|
| 894 | - case 'grid': |
|
| 895 | - $tab_template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-grid.php'; |
|
| 896 | - break; |
|
| 897 | - |
|
| 898 | - case 'table': |
|
| 899 | - $tab_template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-table.php'; |
|
| 900 | - break; |
|
| 901 | - } |
|
| 902 | - $tab_template_path = apply_filters( 'lsx_health_plan_workout_tab_content_path', $tab_template_path ); |
|
| 903 | - if ( '' !== $tab_template_path ) { |
|
| 904 | - include $tab_template_path; |
|
| 905 | - } |
|
| 876 | + global $group_name,$shortcode_args; |
|
| 877 | + $group_name = 'workout_section_' . $index; |
|
| 878 | + if ( false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) { |
|
| 879 | + $layout = strtolower( \lsx_health_plan\functions\get_option( 'workout_tab_layout', 'table' ) ); |
|
| 880 | + |
|
| 881 | + // Check for shortcode overrides. |
|
| 882 | + if ( null !== $shortcode_args && isset( $shortcode_args['layout'] ) ) { |
|
| 883 | + $layout = $shortcode_args['layout']; |
|
| 884 | + } |
|
| 885 | + } else { |
|
| 886 | + $layout = 'table'; |
|
| 887 | + } |
|
| 888 | + |
|
| 889 | + switch ( $layout ) { |
|
| 890 | + case 'list': |
|
| 891 | + $tab_template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-list.php'; |
|
| 892 | + break; |
|
| 893 | + |
|
| 894 | + case 'grid': |
|
| 895 | + $tab_template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-grid.php'; |
|
| 896 | + break; |
|
| 897 | + |
|
| 898 | + case 'table': |
|
| 899 | + $tab_template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-table.php'; |
|
| 900 | + break; |
|
| 901 | + } |
|
| 902 | + $tab_template_path = apply_filters( 'lsx_health_plan_workout_tab_content_path', $tab_template_path ); |
|
| 903 | + if ( '' !== $tab_template_path ) { |
|
| 904 | + include $tab_template_path; |
|
| 905 | + } |
|
| 906 | 906 | } |
| 907 | 907 | |
| 908 | 908 | /** |
@@ -911,28 +911,28 @@ discard block |
||
| 911 | 911 | * @return void |
| 912 | 912 | */ |
| 913 | 913 | function lsx_health_plan_workout_sets() { |
| 914 | - if ( is_singular( 'workout' ) ) { |
|
| 915 | - global $connected_workouts; |
|
| 916 | - $connected_workouts = array( get_the_ID() ); |
|
| 917 | - } |
|
| 918 | - if ( is_singular( 'plan' ) ) { |
|
| 919 | - |
|
| 920 | - global $connected_workouts; |
|
| 921 | - |
|
| 922 | - $section_key = get_query_var( 'section' ); |
|
| 923 | - if ( '' !== $section && \lsx_health_plan\functions\plan\has_sections() ) { |
|
| 924 | - $section_info = \lsx_health_plan\functions\plan\get_section_info( $section_key ); |
|
| 925 | - if ( isset( $section_info['connected_workouts'] ) && '' !== $section_info['connected_workouts'] ) { |
|
| 926 | - |
|
| 927 | - $connected_workouts = \lsx_health_plan\functions\prep_array( $section_info['connected_workouts'] ); |
|
| 928 | - } |
|
| 929 | - } |
|
| 930 | - } |
|
| 931 | - $template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-sets.php'; |
|
| 932 | - $template_path = apply_filters( 'lsx_health_plan_workout_set_template_path', $template_path ); |
|
| 933 | - if ( '' !== $template_path && ! empty( $template_path ) ) { |
|
| 934 | - include $template_path; |
|
| 935 | - } |
|
| 914 | + if ( is_singular( 'workout' ) ) { |
|
| 915 | + global $connected_workouts; |
|
| 916 | + $connected_workouts = array( get_the_ID() ); |
|
| 917 | + } |
|
| 918 | + if ( is_singular( 'plan' ) ) { |
|
| 919 | + |
|
| 920 | + global $connected_workouts; |
|
| 921 | + |
|
| 922 | + $section_key = get_query_var( 'section' ); |
|
| 923 | + if ( '' !== $section && \lsx_health_plan\functions\plan\has_sections() ) { |
|
| 924 | + $section_info = \lsx_health_plan\functions\plan\get_section_info( $section_key ); |
|
| 925 | + if ( isset( $section_info['connected_workouts'] ) && '' !== $section_info['connected_workouts'] ) { |
|
| 926 | + |
|
| 927 | + $connected_workouts = \lsx_health_plan\functions\prep_array( $section_info['connected_workouts'] ); |
|
| 928 | + } |
|
| 929 | + } |
|
| 930 | + } |
|
| 931 | + $template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-sets.php'; |
|
| 932 | + $template_path = apply_filters( 'lsx_health_plan_workout_set_template_path', $template_path ); |
|
| 933 | + if ( '' !== $template_path && ! empty( $template_path ) ) { |
|
| 934 | + include $template_path; |
|
| 935 | + } |
|
| 936 | 936 | } |
| 937 | 937 | |
| 938 | 938 | /** |
@@ -943,11 +943,11 @@ discard block |
||
| 943 | 943 | */ |
| 944 | 944 | function lsx_health_plan_warmup_sets( $connected_workouts ) { |
| 945 | 945 | |
| 946 | - $template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-sets.php'; |
|
| 947 | - $template_path = apply_filters( 'lsx_health_plan_workout_set_template_path', $template_path ); |
|
| 948 | - if ( '' !== $template_path && ! empty( $template_path ) ) { |
|
| 949 | - include $template_path; |
|
| 950 | - } |
|
| 946 | + $template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-sets.php'; |
|
| 947 | + $template_path = apply_filters( 'lsx_health_plan_workout_set_template_path', $template_path ); |
|
| 948 | + if ( '' !== $template_path && ! empty( $template_path ) ) { |
|
| 949 | + include $template_path; |
|
| 950 | + } |
|
| 951 | 951 | } |
| 952 | 952 | |
| 953 | 953 | /** |
@@ -957,48 +957,48 @@ discard block |
||
| 957 | 957 | * @return void |
| 958 | 958 | */ |
| 959 | 959 | function lsx_hp_meal_plan_recipes( $args = array() ) { |
| 960 | - $defaults = array( |
|
| 961 | - 'meal_id' => false, |
|
| 962 | - 'meal_time' => '', |
|
| 963 | - 'modal' => true, |
|
| 964 | - ); |
|
| 965 | - $args = wp_parse_args( $args, $defaults ); |
|
| 966 | - // Looking for recipes. |
|
| 967 | - $connected_recipes = get_post_meta( $args['meal_id'], $args['meal_time'] . '_recipes', true ); |
|
| 968 | - if ( ! empty( $connected_recipes ) ) { |
|
| 969 | - $query_args = array( |
|
| 970 | - 'orderby' => 'date', |
|
| 971 | - 'order' => 'DESC', |
|
| 972 | - 'post_type' => 'recipe', |
|
| 973 | - 'post__in' => $connected_recipes, |
|
| 974 | - ); |
|
| 975 | - $recipes = new WP_Query( $query_args ); |
|
| 976 | - ?> |
|
| 960 | + $defaults = array( |
|
| 961 | + 'meal_id' => false, |
|
| 962 | + 'meal_time' => '', |
|
| 963 | + 'modal' => true, |
|
| 964 | + ); |
|
| 965 | + $args = wp_parse_args( $args, $defaults ); |
|
| 966 | + // Looking for recipes. |
|
| 967 | + $connected_recipes = get_post_meta( $args['meal_id'], $args['meal_time'] . '_recipes', true ); |
|
| 968 | + if ( ! empty( $connected_recipes ) ) { |
|
| 969 | + $query_args = array( |
|
| 970 | + 'orderby' => 'date', |
|
| 971 | + 'order' => 'DESC', |
|
| 972 | + 'post_type' => 'recipe', |
|
| 973 | + 'post__in' => $connected_recipes, |
|
| 974 | + ); |
|
| 975 | + $recipes = new WP_Query( $query_args ); |
|
| 976 | + ?> |
|
| 977 | 977 | <div class="recipes"> |
| 978 | 978 | <div class="row eating-row"> |
| 979 | 979 | <?php |
| 980 | - if ( $recipes->have_posts() ) { |
|
| 981 | - while ( $recipes->have_posts() ) { |
|
| 982 | - $recipes->the_post(); |
|
| 983 | - if ( false !== $args['modal'] ) { |
|
| 984 | - \lsx_health_plan\functions\recipes\register_recipe_modal(); |
|
| 985 | - } |
|
| 986 | - ?> |
|
| 980 | + if ( $recipes->have_posts() ) { |
|
| 981 | + while ( $recipes->have_posts() ) { |
|
| 982 | + $recipes->the_post(); |
|
| 983 | + if ( false !== $args['modal'] ) { |
|
| 984 | + \lsx_health_plan\functions\recipes\register_recipe_modal(); |
|
| 985 | + } |
|
| 986 | + ?> |
|
| 987 | 987 | <div class="recipe-column"> |
| 988 | 988 | <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"> |
| 989 | 989 | <div class="recipe-feature-img"> |
| 990 | 990 | <?php |
| 991 | - $featured_image = get_the_post_thumbnail(); |
|
| 992 | - if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
| 993 | - the_post_thumbnail( 'lsx-thumbnail-square', array( |
|
| 994 | - 'class' => 'aligncenter', |
|
| 995 | - ) ); |
|
| 996 | - } else { |
|
| 997 | - ?> |
|
| 991 | + $featured_image = get_the_post_thumbnail(); |
|
| 992 | + if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
| 993 | + the_post_thumbnail( 'lsx-thumbnail-square', array( |
|
| 994 | + 'class' => 'aligncenter', |
|
| 995 | + ) ); |
|
| 996 | + } else { |
|
| 997 | + ?> |
|
| 998 | 998 | <img loading="lazy" class="placeholder" src="<?php echo esc_attr( plugin_dir_url( __DIR__ ) . 'assets/images/placeholder.jpg' ); ?>"> |
| 999 | 999 | <?php |
| 1000 | - } |
|
| 1001 | - ?> |
|
| 1000 | + } |
|
| 1001 | + ?> |
|
| 1002 | 1002 | </div> |
| 1003 | 1003 | <div class="recipe-content"> |
| 1004 | 1004 | <h3 class="recipe-title"><?php the_title(); ?></h3> |
@@ -1007,41 +1007,41 @@ discard block |
||
| 1007 | 1007 | </a> |
| 1008 | 1008 | </div> |
| 1009 | 1009 | <?php |
| 1010 | - } |
|
| 1011 | - } |
|
| 1012 | - wp_reset_postdata(); |
|
| 1013 | - ?> |
|
| 1010 | + } |
|
| 1011 | + } |
|
| 1012 | + wp_reset_postdata(); |
|
| 1013 | + ?> |
|
| 1014 | 1014 | </div> |
| 1015 | 1015 | </div> |
| 1016 | 1016 | <?php |
| 1017 | 1017 | |
| 1018 | - } |
|
| 1018 | + } |
|
| 1019 | 1019 | } |
| 1020 | 1020 | |
| 1021 | 1021 | /** |
| 1022 | 1022 | * Output the connected. |
| 1023 | 1023 | */ |
| 1024 | 1024 | function lsx_hp_recipe_plan_meta( $args = array() ) { |
| 1025 | - $defaults = array(); |
|
| 1026 | - $top_level_plans = array(); |
|
| 1027 | - // Get meals this exercise is connected to. |
|
| 1028 | - $plans = get_post_meta( get_the_ID(), 'connected_plans', true ); |
|
| 1029 | - if ( ! empty( $plans ) ) { |
|
| 1030 | - $plan = end( $plans ); |
|
| 1031 | - $has_parent = wp_get_post_parent_id( $plan ); |
|
| 1032 | - if ( 0 === $has_parent ) { |
|
| 1033 | - $top_level_plans[] = $plan; |
|
| 1034 | - } elseif ( false !== $top_level_plans ) { |
|
| 1035 | - $top_level_plans[] = $has_parent; |
|
| 1036 | - } |
|
| 1037 | - } |
|
| 1038 | - if ( ! empty( $top_level_plans ) && ( '' !== $top_level_plans ) ) { |
|
| 1039 | - $top_level_plans = array_unique( $top_level_plans ); |
|
| 1040 | - $top_level_plan = end( $top_level_plans ); |
|
| 1041 | - ?> |
|
| 1025 | + $defaults = array(); |
|
| 1026 | + $top_level_plans = array(); |
|
| 1027 | + // Get meals this exercise is connected to. |
|
| 1028 | + $plans = get_post_meta( get_the_ID(), 'connected_plans', true ); |
|
| 1029 | + if ( ! empty( $plans ) ) { |
|
| 1030 | + $plan = end( $plans ); |
|
| 1031 | + $has_parent = wp_get_post_parent_id( $plan ); |
|
| 1032 | + if ( 0 === $has_parent ) { |
|
| 1033 | + $top_level_plans[] = $plan; |
|
| 1034 | + } elseif ( false !== $top_level_plans ) { |
|
| 1035 | + $top_level_plans[] = $has_parent; |
|
| 1036 | + } |
|
| 1037 | + } |
|
| 1038 | + if ( ! empty( $top_level_plans ) && ( '' !== $top_level_plans ) ) { |
|
| 1039 | + $top_level_plans = array_unique( $top_level_plans ); |
|
| 1040 | + $top_level_plan = end( $top_level_plans ); |
|
| 1041 | + ?> |
|
| 1042 | 1042 | <span class="recipe-type recipe-parent"><?php echo esc_html( get_the_title( $top_level_plan ) ); ?></span> |
| 1043 | 1043 | <?php |
| 1044 | - } |
|
| 1044 | + } |
|
| 1045 | 1045 | } |
| 1046 | 1046 | |
| 1047 | 1047 | /** |
@@ -1049,42 +1049,42 @@ discard block |
||
| 1049 | 1049 | */ |
| 1050 | 1050 | function lsx_hp_exercise_plan_meta() { |
| 1051 | 1051 | |
| 1052 | - $top_level_plans = array(); |
|
| 1053 | - |
|
| 1054 | - // Get workouts this exercise is connected to. |
|
| 1055 | - $workouts = get_post_meta( get_the_ID(), 'connected_workouts', true ); |
|
| 1056 | - |
|
| 1057 | - if ( '' !== $workouts && ! is_array( $workouts ) ) { |
|
| 1058 | - $workouts = array( $workouts ); |
|
| 1059 | - } |
|
| 1060 | - if ( ! empty( $workouts ) ) { |
|
| 1061 | - foreach ( $workouts as $workout ) { |
|
| 1062 | - // Get the plans this workout is connected to. |
|
| 1063 | - $plans = get_post_meta( $workout, 'connected_plans', true ); |
|
| 1064 | - |
|
| 1065 | - if ( '' !== $plans && ! is_array( $plans ) ) { |
|
| 1066 | - $plans = array( $plans ); |
|
| 1067 | - } |
|
| 1068 | - if ( ! empty( $plans ) ) { |
|
| 1069 | - foreach ( $plans as $plan ) { |
|
| 1070 | - $has_parent = wp_get_post_parent_id( $plan ); |
|
| 1071 | - if ( 0 === $has_parent ) { |
|
| 1072 | - $top_level_plans = $plan; |
|
| 1073 | - } else { |
|
| 1074 | - $top_level_plans = $has_parent; |
|
| 1075 | - } |
|
| 1076 | - } |
|
| 1077 | - } |
|
| 1078 | - } |
|
| 1079 | - } |
|
| 1080 | - |
|
| 1081 | - if ( ! empty( $top_level_plans ) && ( '' !== $top_level_plans ) ) { |
|
| 1082 | - $top_level_plans = array_unique( $top_level_plans ); |
|
| 1083 | - $top_level_plan = end( $top_level_plans ); |
|
| 1084 | - ?> |
|
| 1052 | + $top_level_plans = array(); |
|
| 1053 | + |
|
| 1054 | + // Get workouts this exercise is connected to. |
|
| 1055 | + $workouts = get_post_meta( get_the_ID(), 'connected_workouts', true ); |
|
| 1056 | + |
|
| 1057 | + if ( '' !== $workouts && ! is_array( $workouts ) ) { |
|
| 1058 | + $workouts = array( $workouts ); |
|
| 1059 | + } |
|
| 1060 | + if ( ! empty( $workouts ) ) { |
|
| 1061 | + foreach ( $workouts as $workout ) { |
|
| 1062 | + // Get the plans this workout is connected to. |
|
| 1063 | + $plans = get_post_meta( $workout, 'connected_plans', true ); |
|
| 1064 | + |
|
| 1065 | + if ( '' !== $plans && ! is_array( $plans ) ) { |
|
| 1066 | + $plans = array( $plans ); |
|
| 1067 | + } |
|
| 1068 | + if ( ! empty( $plans ) ) { |
|
| 1069 | + foreach ( $plans as $plan ) { |
|
| 1070 | + $has_parent = wp_get_post_parent_id( $plan ); |
|
| 1071 | + if ( 0 === $has_parent ) { |
|
| 1072 | + $top_level_plans = $plan; |
|
| 1073 | + } else { |
|
| 1074 | + $top_level_plans = $has_parent; |
|
| 1075 | + } |
|
| 1076 | + } |
|
| 1077 | + } |
|
| 1078 | + } |
|
| 1079 | + } |
|
| 1080 | + |
|
| 1081 | + if ( ! empty( $top_level_plans ) && ( '' !== $top_level_plans ) ) { |
|
| 1082 | + $top_level_plans = array_unique( $top_level_plans ); |
|
| 1083 | + $top_level_plan = end( $top_level_plans ); |
|
| 1084 | + ?> |
|
| 1085 | 1085 | <span class="recipe-type recipe-parent"><?php echo esc_html( get_the_title( $top_level_plan ) ); ?></span> |
| 1086 | 1086 | <?php |
| 1087 | - } |
|
| 1087 | + } |
|
| 1088 | 1088 | } |
| 1089 | 1089 | |
| 1090 | 1090 | /** |
@@ -1094,7 +1094,7 @@ discard block |
||
| 1094 | 1094 | * @return void |
| 1095 | 1095 | */ |
| 1096 | 1096 | function lsx_hp_single_related( $related_content, $post_type_text ) { |
| 1097 | - ?> |
|
| 1097 | + ?> |
|
| 1098 | 1098 | <section id="lsx-hp-related"> |
| 1099 | 1099 | <div class="row lsx-related-posts lsx-related-posts-title"> |
| 1100 | 1100 | <div class="col-xs-12"> |
@@ -1105,14 +1105,14 @@ discard block |
||
| 1105 | 1105 | <div class="col-xs-12"> |
| 1106 | 1106 | <div class="lsx-related-posts-wrapper"> |
| 1107 | 1107 | <?php |
| 1108 | - $i = 0; |
|
| 1109 | - foreach ( $related_content as $article ) { |
|
| 1110 | - $post_title = get_the_title( $article ); |
|
| 1111 | - $post_categories = wp_get_post_categories( $article ); |
|
| 1112 | - $post_link = get_permalink( $article ); |
|
| 1113 | - |
|
| 1114 | - $cats = array(); |
|
| 1115 | - ?> |
|
| 1108 | + $i = 0; |
|
| 1109 | + foreach ( $related_content as $article ) { |
|
| 1110 | + $post_title = get_the_title( $article ); |
|
| 1111 | + $post_categories = wp_get_post_categories( $article ); |
|
| 1112 | + $post_link = get_permalink( $article ); |
|
| 1113 | + |
|
| 1114 | + $cats = array(); |
|
| 1115 | + ?> |
|
| 1116 | 1116 | <article id="post-<?php echo esc_html( $article ); ?>" class="lsx-slot post"> |
| 1117 | 1117 | <div class="entry-layout lsx-hp-shadow"> |
| 1118 | 1118 | <div class="entry-layout-content"> |
@@ -1120,25 +1120,25 @@ discard block |
||
| 1120 | 1120 | <div class="entry-image"> |
| 1121 | 1121 | <a href="<?php echo esc_url( $post_link ); ?>" class="thumbnail"> |
| 1122 | 1122 | <?php |
| 1123 | - $featured_image = get_the_post_thumbnail( $article, 'lsx-thumbnail-wide' ); |
|
| 1124 | - if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
| 1125 | - echo wp_kses_post( $featured_image ); |
|
| 1126 | - } else { |
|
| 1127 | - ?> |
|
| 1123 | + $featured_image = get_the_post_thumbnail( $article, 'lsx-thumbnail-wide' ); |
|
| 1124 | + if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
| 1125 | + echo wp_kses_post( $featured_image ); |
|
| 1126 | + } else { |
|
| 1127 | + ?> |
|
| 1128 | 1128 | <img loading="lazy" class="placeholder" src="<?php echo esc_attr( plugin_dir_url( __FILE__ ) . '../assets/images/placeholder.jpg' ); ?>"> |
| 1129 | 1129 | <?php |
| 1130 | - } |
|
| 1131 | - ?> |
|
| 1130 | + } |
|
| 1131 | + ?> |
|
| 1132 | 1132 | </a> |
| 1133 | 1133 | </div> |
| 1134 | 1134 | <div class="entry-meta"> |
| 1135 | 1135 | <?php |
| 1136 | - foreach ( $post_categories as $c ) { |
|
| 1137 | - $cat = get_category( $c ); |
|
| 1138 | - /* Translators: %s: category name */ |
|
| 1139 | - $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>'; |
|
| 1140 | - } |
|
| 1141 | - if ( ! empty( $cats ) ) { ?> |
|
| 1136 | + foreach ( $post_categories as $c ) { |
|
| 1137 | + $cat = get_category( $c ); |
|
| 1138 | + /* Translators: %s: category name */ |
|
| 1139 | + $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>'; |
|
| 1140 | + } |
|
| 1141 | + if ( ! empty( $cats ) ) { ?> |
|
| 1142 | 1142 | <div class="post-categories"><span></span><?php echo wp_kses_post( implode( ', ', $cats ) ); ?></div> |
| 1143 | 1143 | <?php } ?> |
| 1144 | 1144 | </div> |
@@ -1153,8 +1153,8 @@ discard block |
||
| 1153 | 1153 | </article> |
| 1154 | 1154 | |
| 1155 | 1155 | <?php |
| 1156 | - if (++$i === 3) break; |
|
| 1157 | - } ?> |
|
| 1156 | + if (++$i === 3) break; |
|
| 1157 | + } ?> |
|
| 1158 | 1158 | </div> |
| 1159 | 1159 | </div> |
| 1160 | 1160 | </div> |
@@ -1169,32 +1169,32 @@ discard block |
||
| 1169 | 1169 | * @return void |
| 1170 | 1170 | */ |
| 1171 | 1171 | function lsx_hp_member_connected( $connected_members, $post_type ) { |
| 1172 | - if ( ! empty( $connected_members ) ) { |
|
| 1173 | - $content = '<div id="hp-connected-members" class="hp-connected-members connected-' . $post_type . '">'; |
|
| 1174 | - foreach ( $connected_members as $member ) { |
|
| 1175 | - $post_link = get_permalink( $member ); |
|
| 1176 | - $member_name = get_the_title( $member ); |
|
| 1177 | - $member_name = '<span class="lsx-team-name">' . $member_name . '</span>'; |
|
| 1178 | - |
|
| 1179 | - $member_link = '<a href="' . $post_link . '" >' . $member_name . '</a>'; |
|
| 1180 | - |
|
| 1181 | - $roles = ''; |
|
| 1182 | - $terms = get_the_terms( $member, 'team_role' ); |
|
| 1183 | - |
|
| 1184 | - if ( $terms && ! is_wp_error( $terms ) ) { |
|
| 1185 | - $roles = array(); |
|
| 1186 | - |
|
| 1187 | - foreach ( $terms as $term ) { |
|
| 1188 | - $roles[] = $term->name; |
|
| 1189 | - } |
|
| 1190 | - |
|
| 1191 | - $roles = join( ', ', $roles ); |
|
| 1192 | - } |
|
| 1193 | - $member_roles = '' !== $roles ? "<small class='lsx-team-roles'>$roles</small>" : ''; |
|
| 1194 | - |
|
| 1195 | - $content .= '<p>' . $member_roles . ': ' . $member_link . '</p>'; |
|
| 1196 | - } |
|
| 1197 | - $content .= '</div>'; |
|
| 1198 | - return $content; |
|
| 1199 | - } |
|
| 1172 | + if ( ! empty( $connected_members ) ) { |
|
| 1173 | + $content = '<div id="hp-connected-members" class="hp-connected-members connected-' . $post_type . '">'; |
|
| 1174 | + foreach ( $connected_members as $member ) { |
|
| 1175 | + $post_link = get_permalink( $member ); |
|
| 1176 | + $member_name = get_the_title( $member ); |
|
| 1177 | + $member_name = '<span class="lsx-team-name">' . $member_name . '</span>'; |
|
| 1178 | + |
|
| 1179 | + $member_link = '<a href="' . $post_link . '" >' . $member_name . '</a>'; |
|
| 1180 | + |
|
| 1181 | + $roles = ''; |
|
| 1182 | + $terms = get_the_terms( $member, 'team_role' ); |
|
| 1183 | + |
|
| 1184 | + if ( $terms && ! is_wp_error( $terms ) ) { |
|
| 1185 | + $roles = array(); |
|
| 1186 | + |
|
| 1187 | + foreach ( $terms as $term ) { |
|
| 1188 | + $roles[] = $term->name; |
|
| 1189 | + } |
|
| 1190 | + |
|
| 1191 | + $roles = join( ', ', $roles ); |
|
| 1192 | + } |
|
| 1193 | + $member_roles = '' !== $roles ? "<small class='lsx-team-roles'>$roles</small>" : ''; |
|
| 1194 | + |
|
| 1195 | + $content .= '<p>' . $member_roles . ': ' . $member_link . '</p>'; |
|
| 1196 | + } |
|
| 1197 | + $content .= '</div>'; |
|
| 1198 | + return $content; |
|
| 1199 | + } |
|
| 1200 | 1200 | } |