@@ -24,20 +24,20 @@ discard block |
||
| 24 | 24 | <?php lsx_post_meta_single_bottom(); ?> |
| 25 | 25 | </div><!-- .entry-meta --> |
| 26 | 26 | <?php |
| 27 | - if ( is_singular( 'workout' ) ) { |
|
| 28 | - the_content(); |
|
| 29 | - } |
|
| 30 | - ?> |
|
| 27 | + if ( is_singular( 'workout' ) ) { |
|
| 28 | + the_content(); |
|
| 29 | + } |
|
| 30 | + ?> |
|
| 31 | 31 | <div class="entry-content"> |
| 32 | 32 | <div class="single-plan-inner workout-content"> |
| 33 | 33 | <?php |
| 34 | - if ( is_singular( 'workout' ) ) { ?> |
|
| 34 | + if ( is_singular( 'workout' ) ) { ?> |
|
| 35 | 35 | <div class="single-plan-section-title workout title-lined"> |
| 36 | 36 | <?php lsx_get_svg_icon( 'work.svg' ); ?> |
| 37 | 37 | <h2><?php the_title(); ?></h2> |
| 38 | 38 | <?php if ( class_exists( 'LSX_Sharing' ) ) { |
| 39 | - lsx_content_sharing(); |
|
| 40 | - } ?> |
|
| 39 | + lsx_content_sharing(); |
|
| 40 | + } ?> |
|
| 41 | 41 | </div> |
| 42 | 42 | <?php } else { ?> |
| 43 | 43 | <div class="single-plan-section-title workout title-lined"> |
@@ -60,5 +60,5 @@ discard block |
||
| 60 | 60 | <?php } ?> |
| 61 | 61 | <?php |
| 62 | 62 | if ( ! empty( $connected_articles ) ) { |
| 63 | - lsx_hp_single_related( $connected_articles, __( 'Related articles', 'lsx-health-plan' ) ); |
|
| 63 | + lsx_hp_single_related( $connected_articles, __( 'Related articles', 'lsx-health-plan' ) ); |
|
| 64 | 64 | } |
@@ -8,10 +8,10 @@ discard block |
||
| 8 | 8 | global $shortcode_args; |
| 9 | 9 | |
| 10 | 10 | // Getting translated endpoint. |
| 11 | -$archive_workout = \lsx_health_plan\functions\get_option( 'endpoint_workout_archive', 'workout' ); |
|
| 12 | -$workout = \lsx_health_plan\functions\get_option( 'endpoint_workout', 'workout' ); |
|
| 11 | +$archive_workout = \lsx_health_plan\functions\get_option('endpoint_workout_archive', 'workout'); |
|
| 12 | +$workout = \lsx_health_plan\functions\get_option('endpoint_workout', 'workout'); |
|
| 13 | 13 | |
| 14 | -$connected_articles = get_post_meta( get_the_ID(), ( $workout . '_connected_articles' ), true ); |
|
| 14 | +$connected_articles = get_post_meta(get_the_ID(), ($workout . '_connected_articles'), true); |
|
| 15 | 15 | |
| 16 | 16 | ?> |
| 17 | 17 | |
@@ -24,25 +24,25 @@ discard block |
||
| 24 | 24 | <?php lsx_post_meta_single_bottom(); ?> |
| 25 | 25 | </div><!-- .entry-meta --> |
| 26 | 26 | <?php |
| 27 | - if ( is_singular( 'workout' ) ) { |
|
| 27 | + if (is_singular('workout')) { |
|
| 28 | 28 | the_content(); |
| 29 | 29 | } |
| 30 | 30 | ?> |
| 31 | 31 | <div class="entry-content"> |
| 32 | 32 | <div class="single-plan-inner workout-content"> |
| 33 | 33 | <?php |
| 34 | - if ( is_singular( 'workout' ) ) { ?> |
|
| 34 | + if (is_singular('workout')) { ?> |
|
| 35 | 35 | <div class="single-plan-section-title workout title-lined"> |
| 36 | - <?php lsx_get_svg_icon( 'work.svg' ); ?> |
|
| 36 | + <?php lsx_get_svg_icon('work.svg'); ?> |
|
| 37 | 37 | <h2><?php the_title(); ?></h2> |
| 38 | - <?php if ( class_exists( 'LSX_Sharing' ) ) { |
|
| 38 | + <?php if (class_exists('LSX_Sharing')) { |
|
| 39 | 39 | lsx_content_sharing(); |
| 40 | 40 | } ?> |
| 41 | 41 | </div> |
| 42 | 42 | <?php } else { ?> |
| 43 | 43 | <div class="single-plan-section-title workout title-lined"> |
| 44 | - <?php lsx_get_svg_icon( 'work.svg' ); ?> |
|
| 45 | - <h2><?php esc_html_e( 'My Workout', 'lsx-health-plan' ); ?></h2> |
|
| 44 | + <?php lsx_get_svg_icon('work.svg'); ?> |
|
| 45 | + <h2><?php esc_html_e('My Workout', 'lsx-health-plan'); ?></h2> |
|
| 46 | 46 | </div> |
| 47 | 47 | <?php } ?> |
| 48 | 48 | <?php lsx_health_plan_workout_box(); ?> |
@@ -53,12 +53,12 @@ discard block |
||
| 53 | 53 | <?php lsx_entry_bottom(); ?> |
| 54 | 54 | |
| 55 | 55 | </article><!-- #post-## --> |
| 56 | -<?php if ( is_singular( $workout ) ) { ?> |
|
| 56 | +<?php if (is_singular($workout)) { ?> |
|
| 57 | 57 | <div class="back-plan-btn"> |
| 58 | - <a class="btn" href="/<?php echo $archive_workout; ?>"><?php esc_html_e( 'Back to workouts', 'lsx-health-plan' ); ?></a> |
|
| 58 | + <a class="btn" href="/<?php echo $archive_workout; ?>"><?php esc_html_e('Back to workouts', 'lsx-health-plan'); ?></a> |
|
| 59 | 59 | </div> |
| 60 | 60 | <?php } ?> |
| 61 | 61 | <?php |
| 62 | -if ( ! empty( $connected_articles ) ) { |
|
| 63 | - lsx_hp_single_related( $connected_articles, __( 'Related articles', 'lsx-health-plan' ) ); |
|
| 62 | +if ( ! empty($connected_articles)) { |
|
| 63 | + lsx_hp_single_related($connected_articles, __('Related articles', 'lsx-health-plan')); |
|
| 64 | 64 | } |
@@ -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,22 +161,22 @@ 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 | <li class=" |
| 175 | 175 | <?php |
| 176 | - if ( function_exists( 'is_wc_endpoint_url' ) && is_wc_endpoint_url( 'edit-account' ) ) { |
|
| 177 | - echo esc_attr( 'active' ); |
|
| 178 | - } |
|
| 179 | - ?> |
|
| 176 | + if ( function_exists( 'is_wc_endpoint_url' ) && is_wc_endpoint_url( 'edit-account' ) ) { |
|
| 177 | + echo esc_attr( 'active' ); |
|
| 178 | + } |
|
| 179 | + ?> |
|
| 180 | 180 | "><a class="account-details-tab" href="<?php the_permalink(); ?>edit-account/"><?php esc_html_e( 'Account Details', 'lsx-health-plan' ); ?></a></li> |
| 181 | 181 | <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> |
| 182 | 182 | </ul> |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | * @return void |
| 191 | 191 | */ |
| 192 | 192 | function lsx_health_plan_my_profile_box() { |
| 193 | - ?> |
|
| 193 | + ?> |
|
| 194 | 194 | <div class="lsx-health-plan my-profile-block wp-block-cover alignfull"> |
| 195 | 195 | <div class="wp-block-cover__inner-container"> |
| 196 | 196 | <h2><?php esc_html_e( 'My Dashboard', 'lsx-health-plan' ); ?></h2> |
@@ -198,89 +198,89 @@ discard block |
||
| 198 | 198 | <div class="profile-navigation"> |
| 199 | 199 | <div class="profile-photo"> |
| 200 | 200 | <?php |
| 201 | - global $current_user; |
|
| 202 | - get_current_user(); |
|
| 203 | - echo get_avatar( $current_user->ID, 240 ); |
|
| 204 | - ?> |
|
| 201 | + global $current_user; |
|
| 202 | + get_current_user(); |
|
| 203 | + echo get_avatar( $current_user->ID, 240 ); |
|
| 204 | + ?> |
|
| 205 | 205 | </div> |
| 206 | 206 | </div> |
| 207 | 207 | <div class="profile-details"> |
| 208 | 208 | <h1 class="title-lined has-text-color"><?php echo esc_html( $current_user->display_name ); ?></h1> |
| 209 | 209 | <?php |
| 210 | - $disable_stats = \lsx_health_plan\functions\get_option( 'disable_all_stats', false ); |
|
| 211 | - if ( 'on' !== $disable_stats ) { |
|
| 210 | + $disable_stats = \lsx_health_plan\functions\get_option( 'disable_all_stats', false ); |
|
| 211 | + if ( 'on' !== $disable_stats ) { |
|
| 212 | 212 | |
| 213 | - $is_weight_disabled = \lsx_health_plan\functions\get_option( 'disable_weight_checkbox', false ); |
|
| 214 | - $is_height_disabled = \lsx_health_plan\functions\get_option( 'disable_height_checkbox', false ); |
|
| 215 | - $is_waist_disabled = \lsx_health_plan\functions\get_option( 'disable_waist_checkbox', false ); |
|
| 216 | - $is_bmi_disabled = \lsx_health_plan\functions\get_option( 'disable_bmi_checkbox', false ); |
|
| 213 | + $is_weight_disabled = \lsx_health_plan\functions\get_option( 'disable_weight_checkbox', false ); |
|
| 214 | + $is_height_disabled = \lsx_health_plan\functions\get_option( 'disable_height_checkbox', false ); |
|
| 215 | + $is_waist_disabled = \lsx_health_plan\functions\get_option( 'disable_waist_checkbox', false ); |
|
| 216 | + $is_bmi_disabled = \lsx_health_plan\functions\get_option( 'disable_bmi_checkbox', false ); |
|
| 217 | 217 | |
| 218 | - $weight = get_user_meta( get_current_user_id(), 'weight', true ); |
|
| 219 | - $waist = get_user_meta( get_current_user_id(), 'waist', true ); |
|
| 220 | - $height = get_user_meta( get_current_user_id(), 'height', true ); |
|
| 218 | + $weight = get_user_meta( get_current_user_id(), 'weight', true ); |
|
| 219 | + $waist = get_user_meta( get_current_user_id(), 'waist', true ); |
|
| 220 | + $height = get_user_meta( get_current_user_id(), 'height', true ); |
|
| 221 | 221 | |
| 222 | - $height_m = 0; |
|
| 223 | - if ( is_numeric( $height) ) { |
|
| 224 | - $height_m = $height / 100; |
|
| 225 | - } |
|
| 222 | + $height_m = 0; |
|
| 223 | + if ( is_numeric( $height) ) { |
|
| 224 | + $height_m = $height / 100; |
|
| 225 | + } |
|
| 226 | 226 | |
| 227 | - if ( 1 < $weight && 1 < $height_m ) { |
|
| 228 | - $bmi = $weight / ( $height_m * $height_m ); |
|
| 229 | - $bmi = number_format( $bmi, 1 ); |
|
| 230 | - } else { |
|
| 231 | - $bmi = __( 'Add more data', 'lsx-health-plan' ); |
|
| 232 | - } |
|
| 227 | + if ( 1 < $weight && 1 < $height_m ) { |
|
| 228 | + $bmi = $weight / ( $height_m * $height_m ); |
|
| 229 | + $bmi = number_format( $bmi, 1 ); |
|
| 230 | + } else { |
|
| 231 | + $bmi = __( 'Add more data', 'lsx-health-plan' ); |
|
| 232 | + } |
|
| 233 | 233 | |
| 234 | - ?> |
|
| 234 | + ?> |
|
| 235 | 235 | |
| 236 | 236 | <div> |
| 237 | 237 | <?php if ( 'on' !== $is_weight_disabled ) { ?> |
| 238 | 238 | <span><strong><?php esc_html_e( 'Weight:', 'lsx-health-plan' ); ?></strong> |
| 239 | 239 | <?php |
| 240 | - if ( '' !== $weight ) { |
|
| 241 | - echo wp_kses_post( $weight . ' kg' ); |
|
| 242 | - } else { |
|
| 243 | - echo '/'; |
|
| 244 | - } |
|
| 245 | - ?> |
|
| 240 | + if ( '' !== $weight ) { |
|
| 241 | + echo wp_kses_post( $weight . ' kg' ); |
|
| 242 | + } else { |
|
| 243 | + echo '/'; |
|
| 244 | + } |
|
| 245 | + ?> |
|
| 246 | 246 | </span> |
| 247 | 247 | <?php } |
| 248 | - if ( 'on' !== $is_waist_disabled ) { |
|
| 249 | - ?> |
|
| 248 | + if ( 'on' !== $is_waist_disabled ) { |
|
| 249 | + ?> |
|
| 250 | 250 | <span><strong><?php esc_html_e( 'Waist:', 'lsx-health-plan' ); ?></strong> |
| 251 | 251 | <?php |
| 252 | - if ( '' !== $waist ) { |
|
| 253 | - echo wp_kses_post( $waist . ' cm' ); |
|
| 254 | - } else { |
|
| 255 | - echo '/'; |
|
| 256 | - } |
|
| 257 | - ?> |
|
| 252 | + if ( '' !== $waist ) { |
|
| 253 | + echo wp_kses_post( $waist . ' cm' ); |
|
| 254 | + } else { |
|
| 255 | + echo '/'; |
|
| 256 | + } |
|
| 257 | + ?> |
|
| 258 | 258 | </span> |
| 259 | 259 | <?php } |
| 260 | - if ( 'on' !== $is_bmi_disabled ) { |
|
| 261 | - ?> |
|
| 260 | + if ( 'on' !== $is_bmi_disabled ) { |
|
| 261 | + ?> |
|
| 262 | 262 | <span><strong><?php esc_html_e( 'BMI:', 'lsx-health-plan' ); ?></strong> |
| 263 | 263 | <?php |
| 264 | - if ( '' !== $bmi ) { |
|
| 265 | - echo wp_kses_post( $bmi ); |
|
| 266 | - } else { |
|
| 267 | - echo '/'; |
|
| 268 | - } |
|
| 269 | - ?> |
|
| 264 | + if ( '' !== $bmi ) { |
|
| 265 | + echo wp_kses_post( $bmi ); |
|
| 266 | + } else { |
|
| 267 | + echo '/'; |
|
| 268 | + } |
|
| 269 | + ?> |
|
| 270 | 270 | </span> |
| 271 | 271 | <?php } ?> |
| 272 | 272 | </div> |
| 273 | 273 | <?php |
| 274 | - } |
|
| 275 | - ?> |
|
| 274 | + } |
|
| 275 | + ?> |
|
| 276 | 276 | <div class="edit-profile"> |
| 277 | 277 | <?php |
| 278 | - if ( function_exists( 'wc_get_page_id' ) ) { |
|
| 279 | - $url_id = wc_get_page_id( 'myaccount' ); |
|
| 280 | - } else { |
|
| 281 | - $url_id = ''; |
|
| 282 | - } |
|
| 283 | - ?> |
|
| 278 | + if ( function_exists( 'wc_get_page_id' ) ) { |
|
| 279 | + $url_id = wc_get_page_id( 'myaccount' ); |
|
| 280 | + } else { |
|
| 281 | + $url_id = ''; |
|
| 282 | + } |
|
| 283 | + ?> |
|
| 284 | 284 | <a href="<?php echo esc_url( get_permalink( $url_id ) ); ?>edit-account/"><?php esc_html_e( 'Edit', 'lsx-health-plan' ); ?></a> |
| 285 | 285 | </div> |
| 286 | 286 | </div> |
@@ -296,63 +296,63 @@ discard block |
||
| 296 | 296 | * @return void |
| 297 | 297 | */ |
| 298 | 298 | function lsx_health_plan_all_plans_block() { |
| 299 | - global $post, $product; |
|
| 300 | - |
|
| 301 | - $args = array( |
|
| 302 | - 'orderby' => 'menu_order', |
|
| 303 | - 'order' => 'ASC', |
|
| 304 | - 'post_type' => 'plan', |
|
| 305 | - 'nopagin' => true, |
|
| 306 | - 'post_parent' => 0, |
|
| 307 | - ); |
|
| 308 | - |
|
| 309 | - $product_ids = \lsx_health_plan\functions\woocommerce\get_membership_products(); |
|
| 310 | - if ( ! empty( $product_ids ) ) { |
|
| 311 | - $args['meta_query'] = array( |
|
| 312 | - 'relation' => 'OR', |
|
| 313 | - array( |
|
| 314 | - 'key' => '_plan_product_id', |
|
| 315 | - 'value' => $product_ids, |
|
| 316 | - 'compare' => 'IN', |
|
| 317 | - ), |
|
| 318 | - array( |
|
| 319 | - 'key' => '_plan_product_id', |
|
| 320 | - 'compare' => 'NOT EXISTS', |
|
| 321 | - ), |
|
| 322 | - ); |
|
| 323 | - } |
|
| 324 | - |
|
| 325 | - $the_query = new WP_Query( $args ); |
|
| 326 | - ?> |
|
| 299 | + global $post, $product; |
|
| 300 | + |
|
| 301 | + $args = array( |
|
| 302 | + 'orderby' => 'menu_order', |
|
| 303 | + 'order' => 'ASC', |
|
| 304 | + 'post_type' => 'plan', |
|
| 305 | + 'nopagin' => true, |
|
| 306 | + 'post_parent' => 0, |
|
| 307 | + ); |
|
| 308 | + |
|
| 309 | + $product_ids = \lsx_health_plan\functions\woocommerce\get_membership_products(); |
|
| 310 | + if ( ! empty( $product_ids ) ) { |
|
| 311 | + $args['meta_query'] = array( |
|
| 312 | + 'relation' => 'OR', |
|
| 313 | + array( |
|
| 314 | + 'key' => '_plan_product_id', |
|
| 315 | + 'value' => $product_ids, |
|
| 316 | + 'compare' => 'IN', |
|
| 317 | + ), |
|
| 318 | + array( |
|
| 319 | + 'key' => '_plan_product_id', |
|
| 320 | + 'compare' => 'NOT EXISTS', |
|
| 321 | + ), |
|
| 322 | + ); |
|
| 323 | + } |
|
| 324 | + |
|
| 325 | + $the_query = new WP_Query( $args ); |
|
| 326 | + ?> |
|
| 327 | 327 | <div class="all-plans-block plan-grid block-all-plans-block"> |
| 328 | 328 | <div class="row"> |
| 329 | 329 | <?php |
| 330 | - if ( $the_query->have_posts() ) : |
|
| 331 | - while ( $the_query->have_posts() ) : |
|
| 332 | - $the_query->the_post(); |
|
| 333 | - lsx_entry_before(); |
|
| 334 | - $completed_class = ''; |
|
| 335 | - $linked_product = false; |
|
| 336 | - $restricted = false; |
|
| 337 | - $product = null; |
|
| 338 | - if ( function_exists( 'lsx_health_plan\functions\woocommerce\plan_has_products' ) && \lsx_health_plan\functions\woocommerce\plan_has_products() ) { |
|
| 339 | - $products = \lsx_health_plan\functions\woocommerce\get_plan_products(); |
|
| 340 | - $linked_product = wc_get_product( $products[0] ); |
|
| 341 | - $product = $linked_product; |
|
| 342 | - } |
|
| 343 | - if ( function_exists( 'wc_memberships_is_post_content_restricted' ) ) { |
|
| 344 | - $restricted = wc_memberships_is_post_content_restricted( get_the_ID() ) && ! current_user_can( 'wc_memberships_view_restricted_post_content', get_the_ID() ); |
|
| 345 | - } |
|
| 346 | - |
|
| 347 | - if ( lsx_health_plan_is_plan_complete() ) { |
|
| 348 | - $completed_class = 'completed'; |
|
| 349 | - } |
|
| 350 | - $round_progress = ''; |
|
| 351 | - $completed_progress = '100'; |
|
| 352 | - if ( false === $restricted ) { |
|
| 353 | - $round_progress = round( \lsx_health_plan\functions\get_progress( get_the_ID() ), 0 ); |
|
| 354 | - } |
|
| 355 | - ?> |
|
| 330 | + if ( $the_query->have_posts() ) : |
|
| 331 | + while ( $the_query->have_posts() ) : |
|
| 332 | + $the_query->the_post(); |
|
| 333 | + lsx_entry_before(); |
|
| 334 | + $completed_class = ''; |
|
| 335 | + $linked_product = false; |
|
| 336 | + $restricted = false; |
|
| 337 | + $product = null; |
|
| 338 | + if ( function_exists( 'lsx_health_plan\functions\woocommerce\plan_has_products' ) && \lsx_health_plan\functions\woocommerce\plan_has_products() ) { |
|
| 339 | + $products = \lsx_health_plan\functions\woocommerce\get_plan_products(); |
|
| 340 | + $linked_product = wc_get_product( $products[0] ); |
|
| 341 | + $product = $linked_product; |
|
| 342 | + } |
|
| 343 | + if ( function_exists( 'wc_memberships_is_post_content_restricted' ) ) { |
|
| 344 | + $restricted = wc_memberships_is_post_content_restricted( get_the_ID() ) && ! current_user_can( 'wc_memberships_view_restricted_post_content', get_the_ID() ); |
|
| 345 | + } |
|
| 346 | + |
|
| 347 | + if ( lsx_health_plan_is_plan_complete() ) { |
|
| 348 | + $completed_class = 'completed'; |
|
| 349 | + } |
|
| 350 | + $round_progress = ''; |
|
| 351 | + $completed_progress = '100'; |
|
| 352 | + if ( false === $restricted ) { |
|
| 353 | + $round_progress = round( \lsx_health_plan\functions\get_progress( get_the_ID() ), 0 ); |
|
| 354 | + } |
|
| 355 | + ?> |
|
| 356 | 356 | <div class="col-xs-12 col-sm-6 col-md-4"> |
| 357 | 357 | <article class="lsx-slot lsx-hp-shadow <?php echo esc_html( 'progress-') . $round_progress; ?>"> |
| 358 | 358 | <div class="plan-feature-img"> |
@@ -361,45 +361,45 @@ discard block |
||
| 361 | 361 | <?php } ?> |
| 362 | 362 | <a href="<?php echo esc_url( get_permalink() ); ?>"> |
| 363 | 363 | <?php |
| 364 | - $featured_image = get_the_post_thumbnail(); |
|
| 365 | - if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
| 366 | - the_post_thumbnail( 'lsx-thumbnail', array( |
|
| 367 | - 'class' => 'aligncenter', |
|
| 368 | - ) ); |
|
| 369 | - } else { |
|
| 370 | - ?> |
|
| 364 | + $featured_image = get_the_post_thumbnail(); |
|
| 365 | + if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
| 366 | + the_post_thumbnail( 'lsx-thumbnail', array( |
|
| 367 | + 'class' => 'aligncenter', |
|
| 368 | + ) ); |
|
| 369 | + } else { |
|
| 370 | + ?> |
|
| 371 | 371 | <img loading="lazy" class="placeholder" src="<?php echo esc_attr( plugin_dir_url( __FILE__ ) . '../assets/images/placeholder.jpg' ); ?>"> |
| 372 | 372 | <?php |
| 373 | - } |
|
| 374 | - ?> |
|
| 373 | + } |
|
| 374 | + ?> |
|
| 375 | 375 | </a> |
| 376 | 376 | </div> |
| 377 | 377 | <div class="content-box plan-content-box"> |
| 378 | 378 | <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> |
| 379 | 379 | <?php |
| 380 | - echo wp_kses_post( \lsx_health_plan\functions\hp_get_plan_type_meta( $post ) ); |
|
| 381 | - ?> |
|
| 380 | + echo wp_kses_post( \lsx_health_plan\functions\hp_get_plan_type_meta( $post ) ); |
|
| 381 | + ?> |
|
| 382 | 382 | <?php |
| 383 | - if ( false !== $linked_product && false !== $restricted ) { |
|
| 384 | - echo wp_kses_post( $linked_product->get_price_html() ); |
|
| 385 | - } |
|
| 386 | - ?> |
|
| 383 | + if ( false !== $linked_product && false !== $restricted ) { |
|
| 384 | + echo wp_kses_post( $linked_product->get_price_html() ); |
|
| 385 | + } |
|
| 386 | + ?> |
|
| 387 | 387 | <div class="excerpt"> |
| 388 | 388 | <?php |
| 389 | - if ( ! has_excerpt() ) { |
|
| 390 | - $content = wp_trim_words( get_the_content(), 20 ); |
|
| 391 | - $content = '<p>' . $content . '</pre>'; |
|
| 392 | - } else { |
|
| 393 | - $content = apply_filters( 'the_excerpt', get_the_excerpt() ); |
|
| 394 | - } |
|
| 395 | - echo wp_kses_post( $content ); |
|
| 396 | - ?> |
|
| 389 | + if ( ! has_excerpt() ) { |
|
| 390 | + $content = wp_trim_words( get_the_content(), 20 ); |
|
| 391 | + $content = '<p>' . $content . '</pre>'; |
|
| 392 | + } else { |
|
| 393 | + $content = apply_filters( 'the_excerpt', get_the_excerpt() ); |
|
| 394 | + } |
|
| 395 | + echo wp_kses_post( $content ); |
|
| 396 | + ?> |
|
| 397 | 397 | </div> |
| 398 | 398 | <?php |
| 399 | - if ( false === $restricted ) { |
|
| 400 | - 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>' ); |
|
| 401 | - } |
|
| 402 | - ?> |
|
| 399 | + if ( false === $restricted ) { |
|
| 400 | + 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>' ); |
|
| 401 | + } |
|
| 402 | + ?> |
|
| 403 | 403 | </div> |
| 404 | 404 | </article> |
| 405 | 405 | </div> |
@@ -418,36 +418,36 @@ discard block |
||
| 418 | 418 | * @return void |
| 419 | 419 | */ |
| 420 | 420 | function lsx_health_plan_day_plan_block( $args = array() ) { |
| 421 | - $defaults = array( |
|
| 422 | - 'plan' => '', |
|
| 423 | - ); |
|
| 424 | - $args = wp_parse_args( $args, $defaults ); |
|
| 425 | - |
|
| 426 | - if ( isset( $args['plan'] ) && '' !== $args['plan'] && \lsx_health_plan\functions\plan\has_sections( $args['plan'] ) ) { |
|
| 427 | - $sections = \lsx_health_plan\functions\plan\get_sections(); |
|
| 428 | - ?> |
|
| 421 | + $defaults = array( |
|
| 422 | + 'plan' => '', |
|
| 423 | + ); |
|
| 424 | + $args = wp_parse_args( $args, $defaults ); |
|
| 425 | + |
|
| 426 | + if ( isset( $args['plan'] ) && '' !== $args['plan'] && \lsx_health_plan\functions\plan\has_sections( $args['plan'] ) ) { |
|
| 427 | + $sections = \lsx_health_plan\functions\plan\get_sections(); |
|
| 428 | + ?> |
|
| 429 | 429 | <div class="daily-plan-block day-grid"> |
| 430 | 430 | <?php |
| 431 | - foreach ( $sections as $section_key => $section_values ) { |
|
| 432 | - $defaults = array( |
|
| 433 | - 'title' => __( 'Day', 'lsx-health-plan' ) . ' ' . ( $section_key + 1 ), |
|
| 434 | - ); |
|
| 435 | - $section_args = wp_parse_args( $section_values, $defaults ); |
|
| 436 | - |
|
| 437 | - $completed_class = ''; |
|
| 438 | - if ( lsx_health_plan_is_day_complete() ) { |
|
| 439 | - $completed_class = 'completed'; |
|
| 440 | - } |
|
| 441 | - ?> |
|
| 431 | + foreach ( $sections as $section_key => $section_values ) { |
|
| 432 | + $defaults = array( |
|
| 433 | + 'title' => __( 'Day', 'lsx-health-plan' ) . ' ' . ( $section_key + 1 ), |
|
| 434 | + ); |
|
| 435 | + $section_args = wp_parse_args( $section_values, $defaults ); |
|
| 436 | + |
|
| 437 | + $completed_class = ''; |
|
| 438 | + if ( lsx_health_plan_is_day_complete() ) { |
|
| 439 | + $completed_class = 'completed'; |
|
| 440 | + } |
|
| 441 | + ?> |
|
| 442 | 442 | <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 ); ?>"> |
| 443 | 443 | <div class="plan-content"><?php echo esc_attr( $section_args['title'] ); ?></div> |
| 444 | 444 | </a> |
| 445 | 445 | <?php |
| 446 | - } |
|
| 447 | - ?> |
|
| 446 | + } |
|
| 447 | + ?> |
|
| 448 | 448 | </div> |
| 449 | 449 | <?php |
| 450 | - } |
|
| 450 | + } |
|
| 451 | 451 | } |
| 452 | 452 | |
| 453 | 453 | /** |
@@ -457,44 +457,44 @@ discard block |
||
| 457 | 457 | * @return void |
| 458 | 458 | */ |
| 459 | 459 | function lsx_health_plan_week_plan_block( $args = array() ) { |
| 460 | - $defaults = array( |
|
| 461 | - 'show_downloads' => false, |
|
| 462 | - 'plan' => '', |
|
| 463 | - ); |
|
| 464 | - $args = wp_parse_args( $args, $defaults ); |
|
| 465 | - |
|
| 466 | - if ( isset( $args['plan'] ) && '' !== $args['plan'] && \lsx_health_plan\functions\plan\has_sections( $args['plan'] ) ) { |
|
| 467 | - $groups = \lsx_health_plan\functions\plan\get_sections( true ); |
|
| 468 | - |
|
| 469 | - if ( ! empty( $groups ) ) { |
|
| 470 | - $counter = 1; |
|
| 471 | - $group_open = false; |
|
| 472 | - |
|
| 473 | - foreach ( $groups as $group_key => $sections ) { |
|
| 474 | - $collapse_class = ''; |
|
| 475 | - $group_title = \lsx_health_plan\functions\plan\get_group_title( $sections ); |
|
| 476 | - |
|
| 477 | - // Determine if the current week is complete. |
|
| 478 | - $day_ids = wp_list_pluck( $sections, 'title' ); |
|
| 479 | - if ( false === $group_open ) { |
|
| 480 | - if ( 1 === $counter && ! \lsx_health_plan\functions\is_week_complete( false, $day_ids, $group_title ) ) { |
|
| 481 | - $collapse_class = 'in'; |
|
| 482 | - $group_open = true; |
|
| 483 | - } elseif ( ! \lsx_health_plan\functions\is_week_complete( false, $day_ids, $group_title ) ) { |
|
| 484 | - $collapse_class = 'in'; |
|
| 485 | - $group_open = true; |
|
| 486 | - } |
|
| 487 | - } |
|
| 488 | - |
|
| 489 | - // Determine if there are any weekly downloads. |
|
| 490 | - $week_downloads_view = ''; |
|
| 491 | - if ( isset( $args['show_downloads'] ) && false !== $args['show_downloads'] ) { |
|
| 492 | - $weekly_downloads = \lsx_health_plan\functions\get_weekly_downloads( $group_key ); |
|
| 493 | - if ( ! empty( $weekly_downloads ) ) { |
|
| 494 | - $week_downloads_view = 'week-downloads-view-on'; |
|
| 495 | - } |
|
| 496 | - } |
|
| 497 | - ?> |
|
| 460 | + $defaults = array( |
|
| 461 | + 'show_downloads' => false, |
|
| 462 | + 'plan' => '', |
|
| 463 | + ); |
|
| 464 | + $args = wp_parse_args( $args, $defaults ); |
|
| 465 | + |
|
| 466 | + if ( isset( $args['plan'] ) && '' !== $args['plan'] && \lsx_health_plan\functions\plan\has_sections( $args['plan'] ) ) { |
|
| 467 | + $groups = \lsx_health_plan\functions\plan\get_sections( true ); |
|
| 468 | + |
|
| 469 | + if ( ! empty( $groups ) ) { |
|
| 470 | + $counter = 1; |
|
| 471 | + $group_open = false; |
|
| 472 | + |
|
| 473 | + foreach ( $groups as $group_key => $sections ) { |
|
| 474 | + $collapse_class = ''; |
|
| 475 | + $group_title = \lsx_health_plan\functions\plan\get_group_title( $sections ); |
|
| 476 | + |
|
| 477 | + // Determine if the current week is complete. |
|
| 478 | + $day_ids = wp_list_pluck( $sections, 'title' ); |
|
| 479 | + if ( false === $group_open ) { |
|
| 480 | + if ( 1 === $counter && ! \lsx_health_plan\functions\is_week_complete( false, $day_ids, $group_title ) ) { |
|
| 481 | + $collapse_class = 'in'; |
|
| 482 | + $group_open = true; |
|
| 483 | + } elseif ( ! \lsx_health_plan\functions\is_week_complete( false, $day_ids, $group_title ) ) { |
|
| 484 | + $collapse_class = 'in'; |
|
| 485 | + $group_open = true; |
|
| 486 | + } |
|
| 487 | + } |
|
| 488 | + |
|
| 489 | + // Determine if there are any weekly downloads. |
|
| 490 | + $week_downloads_view = ''; |
|
| 491 | + if ( isset( $args['show_downloads'] ) && false !== $args['show_downloads'] ) { |
|
| 492 | + $weekly_downloads = \lsx_health_plan\functions\get_weekly_downloads( $group_key ); |
|
| 493 | + if ( ! empty( $weekly_downloads ) ) { |
|
| 494 | + $week_downloads_view = 'week-downloads-view-on'; |
|
| 495 | + } |
|
| 496 | + } |
|
| 497 | + ?> |
|
| 498 | 498 | <div class="daily-plan-block week-grid"> |
| 499 | 499 | <a href="#group-<?php echo esc_attr( $group_key ); ?>" data-toggle="collapse" class="week-title"><?php echo esc_attr( $group_title ); ?></a> |
| 500 | 500 | <div id="group-<?php echo esc_attr( $group_key ); ?>" class="week-row collapse <?php echo esc_attr( $collapse_class ); ?>"> |
@@ -508,46 +508,46 @@ discard block |
||
| 508 | 508 | <div class="week-meals-recipes-box-inner"> |
| 509 | 509 | <?php |
| 510 | 510 | |
| 511 | - foreach ( $sections as $section_key => $section_values ) { |
|
| 511 | + foreach ( $sections as $section_key => $section_values ) { |
|
| 512 | 512 | |
| 513 | - $defaults = array( |
|
| 514 | - 'title' => __( 'Day', 'lsx-health-plan' ) . ' ' . ( $section_key + 1 ), |
|
| 515 | - ); |
|
| 516 | - $section_args = wp_parse_args( $section_values, $defaults ); |
|
| 513 | + $defaults = array( |
|
| 514 | + 'title' => __( 'Day', 'lsx-health-plan' ) . ' ' . ( $section_key + 1 ), |
|
| 515 | + ); |
|
| 516 | + $section_args = wp_parse_args( $section_values, $defaults ); |
|
| 517 | 517 | |
| 518 | - $completed_class = ''; |
|
| 519 | - if ( lsx_health_plan_is_day_complete( $args['plan'], $section_args['title'] ) ) { |
|
| 520 | - $completed_class = 'completed'; |
|
| 521 | - } |
|
| 522 | - if ( $section_args['rest_day_enabled'] && ! $section_args['connected_meals'] ) { |
|
| 523 | - ?> |
|
| 518 | + $completed_class = ''; |
|
| 519 | + if ( lsx_health_plan_is_day_complete( $args['plan'], $section_args['title'] ) ) { |
|
| 520 | + $completed_class = 'completed'; |
|
| 521 | + } |
|
| 522 | + if ( $section_args['rest_day_enabled'] && ! $section_args['connected_meals'] ) { |
|
| 523 | + ?> |
|
| 524 | 524 | <span class="day id-<?php echo esc_attr( $section_key + 1 ); ?> <?php echo esc_attr( $completed_class ); ?>"> |
| 525 | 525 | <div class="plan-content"><?php echo esc_attr( $section_args['title'] ); ?></div> |
| 526 | 526 | </span> |
| 527 | 527 | <?php |
| 528 | - } else { |
|
| 529 | - ?> |
|
| 528 | + } else { |
|
| 529 | + ?> |
|
| 530 | 530 | <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 ); ?>"> |
| 531 | 531 | <div class="plan-content"><?php echo esc_attr( $section_args['title'] ); ?></div> |
| 532 | 532 | </a> |
| 533 | 533 | <?php |
| 534 | - } |
|
| 535 | - } |
|
| 536 | - ?> |
|
| 534 | + } |
|
| 535 | + } |
|
| 536 | + ?> |
|
| 537 | 537 | </div> |
| 538 | 538 | </div> |
| 539 | 539 | <?php |
| 540 | - if ( ! empty( $week_downloads_view ) ) { |
|
| 541 | - lsx_health_plan_weekly_downloads( $weekly_downloads ); |
|
| 542 | - } |
|
| 543 | - ?> |
|
| 540 | + if ( ! empty( $week_downloads_view ) ) { |
|
| 541 | + lsx_health_plan_weekly_downloads( $weekly_downloads ); |
|
| 542 | + } |
|
| 543 | + ?> |
|
| 544 | 544 | </div> |
| 545 | 545 | </div> |
| 546 | 546 | </div> |
| 547 | 547 | <?php |
| 548 | - } |
|
| 549 | - } |
|
| 550 | - } |
|
| 548 | + } |
|
| 549 | + } |
|
| 550 | + } |
|
| 551 | 551 | } |
| 552 | 552 | |
| 553 | 553 | /** |
@@ -557,22 +557,22 @@ discard block |
||
| 557 | 557 | * @return void |
| 558 | 558 | */ |
| 559 | 559 | function lsx_health_plan_weekly_downloads( $weekly_downloads = array() ) { |
| 560 | - if ( ! empty( $weekly_downloads ) ) { |
|
| 561 | - ?> |
|
| 560 | + if ( ! empty( $weekly_downloads ) ) { |
|
| 561 | + ?> |
|
| 562 | 562 | <div class="week-download-box"> |
| 563 | 563 | <h3 class="title"><?php lsx_get_svg_icon( 'download.svg' ); ?><?php echo esc_html_e( 'Downloads', 'lsx-health-plan' ); ?></h3> |
| 564 | 564 | <ul class="week-download-box-list"> |
| 565 | 565 | <?php |
| 566 | - foreach ( $weekly_downloads as $weekly_download ) { |
|
| 567 | - ?> |
|
| 566 | + foreach ( $weekly_downloads as $weekly_download ) { |
|
| 567 | + ?> |
|
| 568 | 568 | <li><?php echo wp_kses_post( do_shortcode( '[download id="' . $weekly_download . '"]' ) ); ?></li> |
| 569 | 569 | <?php |
| 570 | - } |
|
| 571 | - ?> |
|
| 570 | + } |
|
| 571 | + ?> |
|
| 572 | 572 | </ul> |
| 573 | 573 | </div> |
| 574 | 574 | <?php |
| 575 | - } |
|
| 575 | + } |
|
| 576 | 576 | } |
| 577 | 577 | |
| 578 | 578 | /** |
@@ -581,9 +581,9 @@ discard block |
||
| 581 | 581 | * @return void |
| 582 | 582 | */ |
| 583 | 583 | function lsx_health_plan_items( $args = array() ) { |
| 584 | - global $shortcode_args; |
|
| 585 | - $shortcode_args = $args; |
|
| 586 | - include LSX_HEALTH_PLAN_PATH . '/templates/partials/shortcode-loop.php'; |
|
| 584 | + global $shortcode_args; |
|
| 585 | + $shortcode_args = $args; |
|
| 586 | + include LSX_HEALTH_PLAN_PATH . '/templates/partials/shortcode-loop.php'; |
|
| 587 | 587 | } |
| 588 | 588 | |
| 589 | 589 | /** |
@@ -592,10 +592,10 @@ discard block |
||
| 592 | 592 | * @return void |
| 593 | 593 | */ |
| 594 | 594 | function lsx_health_plan_featured_video_block() { |
| 595 | - if ( ! post_type_exists( 'video' ) ) { |
|
| 596 | - return; |
|
| 597 | - } |
|
| 598 | - include LSX_HEALTH_PLAN_PATH . '/templates/featured-videos.php'; |
|
| 595 | + if ( ! post_type_exists( 'video' ) ) { |
|
| 596 | + return; |
|
| 597 | + } |
|
| 598 | + include LSX_HEALTH_PLAN_PATH . '/templates/featured-videos.php'; |
|
| 599 | 599 | } |
| 600 | 600 | |
| 601 | 601 | /** |
@@ -604,10 +604,10 @@ discard block |
||
| 604 | 604 | * @return void |
| 605 | 605 | */ |
| 606 | 606 | function lsx_health_plan_featured_recipes_block() { |
| 607 | - if ( ! post_type_exists( 'recipe' ) ) { |
|
| 608 | - return; |
|
| 609 | - } |
|
| 610 | - include LSX_HEALTH_PLAN_PATH . '/templates/featured-recipes.php'; |
|
| 607 | + if ( ! post_type_exists( 'recipe' ) ) { |
|
| 608 | + return; |
|
| 609 | + } |
|
| 610 | + include LSX_HEALTH_PLAN_PATH . '/templates/featured-recipes.php'; |
|
| 611 | 611 | } |
| 612 | 612 | |
| 613 | 613 | /** |
@@ -616,7 +616,7 @@ discard block |
||
| 616 | 616 | * @return void |
| 617 | 617 | */ |
| 618 | 618 | function lsx_health_plan_featured_tips_block() { |
| 619 | - include LSX_HEALTH_PLAN_PATH . '/templates/featured-tips.php'; |
|
| 619 | + include LSX_HEALTH_PLAN_PATH . '/templates/featured-tips.php'; |
|
| 620 | 620 | } |
| 621 | 621 | |
| 622 | 622 | /** |
@@ -626,11 +626,11 @@ discard block |
||
| 626 | 626 | * @return void |
| 627 | 627 | */ |
| 628 | 628 | function lsx_health_plan_day_button() { |
| 629 | - if ( lsx_health_plan_is_day_complete() ) { |
|
| 630 | - lsx_health_plan_unlock_button(); |
|
| 631 | - } else { |
|
| 632 | - lsx_health_plan_complete_button(); |
|
| 633 | - } |
|
| 629 | + if ( lsx_health_plan_is_day_complete() ) { |
|
| 630 | + lsx_health_plan_unlock_button(); |
|
| 631 | + } else { |
|
| 632 | + lsx_health_plan_complete_button(); |
|
| 633 | + } |
|
| 634 | 634 | } |
| 635 | 635 | |
| 636 | 636 | /** |
@@ -639,7 +639,7 @@ discard block |
||
| 639 | 639 | * @return void |
| 640 | 640 | */ |
| 641 | 641 | function lsx_health_plan_complete_button() { |
| 642 | - ?> |
|
| 642 | + ?> |
|
| 643 | 643 | <div class="single-plan-inner-buttons"> |
| 644 | 644 | <form action="<?php the_permalink(); ?>" method="post" class="form-complete-day complete-plan-btn"> |
| 645 | 645 | <?php wp_nonce_field( 'complete', 'lsx-health-plan-actions' ); ?> |
@@ -657,7 +657,7 @@ discard block |
||
| 657 | 657 | * @return void |
| 658 | 658 | */ |
| 659 | 659 | function lsx_health_plan_unlock_button() { |
| 660 | - ?> |
|
| 660 | + ?> |
|
| 661 | 661 | <div class="single-plan-inner-buttons"> |
| 662 | 662 | <form action="<?php the_permalink(); ?>" method="post" class="form-complete-day complete-plan-btn"> |
| 663 | 663 | <?php wp_nonce_field( 'unlock', 'lsx-health-plan-actions' ); ?> |
@@ -676,10 +676,10 @@ discard block |
||
| 676 | 676 | * @return void |
| 677 | 677 | */ |
| 678 | 678 | function lsx_health_plan_single_nav() { |
| 679 | - $tab_template_path = apply_filters( 'lsx_health_plan_single_nav_path', LSX_HEALTH_PLAN_PATH . '/templates/single-plan-tabs.php' ); |
|
| 680 | - if ( '' !== $tab_template_path ) { |
|
| 681 | - require $tab_template_path; |
|
| 682 | - } |
|
| 679 | + $tab_template_path = apply_filters( 'lsx_health_plan_single_nav_path', LSX_HEALTH_PLAN_PATH . '/templates/single-plan-tabs.php' ); |
|
| 680 | + if ( '' !== $tab_template_path ) { |
|
| 681 | + require $tab_template_path; |
|
| 682 | + } |
|
| 683 | 683 | } |
| 684 | 684 | |
| 685 | 685 | /** |
@@ -689,32 +689,32 @@ discard block |
||
| 689 | 689 | * @return void |
| 690 | 690 | */ |
| 691 | 691 | function lsx_health_plan_single_tabs() { |
| 692 | - $endpoint = get_query_var( 'endpoint' ); |
|
| 693 | - switch ( $endpoint ) { |
|
| 694 | - case 'meal': |
|
| 695 | - $tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-meal.php'; |
|
| 696 | - break; |
|
| 697 | - |
|
| 698 | - case 'recipes': |
|
| 699 | - $tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-recipes.php'; |
|
| 700 | - break; |
|
| 701 | - |
|
| 702 | - case 'workout': |
|
| 703 | - $tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-workout.php'; |
|
| 704 | - break; |
|
| 705 | - |
|
| 706 | - case 'warm-up': |
|
| 707 | - $tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-warm-up.php'; |
|
| 708 | - break; |
|
| 709 | - |
|
| 710 | - default: |
|
| 711 | - $tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-plan.php'; |
|
| 712 | - break; |
|
| 713 | - } |
|
| 714 | - $tab_template_path = apply_filters( 'lsx_health_plan_single_tab_path', $tab_template_path ); |
|
| 715 | - if ( '' !== $tab_template_path ) { |
|
| 716 | - include $tab_template_path; |
|
| 717 | - } |
|
| 692 | + $endpoint = get_query_var( 'endpoint' ); |
|
| 693 | + switch ( $endpoint ) { |
|
| 694 | + case 'meal': |
|
| 695 | + $tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-meal.php'; |
|
| 696 | + break; |
|
| 697 | + |
|
| 698 | + case 'recipes': |
|
| 699 | + $tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-recipes.php'; |
|
| 700 | + break; |
|
| 701 | + |
|
| 702 | + case 'workout': |
|
| 703 | + $tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-workout.php'; |
|
| 704 | + break; |
|
| 705 | + |
|
| 706 | + case 'warm-up': |
|
| 707 | + $tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-warm-up.php'; |
|
| 708 | + break; |
|
| 709 | + |
|
| 710 | + default: |
|
| 711 | + $tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-plan.php'; |
|
| 712 | + break; |
|
| 713 | + } |
|
| 714 | + $tab_template_path = apply_filters( 'lsx_health_plan_single_tab_path', $tab_template_path ); |
|
| 715 | + if ( '' !== $tab_template_path ) { |
|
| 716 | + include $tab_template_path; |
|
| 717 | + } |
|
| 718 | 718 | } |
| 719 | 719 | |
| 720 | 720 | /** |
@@ -723,7 +723,7 @@ discard block |
||
| 723 | 723 | * @return void |
| 724 | 724 | */ |
| 725 | 725 | function lsx_health_plan_recipe_data() { |
| 726 | - include LSX_HEALTH_PLAN_PATH . '/templates/table-recipe-data.php'; |
|
| 726 | + include LSX_HEALTH_PLAN_PATH . '/templates/table-recipe-data.php'; |
|
| 727 | 727 | } |
| 728 | 728 | |
| 729 | 729 | /** |
@@ -732,11 +732,11 @@ discard block |
||
| 732 | 732 | * @return recipe_type |
| 733 | 733 | */ |
| 734 | 734 | function lsx_health_plan_recipe_type() { |
| 735 | - $term_obj_list = get_the_terms( get_the_ID(), 'recipe-type' ); |
|
| 736 | - $recipe_type = $term_obj_list[0]->name; |
|
| 737 | - if ( ! empty( $recipe_type ) ) { |
|
| 738 | - return $recipe_type; |
|
| 739 | - } |
|
| 735 | + $term_obj_list = get_the_terms( get_the_ID(), 'recipe-type' ); |
|
| 736 | + $recipe_type = $term_obj_list[0]->name; |
|
| 737 | + if ( ! empty( $recipe_type ) ) { |
|
| 738 | + return $recipe_type; |
|
| 739 | + } |
|
| 740 | 740 | } |
| 741 | 741 | |
| 742 | 742 | /** |
@@ -747,35 +747,35 @@ discard block |
||
| 747 | 747 | * @return void |
| 748 | 748 | */ |
| 749 | 749 | function lsx_health_plan_workout_video_play_button( $m, $group, $echo = true ) { |
| 750 | - $workout_video = ''; |
|
| 751 | - $giphy = ''; |
|
| 752 | - $youtube = ''; |
|
| 753 | - if ( isset( $group['connected_videos'] ) && '' !== $group['connected_videos'] ) { |
|
| 754 | - $workout_video = esc_html( $group['connected_videos'] ); |
|
| 755 | - $giphy = get_post_meta( $workout_video, 'video_giphy_source', true ); |
|
| 756 | - $youtube = esc_url( get_post_meta( $workout_video, 'video_youtube_source', 1 ) ); |
|
| 757 | - $content = get_post_field( 'post_content', $workout_video ); |
|
| 758 | - $play_button = '<button data-toggle="modal" data-target="#workout-video-modal-' . $m . '"><span class="fa fa-play-circle"></span></button>'; |
|
| 759 | - |
|
| 760 | - $modal_body = ''; |
|
| 761 | - if ( ! empty( $giphy ) ) { |
|
| 762 | - $giphy = \lsx_health_plan\functions\get_video_url( $giphy ); |
|
| 763 | - $modal_body = $giphy; // WPCS: XSS OK. |
|
| 764 | - } elseif ( ! empty( $youtube ) ) { |
|
| 765 | - $modal_body = wp_oembed_get( $youtube, array( // WPCS: XSS OK. |
|
| 766 | - 'width' => 480, |
|
| 767 | - ) ); |
|
| 768 | - } |
|
| 769 | - $modal_body .= '<h5 class="modal-title title-lined">' . $group['name'] . '</h5>'; |
|
| 770 | - $modal_body .= $content; |
|
| 771 | - \lsx_health_plan\functions\register_modal( 'workout-video-modal-' . $m, '', $modal_body ); |
|
| 772 | - |
|
| 773 | - if ( true === $echo ) { |
|
| 774 | - echo wp_kses_post( $play_button ); |
|
| 775 | - } else { |
|
| 776 | - return $play_button; |
|
| 777 | - } |
|
| 778 | - } |
|
| 750 | + $workout_video = ''; |
|
| 751 | + $giphy = ''; |
|
| 752 | + $youtube = ''; |
|
| 753 | + if ( isset( $group['connected_videos'] ) && '' !== $group['connected_videos'] ) { |
|
| 754 | + $workout_video = esc_html( $group['connected_videos'] ); |
|
| 755 | + $giphy = get_post_meta( $workout_video, 'video_giphy_source', true ); |
|
| 756 | + $youtube = esc_url( get_post_meta( $workout_video, 'video_youtube_source', 1 ) ); |
|
| 757 | + $content = get_post_field( 'post_content', $workout_video ); |
|
| 758 | + $play_button = '<button data-toggle="modal" data-target="#workout-video-modal-' . $m . '"><span class="fa fa-play-circle"></span></button>'; |
|
| 759 | + |
|
| 760 | + $modal_body = ''; |
|
| 761 | + if ( ! empty( $giphy ) ) { |
|
| 762 | + $giphy = \lsx_health_plan\functions\get_video_url( $giphy ); |
|
| 763 | + $modal_body = $giphy; // WPCS: XSS OK. |
|
| 764 | + } elseif ( ! empty( $youtube ) ) { |
|
| 765 | + $modal_body = wp_oembed_get( $youtube, array( // WPCS: XSS OK. |
|
| 766 | + 'width' => 480, |
|
| 767 | + ) ); |
|
| 768 | + } |
|
| 769 | + $modal_body .= '<h5 class="modal-title title-lined">' . $group['name'] . '</h5>'; |
|
| 770 | + $modal_body .= $content; |
|
| 771 | + \lsx_health_plan\functions\register_modal( 'workout-video-modal-' . $m, '', $modal_body ); |
|
| 772 | + |
|
| 773 | + if ( true === $echo ) { |
|
| 774 | + echo wp_kses_post( $play_button ); |
|
| 775 | + } else { |
|
| 776 | + return $play_button; |
|
| 777 | + } |
|
| 778 | + } |
|
| 779 | 779 | } |
| 780 | 780 | |
| 781 | 781 | /** |
@@ -784,21 +784,21 @@ discard block |
||
| 784 | 784 | * @return void |
| 785 | 785 | */ |
| 786 | 786 | function lsx_health_plan_recipe_archive_description() { |
| 787 | - $description = ''; |
|
| 788 | - if ( is_post_type_archive( 'recipe' ) ) { |
|
| 789 | - $description = \lsx_health_plan\functions\get_option( 'recipe_archive_description', '' ); |
|
| 790 | - } elseif ( is_post_type_archive( 'exercise' ) ) { |
|
| 791 | - $description = \lsx_health_plan\functions\get_option( 'exercise_archive_description', '' ); |
|
| 792 | - } elseif ( is_tax() ) { |
|
| 793 | - $description = get_the_archive_description(); |
|
| 794 | - } |
|
| 795 | - if ( '' !== $description ) { |
|
| 796 | - ?> |
|
| 787 | + $description = ''; |
|
| 788 | + if ( is_post_type_archive( 'recipe' ) ) { |
|
| 789 | + $description = \lsx_health_plan\functions\get_option( 'recipe_archive_description', '' ); |
|
| 790 | + } elseif ( is_post_type_archive( 'exercise' ) ) { |
|
| 791 | + $description = \lsx_health_plan\functions\get_option( 'exercise_archive_description', '' ); |
|
| 792 | + } elseif ( is_tax() ) { |
|
| 793 | + $description = get_the_archive_description(); |
|
| 794 | + } |
|
| 795 | + if ( '' !== $description ) { |
|
| 796 | + ?> |
|
| 797 | 797 | <div class="lsx-hp-archive-description row"> |
| 798 | 798 | <div class="col-xs-12 description-wrapper"><?php echo wp_kses_post( wpautop( $description ) ); ?></div> |
| 799 | 799 | </div> |
| 800 | 800 | <?php |
| 801 | - } |
|
| 801 | + } |
|
| 802 | 802 | } |
| 803 | 803 | |
| 804 | 804 | /** |
@@ -807,23 +807,23 @@ discard block |
||
| 807 | 807 | * @return void |
| 808 | 808 | */ |
| 809 | 809 | function lsx_health_plan_workout_main_content() { |
| 810 | - // Getting translated endpoint. |
|
| 811 | - $workout = \lsx_health_plan\functions\get_option( 'endpoint_workout', 'workout' ); |
|
| 812 | - |
|
| 813 | - $connected_members = get_post_meta( get_the_ID(), ( $workout . '_connected_team_member' ), true ); |
|
| 814 | - $small_description = get_post_meta( get_the_ID(), ( $workout . '_short_description' ), true ); |
|
| 815 | - |
|
| 816 | - $content = ''; |
|
| 817 | - if ( $small_description || $connected_members || lsx_health_plan_has_tips() ) { |
|
| 818 | - $content .= '<div class="short-desc set-box set content-box entry-content">'; |
|
| 819 | - $content .= '<div class="the-content">'; |
|
| 820 | - $content .= lsx_hp_member_connected( $connected_members, $workout ); |
|
| 821 | - $content .= '<span>' . $small_description . '</span>'; |
|
| 822 | - $content .= '</div>'; |
|
| 823 | - $content .= do_shortcode( '[lsx_health_plan_featured_tips_block]' ); |
|
| 824 | - $content .= '</div>'; |
|
| 825 | - } |
|
| 826 | - return $content; |
|
| 810 | + // Getting translated endpoint. |
|
| 811 | + $workout = \lsx_health_plan\functions\get_option( 'endpoint_workout', 'workout' ); |
|
| 812 | + |
|
| 813 | + $connected_members = get_post_meta( get_the_ID(), ( $workout . '_connected_team_member' ), true ); |
|
| 814 | + $small_description = get_post_meta( get_the_ID(), ( $workout . '_short_description' ), true ); |
|
| 815 | + |
|
| 816 | + $content = ''; |
|
| 817 | + if ( $small_description || $connected_members || lsx_health_plan_has_tips() ) { |
|
| 818 | + $content .= '<div class="short-desc set-box set content-box entry-content">'; |
|
| 819 | + $content .= '<div class="the-content">'; |
|
| 820 | + $content .= lsx_hp_member_connected( $connected_members, $workout ); |
|
| 821 | + $content .= '<span>' . $small_description . '</span>'; |
|
| 822 | + $content .= '</div>'; |
|
| 823 | + $content .= do_shortcode( '[lsx_health_plan_featured_tips_block]' ); |
|
| 824 | + $content .= '</div>'; |
|
| 825 | + } |
|
| 826 | + return $content; |
|
| 827 | 827 | } |
| 828 | 828 | |
| 829 | 829 | /** |
@@ -832,23 +832,23 @@ discard block |
||
| 832 | 832 | * @return void |
| 833 | 833 | */ |
| 834 | 834 | function lsx_health_plan_meal_main_content() { |
| 835 | - // Getting translated endpoint. |
|
| 836 | - $meal = \lsx_health_plan\functions\get_option( 'endpoint_meal', 'meal' ); |
|
| 837 | - |
|
| 838 | - $connected_members = get_post_meta( get_the_ID(), ( $meal . '_connected_team_member' ), true ); |
|
| 839 | - $small_description = get_post_meta( get_the_ID(), ( $meal . '_short_description' ), true ); |
|
| 840 | - |
|
| 841 | - $content_meal = ''; |
|
| 842 | - if ( $small_description || $connected_members || lsx_health_plan_has_tips() ) { |
|
| 843 | - $content_meal .= '<div class="set-box set content-box entry-content">'; |
|
| 844 | - $content_meal .= '<div class="the-content">'; |
|
| 845 | - $content_meal .= lsx_hp_member_connected( $connected_members, $meal ); |
|
| 846 | - $content_meal .= '<span>' . $small_description . '</span>'; |
|
| 847 | - $content_meal .= '</div>'; |
|
| 848 | - $content_meal .= do_shortcode( '[lsx_health_plan_featured_tips_block]' ); |
|
| 849 | - $content_meal .= '</div>'; |
|
| 850 | - } |
|
| 851 | - return $content_meal; |
|
| 835 | + // Getting translated endpoint. |
|
| 836 | + $meal = \lsx_health_plan\functions\get_option( 'endpoint_meal', 'meal' ); |
|
| 837 | + |
|
| 838 | + $connected_members = get_post_meta( get_the_ID(), ( $meal . '_connected_team_member' ), true ); |
|
| 839 | + $small_description = get_post_meta( get_the_ID(), ( $meal . '_short_description' ), true ); |
|
| 840 | + |
|
| 841 | + $content_meal = ''; |
|
| 842 | + if ( $small_description || $connected_members || lsx_health_plan_has_tips() ) { |
|
| 843 | + $content_meal .= '<div class="set-box set content-box entry-content">'; |
|
| 844 | + $content_meal .= '<div class="the-content">'; |
|
| 845 | + $content_meal .= lsx_hp_member_connected( $connected_members, $meal ); |
|
| 846 | + $content_meal .= '<span>' . $small_description . '</span>'; |
|
| 847 | + $content_meal .= '</div>'; |
|
| 848 | + $content_meal .= do_shortcode( '[lsx_health_plan_featured_tips_block]' ); |
|
| 849 | + $content_meal .= '</div>'; |
|
| 850 | + } |
|
| 851 | + return $content_meal; |
|
| 852 | 852 | } |
| 853 | 853 | |
| 854 | 854 | |
@@ -859,36 +859,36 @@ discard block |
||
| 859 | 859 | * @return void |
| 860 | 860 | */ |
| 861 | 861 | function lsx_health_plan_workout_tab_content( $index = 1 ) { |
| 862 | - global $group_name,$shortcode_args; |
|
| 863 | - $group_name = 'workout_section_' . $index; |
|
| 864 | - if ( false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) { |
|
| 865 | - $layout = strtolower( \lsx_health_plan\functions\get_option( 'workout_tab_layout', 'table' ) ); |
|
| 866 | - |
|
| 867 | - // Check for shortcode overrides. |
|
| 868 | - if ( null !== $shortcode_args && isset( $shortcode_args['layout'] ) ) { |
|
| 869 | - $layout = $shortcode_args['layout']; |
|
| 870 | - } |
|
| 871 | - } else { |
|
| 872 | - $layout = 'table'; |
|
| 873 | - } |
|
| 874 | - |
|
| 875 | - switch ( $layout ) { |
|
| 876 | - case 'list': |
|
| 877 | - $tab_template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-list.php'; |
|
| 878 | - break; |
|
| 879 | - |
|
| 880 | - case 'grid': |
|
| 881 | - $tab_template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-grid.php'; |
|
| 882 | - break; |
|
| 883 | - |
|
| 884 | - case 'table': |
|
| 885 | - $tab_template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-table.php'; |
|
| 886 | - break; |
|
| 887 | - } |
|
| 888 | - $tab_template_path = apply_filters( 'lsx_health_plan_workout_tab_content_path', $tab_template_path ); |
|
| 889 | - if ( '' !== $tab_template_path ) { |
|
| 890 | - include $tab_template_path; |
|
| 891 | - } |
|
| 862 | + global $group_name,$shortcode_args; |
|
| 863 | + $group_name = 'workout_section_' . $index; |
|
| 864 | + if ( false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) { |
|
| 865 | + $layout = strtolower( \lsx_health_plan\functions\get_option( 'workout_tab_layout', 'table' ) ); |
|
| 866 | + |
|
| 867 | + // Check for shortcode overrides. |
|
| 868 | + if ( null !== $shortcode_args && isset( $shortcode_args['layout'] ) ) { |
|
| 869 | + $layout = $shortcode_args['layout']; |
|
| 870 | + } |
|
| 871 | + } else { |
|
| 872 | + $layout = 'table'; |
|
| 873 | + } |
|
| 874 | + |
|
| 875 | + switch ( $layout ) { |
|
| 876 | + case 'list': |
|
| 877 | + $tab_template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-list.php'; |
|
| 878 | + break; |
|
| 879 | + |
|
| 880 | + case 'grid': |
|
| 881 | + $tab_template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-grid.php'; |
|
| 882 | + break; |
|
| 883 | + |
|
| 884 | + case 'table': |
|
| 885 | + $tab_template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-table.php'; |
|
| 886 | + break; |
|
| 887 | + } |
|
| 888 | + $tab_template_path = apply_filters( 'lsx_health_plan_workout_tab_content_path', $tab_template_path ); |
|
| 889 | + if ( '' !== $tab_template_path ) { |
|
| 890 | + include $tab_template_path; |
|
| 891 | + } |
|
| 892 | 892 | } |
| 893 | 893 | |
| 894 | 894 | /** |
@@ -897,28 +897,28 @@ discard block |
||
| 897 | 897 | * @return void |
| 898 | 898 | */ |
| 899 | 899 | function lsx_health_plan_workout_sets() { |
| 900 | - if ( is_singular( 'workout' ) ) { |
|
| 901 | - global $connected_workouts; |
|
| 902 | - $connected_workouts = array( get_the_ID() ); |
|
| 903 | - } |
|
| 904 | - if ( is_singular( 'plan' ) ) { |
|
| 905 | - |
|
| 906 | - global $connected_workouts; |
|
| 907 | - |
|
| 908 | - $section_key = get_query_var( 'section' ); |
|
| 909 | - if ( '' !== $section && \lsx_health_plan\functions\plan\has_sections() ) { |
|
| 910 | - $section_info = \lsx_health_plan\functions\plan\get_section_info( $section_key ); |
|
| 911 | - if ( isset( $section_info['connected_workouts'] ) && '' !== $section_info['connected_workouts'] ) { |
|
| 912 | - |
|
| 913 | - $connected_workouts = \lsx_health_plan\functions\prep_array( $section_info['connected_workouts'] ); |
|
| 914 | - } |
|
| 915 | - } |
|
| 916 | - } |
|
| 917 | - $template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-sets.php'; |
|
| 918 | - $template_path = apply_filters( 'lsx_health_plan_workout_set_template_path', $template_path ); |
|
| 919 | - if ( '' !== $template_path && ! empty( $template_path ) ) { |
|
| 920 | - include $template_path; |
|
| 921 | - } |
|
| 900 | + if ( is_singular( 'workout' ) ) { |
|
| 901 | + global $connected_workouts; |
|
| 902 | + $connected_workouts = array( get_the_ID() ); |
|
| 903 | + } |
|
| 904 | + if ( is_singular( 'plan' ) ) { |
|
| 905 | + |
|
| 906 | + global $connected_workouts; |
|
| 907 | + |
|
| 908 | + $section_key = get_query_var( 'section' ); |
|
| 909 | + if ( '' !== $section && \lsx_health_plan\functions\plan\has_sections() ) { |
|
| 910 | + $section_info = \lsx_health_plan\functions\plan\get_section_info( $section_key ); |
|
| 911 | + if ( isset( $section_info['connected_workouts'] ) && '' !== $section_info['connected_workouts'] ) { |
|
| 912 | + |
|
| 913 | + $connected_workouts = \lsx_health_plan\functions\prep_array( $section_info['connected_workouts'] ); |
|
| 914 | + } |
|
| 915 | + } |
|
| 916 | + } |
|
| 917 | + $template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-sets.php'; |
|
| 918 | + $template_path = apply_filters( 'lsx_health_plan_workout_set_template_path', $template_path ); |
|
| 919 | + if ( '' !== $template_path && ! empty( $template_path ) ) { |
|
| 920 | + include $template_path; |
|
| 921 | + } |
|
| 922 | 922 | } |
| 923 | 923 | |
| 924 | 924 | /** |
@@ -929,11 +929,11 @@ discard block |
||
| 929 | 929 | */ |
| 930 | 930 | function lsx_health_plan_warmup_sets( $connected_workouts ) { |
| 931 | 931 | |
| 932 | - $template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-sets.php'; |
|
| 933 | - $template_path = apply_filters( 'lsx_health_plan_workout_set_template_path', $template_path ); |
|
| 934 | - if ( '' !== $template_path && ! empty( $template_path ) ) { |
|
| 935 | - include $template_path; |
|
| 936 | - } |
|
| 932 | + $template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-sets.php'; |
|
| 933 | + $template_path = apply_filters( 'lsx_health_plan_workout_set_template_path', $template_path ); |
|
| 934 | + if ( '' !== $template_path && ! empty( $template_path ) ) { |
|
| 935 | + include $template_path; |
|
| 936 | + } |
|
| 937 | 937 | } |
| 938 | 938 | |
| 939 | 939 | /** |
@@ -943,48 +943,48 @@ discard block |
||
| 943 | 943 | * @return void |
| 944 | 944 | */ |
| 945 | 945 | function lsx_hp_meal_plan_recipes( $args = array() ) { |
| 946 | - $defaults = array( |
|
| 947 | - 'meal_id' => false, |
|
| 948 | - 'meal_time' => '', |
|
| 949 | - 'modal' => true, |
|
| 950 | - ); |
|
| 951 | - $args = wp_parse_args( $args, $defaults ); |
|
| 952 | - // Looking for recipes. |
|
| 953 | - $connected_recipes = get_post_meta( $args['meal_id'], $args['meal_time'] . '_recipes', true ); |
|
| 954 | - if ( ! empty( $connected_recipes ) ) { |
|
| 955 | - $query_args = array( |
|
| 956 | - 'orderby' => 'date', |
|
| 957 | - 'order' => 'DESC', |
|
| 958 | - 'post_type' => 'recipe', |
|
| 959 | - 'post__in' => $connected_recipes, |
|
| 960 | - ); |
|
| 961 | - $recipes = new WP_Query( $query_args ); |
|
| 962 | - ?> |
|
| 946 | + $defaults = array( |
|
| 947 | + 'meal_id' => false, |
|
| 948 | + 'meal_time' => '', |
|
| 949 | + 'modal' => true, |
|
| 950 | + ); |
|
| 951 | + $args = wp_parse_args( $args, $defaults ); |
|
| 952 | + // Looking for recipes. |
|
| 953 | + $connected_recipes = get_post_meta( $args['meal_id'], $args['meal_time'] . '_recipes', true ); |
|
| 954 | + if ( ! empty( $connected_recipes ) ) { |
|
| 955 | + $query_args = array( |
|
| 956 | + 'orderby' => 'date', |
|
| 957 | + 'order' => 'DESC', |
|
| 958 | + 'post_type' => 'recipe', |
|
| 959 | + 'post__in' => $connected_recipes, |
|
| 960 | + ); |
|
| 961 | + $recipes = new WP_Query( $query_args ); |
|
| 962 | + ?> |
|
| 963 | 963 | <div class="recipes"> |
| 964 | 964 | <div class="row eating-row"> |
| 965 | 965 | <?php |
| 966 | - if ( $recipes->have_posts() ) { |
|
| 967 | - while ( $recipes->have_posts() ) { |
|
| 968 | - $recipes->the_post(); |
|
| 969 | - if ( false !== $args['modal'] ) { |
|
| 970 | - \lsx_health_plan\functions\recipes\register_recipe_modal(); |
|
| 971 | - } |
|
| 972 | - ?> |
|
| 966 | + if ( $recipes->have_posts() ) { |
|
| 967 | + while ( $recipes->have_posts() ) { |
|
| 968 | + $recipes->the_post(); |
|
| 969 | + if ( false !== $args['modal'] ) { |
|
| 970 | + \lsx_health_plan\functions\recipes\register_recipe_modal(); |
|
| 971 | + } |
|
| 972 | + ?> |
|
| 973 | 973 | <div class="recipe-column"> |
| 974 | 974 | <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"> |
| 975 | 975 | <div class="recipe-feature-img"> |
| 976 | 976 | <?php |
| 977 | - $featured_image = get_the_post_thumbnail(); |
|
| 978 | - if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
| 979 | - the_post_thumbnail( 'lsx-thumbnail-square', array( |
|
| 980 | - 'class' => 'aligncenter', |
|
| 981 | - ) ); |
|
| 982 | - } else { |
|
| 983 | - ?> |
|
| 977 | + $featured_image = get_the_post_thumbnail(); |
|
| 978 | + if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
| 979 | + the_post_thumbnail( 'lsx-thumbnail-square', array( |
|
| 980 | + 'class' => 'aligncenter', |
|
| 981 | + ) ); |
|
| 982 | + } else { |
|
| 983 | + ?> |
|
| 984 | 984 | <img loading="lazy" class="placeholder" src="<?php echo esc_attr( plugin_dir_url( __DIR__ ) . 'assets/images/placeholder.jpg' ); ?>"> |
| 985 | 985 | <?php |
| 986 | - } |
|
| 987 | - ?> |
|
| 986 | + } |
|
| 987 | + ?> |
|
| 988 | 988 | </div> |
| 989 | 989 | <div class="recipe-content"> |
| 990 | 990 | <h3 class="recipe-title"><?php the_title(); ?></h3> |
@@ -993,41 +993,41 @@ discard block |
||
| 993 | 993 | </a> |
| 994 | 994 | </div> |
| 995 | 995 | <?php |
| 996 | - } |
|
| 997 | - } |
|
| 998 | - wp_reset_postdata(); |
|
| 999 | - ?> |
|
| 996 | + } |
|
| 997 | + } |
|
| 998 | + wp_reset_postdata(); |
|
| 999 | + ?> |
|
| 1000 | 1000 | </div> |
| 1001 | 1001 | </div> |
| 1002 | 1002 | <?php |
| 1003 | 1003 | |
| 1004 | - } |
|
| 1004 | + } |
|
| 1005 | 1005 | } |
| 1006 | 1006 | |
| 1007 | 1007 | /** |
| 1008 | 1008 | * Output the connected. |
| 1009 | 1009 | */ |
| 1010 | 1010 | function lsx_hp_recipe_plan_meta( $args = array() ) { |
| 1011 | - $defaults = array(); |
|
| 1012 | - $top_level_plans = array(); |
|
| 1013 | - // Get meals this exercise is connected to. |
|
| 1014 | - $plans = get_post_meta( get_the_ID(), 'connected_plans', true ); |
|
| 1015 | - if ( ! empty( $plans ) ) { |
|
| 1016 | - $plan = end( $plans ); |
|
| 1017 | - $has_parent = wp_get_post_parent_id( $plan ); |
|
| 1018 | - if ( 0 === $has_parent ) { |
|
| 1019 | - $top_level_plans[] = $plan; |
|
| 1020 | - } elseif ( false !== $top_level_plans ) { |
|
| 1021 | - $top_level_plans[] = $has_parent; |
|
| 1022 | - } |
|
| 1023 | - } |
|
| 1024 | - if ( ! empty( $top_level_plans ) && ( '' !== $top_level_plans ) ) { |
|
| 1025 | - $top_level_plans = array_unique( $top_level_plans ); |
|
| 1026 | - $top_level_plan = end( $top_level_plans ); |
|
| 1027 | - ?> |
|
| 1011 | + $defaults = array(); |
|
| 1012 | + $top_level_plans = array(); |
|
| 1013 | + // Get meals this exercise is connected to. |
|
| 1014 | + $plans = get_post_meta( get_the_ID(), 'connected_plans', true ); |
|
| 1015 | + if ( ! empty( $plans ) ) { |
|
| 1016 | + $plan = end( $plans ); |
|
| 1017 | + $has_parent = wp_get_post_parent_id( $plan ); |
|
| 1018 | + if ( 0 === $has_parent ) { |
|
| 1019 | + $top_level_plans[] = $plan; |
|
| 1020 | + } elseif ( false !== $top_level_plans ) { |
|
| 1021 | + $top_level_plans[] = $has_parent; |
|
| 1022 | + } |
|
| 1023 | + } |
|
| 1024 | + if ( ! empty( $top_level_plans ) && ( '' !== $top_level_plans ) ) { |
|
| 1025 | + $top_level_plans = array_unique( $top_level_plans ); |
|
| 1026 | + $top_level_plan = end( $top_level_plans ); |
|
| 1027 | + ?> |
|
| 1028 | 1028 | <span class="recipe-type recipe-parent"><?php echo esc_html( get_the_title( $top_level_plan ) ); ?></span> |
| 1029 | 1029 | <?php |
| 1030 | - } |
|
| 1030 | + } |
|
| 1031 | 1031 | } |
| 1032 | 1032 | |
| 1033 | 1033 | /** |
@@ -1035,42 +1035,42 @@ discard block |
||
| 1035 | 1035 | */ |
| 1036 | 1036 | function lsx_hp_exercise_plan_meta() { |
| 1037 | 1037 | |
| 1038 | - $top_level_plans = array(); |
|
| 1039 | - |
|
| 1040 | - // Get workouts this exercise is connected to. |
|
| 1041 | - $workouts = get_post_meta( get_the_ID(), 'connected_workouts', true ); |
|
| 1042 | - |
|
| 1043 | - if ( '' !== $workouts && ! is_array( $workouts ) ) { |
|
| 1044 | - $workouts = array( $workouts ); |
|
| 1045 | - } |
|
| 1046 | - if ( ! empty( $workouts ) ) { |
|
| 1047 | - foreach ( $workouts as $workout ) { |
|
| 1048 | - // Get the plans this workout is connected to. |
|
| 1049 | - $plans = get_post_meta( $workout, 'connected_plans', true ); |
|
| 1050 | - |
|
| 1051 | - if ( '' !== $plans && ! is_array( $plans ) ) { |
|
| 1052 | - $plans = array( $plans ); |
|
| 1053 | - } |
|
| 1054 | - if ( ! empty( $plans ) ) { |
|
| 1055 | - foreach ( $plans as $plan ) { |
|
| 1056 | - $has_parent = wp_get_post_parent_id( $plan ); |
|
| 1057 | - if ( 0 === $has_parent ) { |
|
| 1058 | - $top_level_plans = $plan; |
|
| 1059 | - } else { |
|
| 1060 | - $top_level_plans = $has_parent; |
|
| 1061 | - } |
|
| 1062 | - } |
|
| 1063 | - } |
|
| 1064 | - } |
|
| 1065 | - } |
|
| 1066 | - |
|
| 1067 | - if ( ! empty( $top_level_plans ) && ( '' !== $top_level_plans ) ) { |
|
| 1068 | - $top_level_plans = array_unique( $top_level_plans ); |
|
| 1069 | - $top_level_plan = end( $top_level_plans ); |
|
| 1070 | - ?> |
|
| 1038 | + $top_level_plans = array(); |
|
| 1039 | + |
|
| 1040 | + // Get workouts this exercise is connected to. |
|
| 1041 | + $workouts = get_post_meta( get_the_ID(), 'connected_workouts', true ); |
|
| 1042 | + |
|
| 1043 | + if ( '' !== $workouts && ! is_array( $workouts ) ) { |
|
| 1044 | + $workouts = array( $workouts ); |
|
| 1045 | + } |
|
| 1046 | + if ( ! empty( $workouts ) ) { |
|
| 1047 | + foreach ( $workouts as $workout ) { |
|
| 1048 | + // Get the plans this workout is connected to. |
|
| 1049 | + $plans = get_post_meta( $workout, 'connected_plans', true ); |
|
| 1050 | + |
|
| 1051 | + if ( '' !== $plans && ! is_array( $plans ) ) { |
|
| 1052 | + $plans = array( $plans ); |
|
| 1053 | + } |
|
| 1054 | + if ( ! empty( $plans ) ) { |
|
| 1055 | + foreach ( $plans as $plan ) { |
|
| 1056 | + $has_parent = wp_get_post_parent_id( $plan ); |
|
| 1057 | + if ( 0 === $has_parent ) { |
|
| 1058 | + $top_level_plans = $plan; |
|
| 1059 | + } else { |
|
| 1060 | + $top_level_plans = $has_parent; |
|
| 1061 | + } |
|
| 1062 | + } |
|
| 1063 | + } |
|
| 1064 | + } |
|
| 1065 | + } |
|
| 1066 | + |
|
| 1067 | + if ( ! empty( $top_level_plans ) && ( '' !== $top_level_plans ) ) { |
|
| 1068 | + $top_level_plans = array_unique( $top_level_plans ); |
|
| 1069 | + $top_level_plan = end( $top_level_plans ); |
|
| 1070 | + ?> |
|
| 1071 | 1071 | <span class="recipe-type recipe-parent"><?php echo esc_html( get_the_title( $top_level_plan ) ); ?></span> |
| 1072 | 1072 | <?php |
| 1073 | - } |
|
| 1073 | + } |
|
| 1074 | 1074 | } |
| 1075 | 1075 | |
| 1076 | 1076 | /** |
@@ -1080,7 +1080,7 @@ discard block |
||
| 1080 | 1080 | * @return void |
| 1081 | 1081 | */ |
| 1082 | 1082 | function lsx_hp_single_related( $related_content, $post_type_text ) { |
| 1083 | - ?> |
|
| 1083 | + ?> |
|
| 1084 | 1084 | <section id="lsx-hp-related"> |
| 1085 | 1085 | <div class="row lsx-related-posts lsx-related-posts-title"> |
| 1086 | 1086 | <div class="col-xs-12"> |
@@ -1091,14 +1091,14 @@ discard block |
||
| 1091 | 1091 | <div class="col-xs-12"> |
| 1092 | 1092 | <div class="lsx-related-posts-wrapper"> |
| 1093 | 1093 | <?php |
| 1094 | - $i = 0; |
|
| 1095 | - foreach ( $related_content as $article ) { |
|
| 1096 | - $post_title = get_the_title( $article ); |
|
| 1097 | - $post_categories = wp_get_post_categories( $article ); |
|
| 1098 | - $post_link = get_permalink( $article ); |
|
| 1099 | - |
|
| 1100 | - $cats = array(); |
|
| 1101 | - ?> |
|
| 1094 | + $i = 0; |
|
| 1095 | + foreach ( $related_content as $article ) { |
|
| 1096 | + $post_title = get_the_title( $article ); |
|
| 1097 | + $post_categories = wp_get_post_categories( $article ); |
|
| 1098 | + $post_link = get_permalink( $article ); |
|
| 1099 | + |
|
| 1100 | + $cats = array(); |
|
| 1101 | + ?> |
|
| 1102 | 1102 | <article id="post-<?php echo esc_html( $article ); ?>" class="lsx-slot post"> |
| 1103 | 1103 | <div class="entry-layout lsx-hp-shadow"> |
| 1104 | 1104 | <div class="entry-layout-content"> |
@@ -1106,25 +1106,25 @@ discard block |
||
| 1106 | 1106 | <div class="entry-image"> |
| 1107 | 1107 | <a href="<?php echo esc_url( $post_link ); ?>" class="thumbnail"> |
| 1108 | 1108 | <?php |
| 1109 | - $featured_image = get_the_post_thumbnail( $article, 'lsx-thumbnail-wide' ); |
|
| 1110 | - if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
| 1111 | - echo wp_kses_post( $featured_image ); |
|
| 1112 | - } else { |
|
| 1113 | - ?> |
|
| 1109 | + $featured_image = get_the_post_thumbnail( $article, 'lsx-thumbnail-wide' ); |
|
| 1110 | + if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
| 1111 | + echo wp_kses_post( $featured_image ); |
|
| 1112 | + } else { |
|
| 1113 | + ?> |
|
| 1114 | 1114 | <img loading="lazy" class="placeholder" src="<?php echo esc_attr( plugin_dir_url( __FILE__ ) . '../assets/images/placeholder.jpg' ); ?>"> |
| 1115 | 1115 | <?php |
| 1116 | - } |
|
| 1117 | - ?> |
|
| 1116 | + } |
|
| 1117 | + ?> |
|
| 1118 | 1118 | </a> |
| 1119 | 1119 | </div> |
| 1120 | 1120 | <div class="entry-meta"> |
| 1121 | 1121 | <?php |
| 1122 | - foreach ( $post_categories as $c ) { |
|
| 1123 | - $cat = get_category( $c ); |
|
| 1124 | - /* Translators: %s: category name */ |
|
| 1125 | - $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>'; |
|
| 1126 | - } |
|
| 1127 | - if ( ! empty( $cats ) ) { ?> |
|
| 1122 | + foreach ( $post_categories as $c ) { |
|
| 1123 | + $cat = get_category( $c ); |
|
| 1124 | + /* Translators: %s: category name */ |
|
| 1125 | + $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>'; |
|
| 1126 | + } |
|
| 1127 | + if ( ! empty( $cats ) ) { ?> |
|
| 1128 | 1128 | <div class="post-categories"><span></span><?php echo wp_kses_post( implode( ', ', $cats ) ); ?></div> |
| 1129 | 1129 | <?php } ?> |
| 1130 | 1130 | </div> |
@@ -1139,8 +1139,8 @@ discard block |
||
| 1139 | 1139 | </article> |
| 1140 | 1140 | |
| 1141 | 1141 | <?php |
| 1142 | - if (++$i === 3) break; |
|
| 1143 | - } ?> |
|
| 1142 | + if (++$i === 3) break; |
|
| 1143 | + } ?> |
|
| 1144 | 1144 | </div> |
| 1145 | 1145 | </div> |
| 1146 | 1146 | </div> |
@@ -1155,32 +1155,32 @@ discard block |
||
| 1155 | 1155 | * @return void |
| 1156 | 1156 | */ |
| 1157 | 1157 | function lsx_hp_member_connected( $connected_members, $post_type ) { |
| 1158 | - if ( ! empty( $connected_members ) ) { |
|
| 1159 | - $content = '<div id="hp-connected-members" class="hp-connected-members connected-' . $post_type . '">'; |
|
| 1160 | - foreach ( $connected_members as $member ) { |
|
| 1161 | - $post_link = get_permalink( $member ); |
|
| 1162 | - $member_name = get_the_title( $member ); |
|
| 1163 | - $member_name = '<span class="lsx-team-name">' . $member_name . '</span>'; |
|
| 1164 | - |
|
| 1165 | - $member_link = '<a href="' . $post_link . '" >' . $member_name . '</a>'; |
|
| 1166 | - |
|
| 1167 | - $roles = ''; |
|
| 1168 | - $terms = get_the_terms( $member, 'team_role' ); |
|
| 1169 | - |
|
| 1170 | - if ( $terms && ! is_wp_error( $terms ) ) { |
|
| 1171 | - $roles = array(); |
|
| 1172 | - |
|
| 1173 | - foreach ( $terms as $term ) { |
|
| 1174 | - $roles[] = $term->name; |
|
| 1175 | - } |
|
| 1176 | - |
|
| 1177 | - $roles = join( ', ', $roles ); |
|
| 1178 | - } |
|
| 1179 | - $member_roles = '' !== $roles ? "<small class='lsx-team-roles'>$roles</small>" : ''; |
|
| 1180 | - |
|
| 1181 | - $content .= '<p>' . $member_roles . ': ' . $member_link . '</p>'; |
|
| 1182 | - } |
|
| 1183 | - $content .= '</div>'; |
|
| 1184 | - return $content; |
|
| 1185 | - } |
|
| 1158 | + if ( ! empty( $connected_members ) ) { |
|
| 1159 | + $content = '<div id="hp-connected-members" class="hp-connected-members connected-' . $post_type . '">'; |
|
| 1160 | + foreach ( $connected_members as $member ) { |
|
| 1161 | + $post_link = get_permalink( $member ); |
|
| 1162 | + $member_name = get_the_title( $member ); |
|
| 1163 | + $member_name = '<span class="lsx-team-name">' . $member_name . '</span>'; |
|
| 1164 | + |
|
| 1165 | + $member_link = '<a href="' . $post_link . '" >' . $member_name . '</a>'; |
|
| 1166 | + |
|
| 1167 | + $roles = ''; |
|
| 1168 | + $terms = get_the_terms( $member, 'team_role' ); |
|
| 1169 | + |
|
| 1170 | + if ( $terms && ! is_wp_error( $terms ) ) { |
|
| 1171 | + $roles = array(); |
|
| 1172 | + |
|
| 1173 | + foreach ( $terms as $term ) { |
|
| 1174 | + $roles[] = $term->name; |
|
| 1175 | + } |
|
| 1176 | + |
|
| 1177 | + $roles = join( ', ', $roles ); |
|
| 1178 | + } |
|
| 1179 | + $member_roles = '' !== $roles ? "<small class='lsx-team-roles'>$roles</small>" : ''; |
|
| 1180 | + |
|
| 1181 | + $content .= '<p>' . $member_roles . ': ' . $member_link . '</p>'; |
|
| 1182 | + } |
|
| 1183 | + $content .= '</div>'; |
|
| 1184 | + return $content; |
|
| 1185 | + } |
|
| 1186 | 1186 | } |
@@ -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,19 +166,19 @@ 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 | <li class=" |
| 175 | 175 | <?php |
| 176 | - if ( function_exists( 'is_wc_endpoint_url' ) && is_wc_endpoint_url( 'edit-account' ) ) { |
|
| 177 | - echo esc_attr( 'active' ); |
|
| 176 | + if (function_exists('is_wc_endpoint_url') && is_wc_endpoint_url('edit-account')) { |
|
| 177 | + echo esc_attr('active'); |
|
| 178 | 178 | } |
| 179 | 179 | ?> |
| 180 | - "><a class="account-details-tab" href="<?php the_permalink(); ?>edit-account/"><?php esc_html_e( 'Account Details', 'lsx-health-plan' ); ?></a></li> |
|
| 181 | - <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> |
|
| 180 | + "><a class="account-details-tab" href="<?php the_permalink(); ?>edit-account/"><?php esc_html_e('Account Details', 'lsx-health-plan'); ?></a></li> |
|
| 181 | + <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> |
|
| 182 | 182 | </ul> |
| 183 | 183 | </div> |
| 184 | 184 | <?php |
@@ -193,76 +193,76 @@ discard block |
||
| 193 | 193 | ?> |
| 194 | 194 | <div class="lsx-health-plan my-profile-block wp-block-cover alignfull"> |
| 195 | 195 | <div class="wp-block-cover__inner-container"> |
| 196 | - <h2><?php esc_html_e( 'My Dashboard', 'lsx-health-plan' ); ?></h2> |
|
| 196 | + <h2><?php esc_html_e('My Dashboard', 'lsx-health-plan'); ?></h2> |
|
| 197 | 197 | <section id="dashboard-card"> |
| 198 | 198 | <div class="profile-navigation"> |
| 199 | 199 | <div class="profile-photo"> |
| 200 | 200 | <?php |
| 201 | 201 | global $current_user; |
| 202 | 202 | get_current_user(); |
| 203 | - echo get_avatar( $current_user->ID, 240 ); |
|
| 203 | + echo get_avatar($current_user->ID, 240); |
|
| 204 | 204 | ?> |
| 205 | 205 | </div> |
| 206 | 206 | </div> |
| 207 | 207 | <div class="profile-details"> |
| 208 | - <h1 class="title-lined has-text-color"><?php echo esc_html( $current_user->display_name ); ?></h1> |
|
| 208 | + <h1 class="title-lined has-text-color"><?php echo esc_html($current_user->display_name); ?></h1> |
|
| 209 | 209 | <?php |
| 210 | - $disable_stats = \lsx_health_plan\functions\get_option( 'disable_all_stats', false ); |
|
| 211 | - if ( 'on' !== $disable_stats ) { |
|
| 210 | + $disable_stats = \lsx_health_plan\functions\get_option('disable_all_stats', false); |
|
| 211 | + if ('on' !== $disable_stats) { |
|
| 212 | 212 | |
| 213 | - $is_weight_disabled = \lsx_health_plan\functions\get_option( 'disable_weight_checkbox', false ); |
|
| 214 | - $is_height_disabled = \lsx_health_plan\functions\get_option( 'disable_height_checkbox', false ); |
|
| 215 | - $is_waist_disabled = \lsx_health_plan\functions\get_option( 'disable_waist_checkbox', false ); |
|
| 216 | - $is_bmi_disabled = \lsx_health_plan\functions\get_option( 'disable_bmi_checkbox', false ); |
|
| 213 | + $is_weight_disabled = \lsx_health_plan\functions\get_option('disable_weight_checkbox', false); |
|
| 214 | + $is_height_disabled = \lsx_health_plan\functions\get_option('disable_height_checkbox', false); |
|
| 215 | + $is_waist_disabled = \lsx_health_plan\functions\get_option('disable_waist_checkbox', false); |
|
| 216 | + $is_bmi_disabled = \lsx_health_plan\functions\get_option('disable_bmi_checkbox', false); |
|
| 217 | 217 | |
| 218 | - $weight = get_user_meta( get_current_user_id(), 'weight', true ); |
|
| 219 | - $waist = get_user_meta( get_current_user_id(), 'waist', true ); |
|
| 220 | - $height = get_user_meta( get_current_user_id(), 'height', true ); |
|
| 218 | + $weight = get_user_meta(get_current_user_id(), 'weight', true); |
|
| 219 | + $waist = get_user_meta(get_current_user_id(), 'waist', true); |
|
| 220 | + $height = get_user_meta(get_current_user_id(), 'height', true); |
|
| 221 | 221 | |
| 222 | 222 | $height_m = 0; |
| 223 | - if ( is_numeric( $height) ) { |
|
| 223 | + if (is_numeric($height)) { |
|
| 224 | 224 | $height_m = $height / 100; |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | - if ( 1 < $weight && 1 < $height_m ) { |
|
| 228 | - $bmi = $weight / ( $height_m * $height_m ); |
|
| 229 | - $bmi = number_format( $bmi, 1 ); |
|
| 227 | + if (1 < $weight && 1 < $height_m) { |
|
| 228 | + $bmi = $weight / ($height_m * $height_m); |
|
| 229 | + $bmi = number_format($bmi, 1); |
|
| 230 | 230 | } else { |
| 231 | - $bmi = __( 'Add more data', 'lsx-health-plan' ); |
|
| 231 | + $bmi = __('Add more data', 'lsx-health-plan'); |
|
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | ?> |
| 235 | 235 | |
| 236 | 236 | <div> |
| 237 | - <?php if ( 'on' !== $is_weight_disabled ) { ?> |
|
| 238 | - <span><strong><?php esc_html_e( 'Weight:', 'lsx-health-plan' ); ?></strong> |
|
| 237 | + <?php if ('on' !== $is_weight_disabled) { ?> |
|
| 238 | + <span><strong><?php esc_html_e('Weight:', 'lsx-health-plan'); ?></strong> |
|
| 239 | 239 | <?php |
| 240 | - if ( '' !== $weight ) { |
|
| 241 | - echo wp_kses_post( $weight . ' kg' ); |
|
| 240 | + if ('' !== $weight) { |
|
| 241 | + echo wp_kses_post($weight . ' kg'); |
|
| 242 | 242 | } else { |
| 243 | 243 | echo '/'; |
| 244 | 244 | } |
| 245 | 245 | ?> |
| 246 | 246 | </span> |
| 247 | 247 | <?php } |
| 248 | - if ( 'on' !== $is_waist_disabled ) { |
|
| 248 | + if ('on' !== $is_waist_disabled) { |
|
| 249 | 249 | ?> |
| 250 | - <span><strong><?php esc_html_e( 'Waist:', 'lsx-health-plan' ); ?></strong> |
|
| 250 | + <span><strong><?php esc_html_e('Waist:', 'lsx-health-plan'); ?></strong> |
|
| 251 | 251 | <?php |
| 252 | - if ( '' !== $waist ) { |
|
| 253 | - echo wp_kses_post( $waist . ' cm' ); |
|
| 252 | + if ('' !== $waist) { |
|
| 253 | + echo wp_kses_post($waist . ' cm'); |
|
| 254 | 254 | } else { |
| 255 | 255 | echo '/'; |
| 256 | 256 | } |
| 257 | 257 | ?> |
| 258 | 258 | </span> |
| 259 | 259 | <?php } |
| 260 | - if ( 'on' !== $is_bmi_disabled ) { |
|
| 260 | + if ('on' !== $is_bmi_disabled) { |
|
| 261 | 261 | ?> |
| 262 | - <span><strong><?php esc_html_e( 'BMI:', 'lsx-health-plan' ); ?></strong> |
|
| 262 | + <span><strong><?php esc_html_e('BMI:', 'lsx-health-plan'); ?></strong> |
|
| 263 | 263 | <?php |
| 264 | - if ( '' !== $bmi ) { |
|
| 265 | - echo wp_kses_post( $bmi ); |
|
| 264 | + if ('' !== $bmi) { |
|
| 265 | + echo wp_kses_post($bmi); |
|
| 266 | 266 | } else { |
| 267 | 267 | echo '/'; |
| 268 | 268 | } |
@@ -275,13 +275,13 @@ discard block |
||
| 275 | 275 | ?> |
| 276 | 276 | <div class="edit-profile"> |
| 277 | 277 | <?php |
| 278 | - if ( function_exists( 'wc_get_page_id' ) ) { |
|
| 279 | - $url_id = wc_get_page_id( 'myaccount' ); |
|
| 278 | + if (function_exists('wc_get_page_id')) { |
|
| 279 | + $url_id = wc_get_page_id('myaccount'); |
|
| 280 | 280 | } else { |
| 281 | 281 | $url_id = ''; |
| 282 | 282 | } |
| 283 | 283 | ?> |
| 284 | - <a href="<?php echo esc_url( get_permalink( $url_id ) ); ?>edit-account/"><?php esc_html_e( 'Edit', 'lsx-health-plan' ); ?></a> |
|
| 284 | + <a href="<?php echo esc_url(get_permalink($url_id)); ?>edit-account/"><?php esc_html_e('Edit', 'lsx-health-plan'); ?></a> |
|
| 285 | 285 | </div> |
| 286 | 286 | </div> |
| 287 | 287 | </section> |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | ); |
| 308 | 308 | |
| 309 | 309 | $product_ids = \lsx_health_plan\functions\woocommerce\get_membership_products(); |
| 310 | - if ( ! empty( $product_ids ) ) { |
|
| 310 | + if ( ! empty($product_ids)) { |
|
| 311 | 311 | $args['meta_query'] = array( |
| 312 | 312 | 'relation' => 'OR', |
| 313 | 313 | array( |
@@ -322,82 +322,82 @@ discard block |
||
| 322 | 322 | ); |
| 323 | 323 | } |
| 324 | 324 | |
| 325 | - $the_query = new WP_Query( $args ); |
|
| 325 | + $the_query = new WP_Query($args); |
|
| 326 | 326 | ?> |
| 327 | 327 | <div class="all-plans-block plan-grid block-all-plans-block"> |
| 328 | 328 | <div class="row"> |
| 329 | 329 | <?php |
| 330 | - if ( $the_query->have_posts() ) : |
|
| 331 | - while ( $the_query->have_posts() ) : |
|
| 330 | + if ($the_query->have_posts()) : |
|
| 331 | + while ($the_query->have_posts()) : |
|
| 332 | 332 | $the_query->the_post(); |
| 333 | 333 | lsx_entry_before(); |
| 334 | 334 | $completed_class = ''; |
| 335 | 335 | $linked_product = false; |
| 336 | 336 | $restricted = false; |
| 337 | 337 | $product = null; |
| 338 | - if ( function_exists( 'lsx_health_plan\functions\woocommerce\plan_has_products' ) && \lsx_health_plan\functions\woocommerce\plan_has_products() ) { |
|
| 338 | + if (function_exists('lsx_health_plan\functions\woocommerce\plan_has_products') && \lsx_health_plan\functions\woocommerce\plan_has_products()) { |
|
| 339 | 339 | $products = \lsx_health_plan\functions\woocommerce\get_plan_products(); |
| 340 | - $linked_product = wc_get_product( $products[0] ); |
|
| 340 | + $linked_product = wc_get_product($products[0]); |
|
| 341 | 341 | $product = $linked_product; |
| 342 | 342 | } |
| 343 | - if ( function_exists( 'wc_memberships_is_post_content_restricted' ) ) { |
|
| 344 | - $restricted = wc_memberships_is_post_content_restricted( get_the_ID() ) && ! current_user_can( 'wc_memberships_view_restricted_post_content', get_the_ID() ); |
|
| 343 | + if (function_exists('wc_memberships_is_post_content_restricted')) { |
|
| 344 | + $restricted = wc_memberships_is_post_content_restricted(get_the_ID()) && ! current_user_can('wc_memberships_view_restricted_post_content', get_the_ID()); |
|
| 345 | 345 | } |
| 346 | 346 | |
| 347 | - if ( lsx_health_plan_is_plan_complete() ) { |
|
| 347 | + if (lsx_health_plan_is_plan_complete()) { |
|
| 348 | 348 | $completed_class = 'completed'; |
| 349 | 349 | } |
| 350 | 350 | $round_progress = ''; |
| 351 | 351 | $completed_progress = '100'; |
| 352 | - if ( false === $restricted ) { |
|
| 353 | - $round_progress = round( \lsx_health_plan\functions\get_progress( get_the_ID() ), 0 ); |
|
| 352 | + if (false === $restricted) { |
|
| 353 | + $round_progress = round(\lsx_health_plan\functions\get_progress(get_the_ID()), 0); |
|
| 354 | 354 | } |
| 355 | 355 | ?> |
| 356 | 356 | <div class="col-xs-12 col-sm-6 col-md-4"> |
| 357 | - <article class="lsx-slot lsx-hp-shadow <?php echo esc_html( 'progress-') . $round_progress; ?>"> |
|
| 357 | + <article class="lsx-slot lsx-hp-shadow <?php echo esc_html('progress-') . $round_progress; ?>"> |
|
| 358 | 358 | <div class="plan-feature-img"> |
| 359 | - <?php if ( (int)$completed_progress === (int)$round_progress ) { ?> |
|
| 360 | - <span class="featured-plan"><?php lsx_get_svg_icon( 'icon-completed.svg' ); ?></span> |
|
| 359 | + <?php if ((int) $completed_progress === (int) $round_progress) { ?> |
|
| 360 | + <span class="featured-plan"><?php lsx_get_svg_icon('icon-completed.svg'); ?></span> |
|
| 361 | 361 | <?php } ?> |
| 362 | - <a href="<?php echo esc_url( get_permalink() ); ?>"> |
|
| 362 | + <a href="<?php echo esc_url(get_permalink()); ?>"> |
|
| 363 | 363 | <?php |
| 364 | 364 | $featured_image = get_the_post_thumbnail(); |
| 365 | - if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
| 366 | - the_post_thumbnail( 'lsx-thumbnail', array( |
|
| 365 | + if ( ! empty($featured_image) && '' !== $featured_image) { |
|
| 366 | + the_post_thumbnail('lsx-thumbnail', array( |
|
| 367 | 367 | 'class' => 'aligncenter', |
| 368 | - ) ); |
|
| 368 | + )); |
|
| 369 | 369 | } else { |
| 370 | 370 | ?> |
| 371 | - <img loading="lazy" class="placeholder" src="<?php echo esc_attr( plugin_dir_url( __FILE__ ) . '../assets/images/placeholder.jpg' ); ?>"> |
|
| 371 | + <img loading="lazy" class="placeholder" src="<?php echo esc_attr(plugin_dir_url(__FILE__) . '../assets/images/placeholder.jpg'); ?>"> |
|
| 372 | 372 | <?php |
| 373 | 373 | } |
| 374 | 374 | ?> |
| 375 | 375 | </a> |
| 376 | 376 | </div> |
| 377 | 377 | <div class="content-box plan-content-box"> |
| 378 | - <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> |
|
| 378 | + <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> |
|
| 379 | 379 | <?php |
| 380 | - echo wp_kses_post( \lsx_health_plan\functions\hp_get_plan_type_meta( $post ) ); |
|
| 380 | + echo wp_kses_post(\lsx_health_plan\functions\hp_get_plan_type_meta($post)); |
|
| 381 | 381 | ?> |
| 382 | 382 | <?php |
| 383 | - if ( false !== $linked_product && false !== $restricted ) { |
|
| 384 | - echo wp_kses_post( $linked_product->get_price_html() ); |
|
| 383 | + if (false !== $linked_product && false !== $restricted) { |
|
| 384 | + echo wp_kses_post($linked_product->get_price_html()); |
|
| 385 | 385 | } |
| 386 | 386 | ?> |
| 387 | 387 | <div class="excerpt"> |
| 388 | 388 | <?php |
| 389 | - if ( ! has_excerpt() ) { |
|
| 390 | - $content = wp_trim_words( get_the_content(), 20 ); |
|
| 389 | + if ( ! has_excerpt()) { |
|
| 390 | + $content = wp_trim_words(get_the_content(), 20); |
|
| 391 | 391 | $content = '<p>' . $content . '</pre>'; |
| 392 | 392 | } else { |
| 393 | - $content = apply_filters( 'the_excerpt', get_the_excerpt() ); |
|
| 393 | + $content = apply_filters('the_excerpt', get_the_excerpt()); |
|
| 394 | 394 | } |
| 395 | - echo wp_kses_post( $content ); |
|
| 395 | + echo wp_kses_post($content); |
|
| 396 | 396 | ?> |
| 397 | 397 | </div> |
| 398 | 398 | <?php |
| 399 | - if ( false === $restricted ) { |
|
| 400 | - 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>' ); |
|
| 399 | + if (false === $restricted) { |
|
| 400 | + 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>'); |
|
| 401 | 401 | } |
| 402 | 402 | ?> |
| 403 | 403 | </div> |
@@ -417,30 +417,30 @@ discard block |
||
| 417 | 417 | * |
| 418 | 418 | * @return void |
| 419 | 419 | */ |
| 420 | -function lsx_health_plan_day_plan_block( $args = array() ) { |
|
| 420 | +function lsx_health_plan_day_plan_block($args = array()) { |
|
| 421 | 421 | $defaults = array( |
| 422 | 422 | 'plan' => '', |
| 423 | 423 | ); |
| 424 | - $args = wp_parse_args( $args, $defaults ); |
|
| 424 | + $args = wp_parse_args($args, $defaults); |
|
| 425 | 425 | |
| 426 | - if ( isset( $args['plan'] ) && '' !== $args['plan'] && \lsx_health_plan\functions\plan\has_sections( $args['plan'] ) ) { |
|
| 426 | + if (isset($args['plan']) && '' !== $args['plan'] && \lsx_health_plan\functions\plan\has_sections($args['plan'])) { |
|
| 427 | 427 | $sections = \lsx_health_plan\functions\plan\get_sections(); |
| 428 | 428 | ?> |
| 429 | 429 | <div class="daily-plan-block day-grid"> |
| 430 | 430 | <?php |
| 431 | - foreach ( $sections as $section_key => $section_values ) { |
|
| 432 | - $defaults = array( |
|
| 433 | - 'title' => __( 'Day', 'lsx-health-plan' ) . ' ' . ( $section_key + 1 ), |
|
| 431 | + foreach ($sections as $section_key => $section_values) { |
|
| 432 | + $defaults = array( |
|
| 433 | + 'title' => __('Day', 'lsx-health-plan') . ' ' . ($section_key + 1), |
|
| 434 | 434 | ); |
| 435 | - $section_args = wp_parse_args( $section_values, $defaults ); |
|
| 435 | + $section_args = wp_parse_args($section_values, $defaults); |
|
| 436 | 436 | |
| 437 | 437 | $completed_class = ''; |
| 438 | - if ( lsx_health_plan_is_day_complete() ) { |
|
| 438 | + if (lsx_health_plan_is_day_complete()) { |
|
| 439 | 439 | $completed_class = 'completed'; |
| 440 | 440 | } |
| 441 | 441 | ?> |
| 442 | - <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 ); ?>"> |
|
| 443 | - <div class="plan-content"><?php echo esc_attr( $section_args['title'] ); ?></div> |
|
| 442 | + <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); ?>"> |
|
| 443 | + <div class="plan-content"><?php echo esc_attr($section_args['title']); ?></div> |
|
| 444 | 444 | </a> |
| 445 | 445 | <?php |
| 446 | 446 | } |
@@ -456,31 +456,31 @@ discard block |
||
| 456 | 456 | * @param array $args An array of arguments. |
| 457 | 457 | * @return void |
| 458 | 458 | */ |
| 459 | -function lsx_health_plan_week_plan_block( $args = array() ) { |
|
| 459 | +function lsx_health_plan_week_plan_block($args = array()) { |
|
| 460 | 460 | $defaults = array( |
| 461 | 461 | 'show_downloads' => false, |
| 462 | 462 | 'plan' => '', |
| 463 | 463 | ); |
| 464 | - $args = wp_parse_args( $args, $defaults ); |
|
| 464 | + $args = wp_parse_args($args, $defaults); |
|
| 465 | 465 | |
| 466 | - if ( isset( $args['plan'] ) && '' !== $args['plan'] && \lsx_health_plan\functions\plan\has_sections( $args['plan'] ) ) { |
|
| 467 | - $groups = \lsx_health_plan\functions\plan\get_sections( true ); |
|
| 466 | + if (isset($args['plan']) && '' !== $args['plan'] && \lsx_health_plan\functions\plan\has_sections($args['plan'])) { |
|
| 467 | + $groups = \lsx_health_plan\functions\plan\get_sections(true); |
|
| 468 | 468 | |
| 469 | - if ( ! empty( $groups ) ) { |
|
| 469 | + if ( ! empty($groups)) { |
|
| 470 | 470 | $counter = 1; |
| 471 | 471 | $group_open = false; |
| 472 | 472 | |
| 473 | - foreach ( $groups as $group_key => $sections ) { |
|
| 473 | + foreach ($groups as $group_key => $sections) { |
|
| 474 | 474 | $collapse_class = ''; |
| 475 | - $group_title = \lsx_health_plan\functions\plan\get_group_title( $sections ); |
|
| 475 | + $group_title = \lsx_health_plan\functions\plan\get_group_title($sections); |
|
| 476 | 476 | |
| 477 | 477 | // Determine if the current week is complete. |
| 478 | - $day_ids = wp_list_pluck( $sections, 'title' ); |
|
| 479 | - if ( false === $group_open ) { |
|
| 480 | - if ( 1 === $counter && ! \lsx_health_plan\functions\is_week_complete( false, $day_ids, $group_title ) ) { |
|
| 478 | + $day_ids = wp_list_pluck($sections, 'title'); |
|
| 479 | + if (false === $group_open) { |
|
| 480 | + if (1 === $counter && ! \lsx_health_plan\functions\is_week_complete(false, $day_ids, $group_title)) { |
|
| 481 | 481 | $collapse_class = 'in'; |
| 482 | 482 | $group_open = true; |
| 483 | - } elseif ( ! \lsx_health_plan\functions\is_week_complete( false, $day_ids, $group_title ) ) { |
|
| 483 | + } elseif ( ! \lsx_health_plan\functions\is_week_complete(false, $day_ids, $group_title)) { |
|
| 484 | 484 | $collapse_class = 'in'; |
| 485 | 485 | $group_open = true; |
| 486 | 486 | } |
@@ -488,47 +488,47 @@ discard block |
||
| 488 | 488 | |
| 489 | 489 | // Determine if there are any weekly downloads. |
| 490 | 490 | $week_downloads_view = ''; |
| 491 | - if ( isset( $args['show_downloads'] ) && false !== $args['show_downloads'] ) { |
|
| 492 | - $weekly_downloads = \lsx_health_plan\functions\get_weekly_downloads( $group_key ); |
|
| 493 | - if ( ! empty( $weekly_downloads ) ) { |
|
| 491 | + if (isset($args['show_downloads']) && false !== $args['show_downloads']) { |
|
| 492 | + $weekly_downloads = \lsx_health_plan\functions\get_weekly_downloads($group_key); |
|
| 493 | + if ( ! empty($weekly_downloads)) { |
|
| 494 | 494 | $week_downloads_view = 'week-downloads-view-on'; |
| 495 | 495 | } |
| 496 | 496 | } |
| 497 | 497 | ?> |
| 498 | 498 | <div class="daily-plan-block week-grid"> |
| 499 | - <a href="#group-<?php echo esc_attr( $group_key ); ?>" data-toggle="collapse" class="week-title"><?php echo esc_attr( $group_title ); ?></a> |
|
| 500 | - <div id="group-<?php echo esc_attr( $group_key ); ?>" class="week-row collapse <?php echo esc_attr( $collapse_class ); ?>"> |
|
| 501 | - <div class="week-row-inner <?php echo esc_html( $week_downloads_view ); ?>"> |
|
| 499 | + <a href="#group-<?php echo esc_attr($group_key); ?>" data-toggle="collapse" class="week-title"><?php echo esc_attr($group_title); ?></a> |
|
| 500 | + <div id="group-<?php echo esc_attr($group_key); ?>" class="week-row collapse <?php echo esc_attr($collapse_class); ?>"> |
|
| 501 | + <div class="week-row-inner <?php echo esc_html($week_downloads_view); ?>"> |
|
| 502 | 502 | <div class="week-meals-recipes-box"> |
| 503 | 503 | |
| 504 | - <?php if ( ! empty( $week_downloads_view ) ) { ?> |
|
| 505 | - <h3 class="title"><?php lsx_get_svg_icon( 'daily-plan.svg' ); ?><?php echo esc_html_e( 'Plan', 'lsx-health-plan' ); ?></h3> |
|
| 504 | + <?php if ( ! empty($week_downloads_view)) { ?> |
|
| 505 | + <h3 class="title"><?php lsx_get_svg_icon('daily-plan.svg'); ?><?php echo esc_html_e('Plan', 'lsx-health-plan'); ?></h3> |
|
| 506 | 506 | <?php } ?> |
| 507 | 507 | |
| 508 | 508 | <div class="week-meals-recipes-box-inner"> |
| 509 | 509 | <?php |
| 510 | 510 | |
| 511 | - foreach ( $sections as $section_key => $section_values ) { |
|
| 511 | + foreach ($sections as $section_key => $section_values) { |
|
| 512 | 512 | |
| 513 | - $defaults = array( |
|
| 514 | - 'title' => __( 'Day', 'lsx-health-plan' ) . ' ' . ( $section_key + 1 ), |
|
| 513 | + $defaults = array( |
|
| 514 | + 'title' => __('Day', 'lsx-health-plan') . ' ' . ($section_key + 1), |
|
| 515 | 515 | ); |
| 516 | - $section_args = wp_parse_args( $section_values, $defaults ); |
|
| 516 | + $section_args = wp_parse_args($section_values, $defaults); |
|
| 517 | 517 | |
| 518 | 518 | $completed_class = ''; |
| 519 | - if ( lsx_health_plan_is_day_complete( $args['plan'], $section_args['title'] ) ) { |
|
| 519 | + if (lsx_health_plan_is_day_complete($args['plan'], $section_args['title'])) { |
|
| 520 | 520 | $completed_class = 'completed'; |
| 521 | 521 | } |
| 522 | - if ( $section_args['rest_day_enabled'] && ! $section_args['connected_meals'] ) { |
|
| 522 | + if ($section_args['rest_day_enabled'] && ! $section_args['connected_meals']) { |
|
| 523 | 523 | ?> |
| 524 | - <span class="day id-<?php echo esc_attr( $section_key + 1 ); ?> <?php echo esc_attr( $completed_class ); ?>"> |
|
| 525 | - <div class="plan-content"><?php echo esc_attr( $section_args['title'] ); ?></div> |
|
| 524 | + <span class="day id-<?php echo esc_attr($section_key + 1); ?> <?php echo esc_attr($completed_class); ?>"> |
|
| 525 | + <div class="plan-content"><?php echo esc_attr($section_args['title']); ?></div> |
|
| 526 | 526 | </span> |
| 527 | 527 | <?php |
| 528 | 528 | } else { |
| 529 | 529 | ?> |
| 530 | - <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 ); ?>"> |
|
| 531 | - <div class="plan-content"><?php echo esc_attr( $section_args['title'] ); ?></div> |
|
| 530 | + <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); ?>"> |
|
| 531 | + <div class="plan-content"><?php echo esc_attr($section_args['title']); ?></div> |
|
| 532 | 532 | </a> |
| 533 | 533 | <?php |
| 534 | 534 | } |
@@ -537,8 +537,8 @@ discard block |
||
| 537 | 537 | </div> |
| 538 | 538 | </div> |
| 539 | 539 | <?php |
| 540 | - if ( ! empty( $week_downloads_view ) ) { |
|
| 541 | - lsx_health_plan_weekly_downloads( $weekly_downloads ); |
|
| 540 | + if ( ! empty($week_downloads_view)) { |
|
| 541 | + lsx_health_plan_weekly_downloads($weekly_downloads); |
|
| 542 | 542 | } |
| 543 | 543 | ?> |
| 544 | 544 | </div> |
@@ -556,16 +556,16 @@ discard block |
||
| 556 | 556 | * @param array $weekly_downloads An array of the download ids. |
| 557 | 557 | * @return void |
| 558 | 558 | */ |
| 559 | -function lsx_health_plan_weekly_downloads( $weekly_downloads = array() ) { |
|
| 560 | - if ( ! empty( $weekly_downloads ) ) { |
|
| 559 | +function lsx_health_plan_weekly_downloads($weekly_downloads = array()) { |
|
| 560 | + if ( ! empty($weekly_downloads)) { |
|
| 561 | 561 | ?> |
| 562 | 562 | <div class="week-download-box"> |
| 563 | - <h3 class="title"><?php lsx_get_svg_icon( 'download.svg' ); ?><?php echo esc_html_e( 'Downloads', 'lsx-health-plan' ); ?></h3> |
|
| 563 | + <h3 class="title"><?php lsx_get_svg_icon('download.svg'); ?><?php echo esc_html_e('Downloads', 'lsx-health-plan'); ?></h3> |
|
| 564 | 564 | <ul class="week-download-box-list"> |
| 565 | 565 | <?php |
| 566 | - foreach ( $weekly_downloads as $weekly_download ) { |
|
| 566 | + foreach ($weekly_downloads as $weekly_download) { |
|
| 567 | 567 | ?> |
| 568 | - <li><?php echo wp_kses_post( do_shortcode( '[download id="' . $weekly_download . '"]' ) ); ?></li> |
|
| 568 | + <li><?php echo wp_kses_post(do_shortcode('[download id="' . $weekly_download . '"]')); ?></li> |
|
| 569 | 569 | <?php |
| 570 | 570 | } |
| 571 | 571 | ?> |
@@ -580,7 +580,7 @@ discard block |
||
| 580 | 580 | * |
| 581 | 581 | * @return void |
| 582 | 582 | */ |
| 583 | -function lsx_health_plan_items( $args = array() ) { |
|
| 583 | +function lsx_health_plan_items($args = array()) { |
|
| 584 | 584 | global $shortcode_args; |
| 585 | 585 | $shortcode_args = $args; |
| 586 | 586 | include LSX_HEALTH_PLAN_PATH . '/templates/partials/shortcode-loop.php'; |
@@ -592,7 +592,7 @@ discard block |
||
| 592 | 592 | * @return void |
| 593 | 593 | */ |
| 594 | 594 | function lsx_health_plan_featured_video_block() { |
| 595 | - if ( ! post_type_exists( 'video' ) ) { |
|
| 595 | + if ( ! post_type_exists('video')) { |
|
| 596 | 596 | return; |
| 597 | 597 | } |
| 598 | 598 | include LSX_HEALTH_PLAN_PATH . '/templates/featured-videos.php'; |
@@ -604,7 +604,7 @@ discard block |
||
| 604 | 604 | * @return void |
| 605 | 605 | */ |
| 606 | 606 | function lsx_health_plan_featured_recipes_block() { |
| 607 | - if ( ! post_type_exists( 'recipe' ) ) { |
|
| 607 | + if ( ! post_type_exists('recipe')) { |
|
| 608 | 608 | return; |
| 609 | 609 | } |
| 610 | 610 | include LSX_HEALTH_PLAN_PATH . '/templates/featured-recipes.php'; |
@@ -626,7 +626,7 @@ discard block |
||
| 626 | 626 | * @return void |
| 627 | 627 | */ |
| 628 | 628 | function lsx_health_plan_day_button() { |
| 629 | - if ( lsx_health_plan_is_day_complete() ) { |
|
| 629 | + if (lsx_health_plan_is_day_complete()) { |
|
| 630 | 630 | lsx_health_plan_unlock_button(); |
| 631 | 631 | } else { |
| 632 | 632 | lsx_health_plan_complete_button(); |
@@ -642,9 +642,9 @@ discard block |
||
| 642 | 642 | ?> |
| 643 | 643 | <div class="single-plan-inner-buttons"> |
| 644 | 644 | <form action="<?php the_permalink(); ?>" method="post" class="form-complete-day complete-plan-btn"> |
| 645 | - <?php wp_nonce_field( 'complete', 'lsx-health-plan-actions' ); ?> |
|
| 646 | - <input type="hidden" name="lsx-health-plan-id" value="<?php echo esc_attr( \lsx_health_plan\functions\plan\generate_section_id() ); ?>" /> |
|
| 647 | - <button class="btn cta-btn" type="submit"><?php esc_html_e( 'Complete Day', 'lsx-health-plan' ); ?></button> |
|
| 645 | + <?php wp_nonce_field('complete', 'lsx-health-plan-actions'); ?> |
|
| 646 | + <input type="hidden" name="lsx-health-plan-id" value="<?php echo esc_attr(\lsx_health_plan\functions\plan\generate_section_id()); ?>" /> |
|
| 647 | + <button class="btn cta-btn" type="submit"><?php esc_html_e('Complete Day', 'lsx-health-plan'); ?></button> |
|
| 648 | 648 | </form> |
| 649 | 649 | <?php lsx_health_plan_back_to_plan_button(); ?> |
| 650 | 650 | </div> |
@@ -660,9 +660,9 @@ discard block |
||
| 660 | 660 | ?> |
| 661 | 661 | <div class="single-plan-inner-buttons"> |
| 662 | 662 | <form action="<?php the_permalink(); ?>" method="post" class="form-complete-day complete-plan-btn"> |
| 663 | - <?php wp_nonce_field( 'unlock', 'lsx-health-plan-actions' ); ?> |
|
| 664 | - <input type="hidden" name="lsx-health-plan-id" value="<?php echo esc_attr( \lsx_health_plan\functions\plan\generate_section_id() ); ?>" /> |
|
| 665 | - <button class="btn secondary-btn" type="submit"><?php esc_html_e( 'Im not done!', 'lsx-health-plan' ); ?></button> |
|
| 663 | + <?php wp_nonce_field('unlock', 'lsx-health-plan-actions'); ?> |
|
| 664 | + <input type="hidden" name="lsx-health-plan-id" value="<?php echo esc_attr(\lsx_health_plan\functions\plan\generate_section_id()); ?>" /> |
|
| 665 | + <button class="btn secondary-btn" type="submit"><?php esc_html_e('Im not done!', 'lsx-health-plan'); ?></button> |
|
| 666 | 666 | </form> |
| 667 | 667 | <?php lsx_health_plan_back_to_plan_button(); ?> |
| 668 | 668 | </div> |
@@ -676,8 +676,8 @@ discard block |
||
| 676 | 676 | * @return void |
| 677 | 677 | */ |
| 678 | 678 | function lsx_health_plan_single_nav() { |
| 679 | - $tab_template_path = apply_filters( 'lsx_health_plan_single_nav_path', LSX_HEALTH_PLAN_PATH . '/templates/single-plan-tabs.php' ); |
|
| 680 | - if ( '' !== $tab_template_path ) { |
|
| 679 | + $tab_template_path = apply_filters('lsx_health_plan_single_nav_path', LSX_HEALTH_PLAN_PATH . '/templates/single-plan-tabs.php'); |
|
| 680 | + if ('' !== $tab_template_path) { |
|
| 681 | 681 | require $tab_template_path; |
| 682 | 682 | } |
| 683 | 683 | } |
@@ -689,8 +689,8 @@ discard block |
||
| 689 | 689 | * @return void |
| 690 | 690 | */ |
| 691 | 691 | function lsx_health_plan_single_tabs() { |
| 692 | - $endpoint = get_query_var( 'endpoint' ); |
|
| 693 | - switch ( $endpoint ) { |
|
| 692 | + $endpoint = get_query_var('endpoint'); |
|
| 693 | + switch ($endpoint) { |
|
| 694 | 694 | case 'meal': |
| 695 | 695 | $tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-meal.php'; |
| 696 | 696 | break; |
@@ -711,8 +711,8 @@ discard block |
||
| 711 | 711 | $tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-plan.php'; |
| 712 | 712 | break; |
| 713 | 713 | } |
| 714 | - $tab_template_path = apply_filters( 'lsx_health_plan_single_tab_path', $tab_template_path ); |
|
| 715 | - if ( '' !== $tab_template_path ) { |
|
| 714 | + $tab_template_path = apply_filters('lsx_health_plan_single_tab_path', $tab_template_path); |
|
| 715 | + if ('' !== $tab_template_path) { |
|
| 716 | 716 | include $tab_template_path; |
| 717 | 717 | } |
| 718 | 718 | } |
@@ -732,9 +732,9 @@ discard block |
||
| 732 | 732 | * @return recipe_type |
| 733 | 733 | */ |
| 734 | 734 | function lsx_health_plan_recipe_type() { |
| 735 | - $term_obj_list = get_the_terms( get_the_ID(), 'recipe-type' ); |
|
| 735 | + $term_obj_list = get_the_terms(get_the_ID(), 'recipe-type'); |
|
| 736 | 736 | $recipe_type = $term_obj_list[0]->name; |
| 737 | - if ( ! empty( $recipe_type ) ) { |
|
| 737 | + if ( ! empty($recipe_type)) { |
|
| 738 | 738 | return $recipe_type; |
| 739 | 739 | } |
| 740 | 740 | } |
@@ -746,32 +746,32 @@ discard block |
||
| 746 | 746 | * @param array $group |
| 747 | 747 | * @return void |
| 748 | 748 | */ |
| 749 | -function lsx_health_plan_workout_video_play_button( $m, $group, $echo = true ) { |
|
| 749 | +function lsx_health_plan_workout_video_play_button($m, $group, $echo = true) { |
|
| 750 | 750 | $workout_video = ''; |
| 751 | 751 | $giphy = ''; |
| 752 | 752 | $youtube = ''; |
| 753 | - if ( isset( $group['connected_videos'] ) && '' !== $group['connected_videos'] ) { |
|
| 754 | - $workout_video = esc_html( $group['connected_videos'] ); |
|
| 755 | - $giphy = get_post_meta( $workout_video, 'video_giphy_source', true ); |
|
| 756 | - $youtube = esc_url( get_post_meta( $workout_video, 'video_youtube_source', 1 ) ); |
|
| 757 | - $content = get_post_field( 'post_content', $workout_video ); |
|
| 753 | + if (isset($group['connected_videos']) && '' !== $group['connected_videos']) { |
|
| 754 | + $workout_video = esc_html($group['connected_videos']); |
|
| 755 | + $giphy = get_post_meta($workout_video, 'video_giphy_source', true); |
|
| 756 | + $youtube = esc_url(get_post_meta($workout_video, 'video_youtube_source', 1)); |
|
| 757 | + $content = get_post_field('post_content', $workout_video); |
|
| 758 | 758 | $play_button = '<button data-toggle="modal" data-target="#workout-video-modal-' . $m . '"><span class="fa fa-play-circle"></span></button>'; |
| 759 | 759 | |
| 760 | 760 | $modal_body = ''; |
| 761 | - if ( ! empty( $giphy ) ) { |
|
| 762 | - $giphy = \lsx_health_plan\functions\get_video_url( $giphy ); |
|
| 761 | + if ( ! empty($giphy)) { |
|
| 762 | + $giphy = \lsx_health_plan\functions\get_video_url($giphy); |
|
| 763 | 763 | $modal_body = $giphy; // WPCS: XSS OK. |
| 764 | - } elseif ( ! empty( $youtube ) ) { |
|
| 765 | - $modal_body = wp_oembed_get( $youtube, array( // WPCS: XSS OK. |
|
| 764 | + } elseif ( ! empty($youtube)) { |
|
| 765 | + $modal_body = wp_oembed_get($youtube, array( // WPCS: XSS OK. |
|
| 766 | 766 | 'width' => 480, |
| 767 | - ) ); |
|
| 767 | + )); |
|
| 768 | 768 | } |
| 769 | 769 | $modal_body .= '<h5 class="modal-title title-lined">' . $group['name'] . '</h5>'; |
| 770 | 770 | $modal_body .= $content; |
| 771 | - \lsx_health_plan\functions\register_modal( 'workout-video-modal-' . $m, '', $modal_body ); |
|
| 771 | + \lsx_health_plan\functions\register_modal('workout-video-modal-' . $m, '', $modal_body); |
|
| 772 | 772 | |
| 773 | - if ( true === $echo ) { |
|
| 774 | - echo wp_kses_post( $play_button ); |
|
| 773 | + if (true === $echo) { |
|
| 774 | + echo wp_kses_post($play_button); |
|
| 775 | 775 | } else { |
| 776 | 776 | return $play_button; |
| 777 | 777 | } |
@@ -785,17 +785,17 @@ discard block |
||
| 785 | 785 | */ |
| 786 | 786 | function lsx_health_plan_recipe_archive_description() { |
| 787 | 787 | $description = ''; |
| 788 | - if ( is_post_type_archive( 'recipe' ) ) { |
|
| 789 | - $description = \lsx_health_plan\functions\get_option( 'recipe_archive_description', '' ); |
|
| 790 | - } elseif ( is_post_type_archive( 'exercise' ) ) { |
|
| 791 | - $description = \lsx_health_plan\functions\get_option( 'exercise_archive_description', '' ); |
|
| 792 | - } elseif ( is_tax() ) { |
|
| 788 | + if (is_post_type_archive('recipe')) { |
|
| 789 | + $description = \lsx_health_plan\functions\get_option('recipe_archive_description', ''); |
|
| 790 | + } elseif (is_post_type_archive('exercise')) { |
|
| 791 | + $description = \lsx_health_plan\functions\get_option('exercise_archive_description', ''); |
|
| 792 | + } elseif (is_tax()) { |
|
| 793 | 793 | $description = get_the_archive_description(); |
| 794 | 794 | } |
| 795 | - if ( '' !== $description ) { |
|
| 795 | + if ('' !== $description) { |
|
| 796 | 796 | ?> |
| 797 | 797 | <div class="lsx-hp-archive-description row"> |
| 798 | - <div class="col-xs-12 description-wrapper"><?php echo wp_kses_post( wpautop( $description ) ); ?></div> |
|
| 798 | + <div class="col-xs-12 description-wrapper"><?php echo wp_kses_post(wpautop($description)); ?></div> |
|
| 799 | 799 | </div> |
| 800 | 800 | <?php |
| 801 | 801 | } |
@@ -808,19 +808,19 @@ discard block |
||
| 808 | 808 | */ |
| 809 | 809 | function lsx_health_plan_workout_main_content() { |
| 810 | 810 | // Getting translated endpoint. |
| 811 | - $workout = \lsx_health_plan\functions\get_option( 'endpoint_workout', 'workout' ); |
|
| 811 | + $workout = \lsx_health_plan\functions\get_option('endpoint_workout', 'workout'); |
|
| 812 | 812 | |
| 813 | - $connected_members = get_post_meta( get_the_ID(), ( $workout . '_connected_team_member' ), true ); |
|
| 814 | - $small_description = get_post_meta( get_the_ID(), ( $workout . '_short_description' ), true ); |
|
| 813 | + $connected_members = get_post_meta(get_the_ID(), ($workout . '_connected_team_member'), true); |
|
| 814 | + $small_description = get_post_meta(get_the_ID(), ($workout . '_short_description'), true); |
|
| 815 | 815 | |
| 816 | 816 | $content = ''; |
| 817 | - if ( $small_description || $connected_members || lsx_health_plan_has_tips() ) { |
|
| 817 | + if ($small_description || $connected_members || lsx_health_plan_has_tips()) { |
|
| 818 | 818 | $content .= '<div class="short-desc set-box set content-box entry-content">'; |
| 819 | 819 | $content .= '<div class="the-content">'; |
| 820 | - $content .= lsx_hp_member_connected( $connected_members, $workout ); |
|
| 820 | + $content .= lsx_hp_member_connected($connected_members, $workout); |
|
| 821 | 821 | $content .= '<span>' . $small_description . '</span>'; |
| 822 | 822 | $content .= '</div>'; |
| 823 | - $content .= do_shortcode( '[lsx_health_plan_featured_tips_block]' ); |
|
| 823 | + $content .= do_shortcode('[lsx_health_plan_featured_tips_block]'); |
|
| 824 | 824 | $content .= '</div>'; |
| 825 | 825 | } |
| 826 | 826 | return $content; |
@@ -833,19 +833,19 @@ discard block |
||
| 833 | 833 | */ |
| 834 | 834 | function lsx_health_plan_meal_main_content() { |
| 835 | 835 | // Getting translated endpoint. |
| 836 | - $meal = \lsx_health_plan\functions\get_option( 'endpoint_meal', 'meal' ); |
|
| 836 | + $meal = \lsx_health_plan\functions\get_option('endpoint_meal', 'meal'); |
|
| 837 | 837 | |
| 838 | - $connected_members = get_post_meta( get_the_ID(), ( $meal . '_connected_team_member' ), true ); |
|
| 839 | - $small_description = get_post_meta( get_the_ID(), ( $meal . '_short_description' ), true ); |
|
| 838 | + $connected_members = get_post_meta(get_the_ID(), ($meal . '_connected_team_member'), true); |
|
| 839 | + $small_description = get_post_meta(get_the_ID(), ($meal . '_short_description'), true); |
|
| 840 | 840 | |
| 841 | 841 | $content_meal = ''; |
| 842 | - if ( $small_description || $connected_members || lsx_health_plan_has_tips() ) { |
|
| 842 | + if ($small_description || $connected_members || lsx_health_plan_has_tips()) { |
|
| 843 | 843 | $content_meal .= '<div class="set-box set content-box entry-content">'; |
| 844 | 844 | $content_meal .= '<div class="the-content">'; |
| 845 | - $content_meal .= lsx_hp_member_connected( $connected_members, $meal ); |
|
| 845 | + $content_meal .= lsx_hp_member_connected($connected_members, $meal); |
|
| 846 | 846 | $content_meal .= '<span>' . $small_description . '</span>'; |
| 847 | 847 | $content_meal .= '</div>'; |
| 848 | - $content_meal .= do_shortcode( '[lsx_health_plan_featured_tips_block]' ); |
|
| 848 | + $content_meal .= do_shortcode('[lsx_health_plan_featured_tips_block]'); |
|
| 849 | 849 | $content_meal .= '</div>'; |
| 850 | 850 | } |
| 851 | 851 | return $content_meal; |
@@ -858,21 +858,21 @@ discard block |
||
| 858 | 858 | * @param string $index |
| 859 | 859 | * @return void |
| 860 | 860 | */ |
| 861 | -function lsx_health_plan_workout_tab_content( $index = 1 ) { |
|
| 862 | - global $group_name,$shortcode_args; |
|
| 861 | +function lsx_health_plan_workout_tab_content($index = 1) { |
|
| 862 | + global $group_name, $shortcode_args; |
|
| 863 | 863 | $group_name = 'workout_section_' . $index; |
| 864 | - if ( false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) { |
|
| 865 | - $layout = strtolower( \lsx_health_plan\functions\get_option( 'workout_tab_layout', 'table' ) ); |
|
| 864 | + if (false !== \lsx_health_plan\functions\get_option('exercise_enabled', false)) { |
|
| 865 | + $layout = strtolower(\lsx_health_plan\functions\get_option('workout_tab_layout', 'table')); |
|
| 866 | 866 | |
| 867 | 867 | // Check for shortcode overrides. |
| 868 | - if ( null !== $shortcode_args && isset( $shortcode_args['layout'] ) ) { |
|
| 868 | + if (null !== $shortcode_args && isset($shortcode_args['layout'])) { |
|
| 869 | 869 | $layout = $shortcode_args['layout']; |
| 870 | 870 | } |
| 871 | 871 | } else { |
| 872 | 872 | $layout = 'table'; |
| 873 | 873 | } |
| 874 | 874 | |
| 875 | - switch ( $layout ) { |
|
| 875 | + switch ($layout) { |
|
| 876 | 876 | case 'list': |
| 877 | 877 | $tab_template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-list.php'; |
| 878 | 878 | break; |
@@ -885,8 +885,8 @@ discard block |
||
| 885 | 885 | $tab_template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-table.php'; |
| 886 | 886 | break; |
| 887 | 887 | } |
| 888 | - $tab_template_path = apply_filters( 'lsx_health_plan_workout_tab_content_path', $tab_template_path ); |
|
| 889 | - if ( '' !== $tab_template_path ) { |
|
| 888 | + $tab_template_path = apply_filters('lsx_health_plan_workout_tab_content_path', $tab_template_path); |
|
| 889 | + if ('' !== $tab_template_path) { |
|
| 890 | 890 | include $tab_template_path; |
| 891 | 891 | } |
| 892 | 892 | } |
@@ -897,26 +897,26 @@ discard block |
||
| 897 | 897 | * @return void |
| 898 | 898 | */ |
| 899 | 899 | function lsx_health_plan_workout_sets() { |
| 900 | - if ( is_singular( 'workout' ) ) { |
|
| 900 | + if (is_singular('workout')) { |
|
| 901 | 901 | global $connected_workouts; |
| 902 | - $connected_workouts = array( get_the_ID() ); |
|
| 902 | + $connected_workouts = array(get_the_ID()); |
|
| 903 | 903 | } |
| 904 | - if ( is_singular( 'plan' ) ) { |
|
| 904 | + if (is_singular('plan')) { |
|
| 905 | 905 | |
| 906 | 906 | global $connected_workouts; |
| 907 | 907 | |
| 908 | - $section_key = get_query_var( 'section' ); |
|
| 909 | - if ( '' !== $section && \lsx_health_plan\functions\plan\has_sections() ) { |
|
| 910 | - $section_info = \lsx_health_plan\functions\plan\get_section_info( $section_key ); |
|
| 911 | - if ( isset( $section_info['connected_workouts'] ) && '' !== $section_info['connected_workouts'] ) { |
|
| 908 | + $section_key = get_query_var('section'); |
|
| 909 | + if ('' !== $section && \lsx_health_plan\functions\plan\has_sections()) { |
|
| 910 | + $section_info = \lsx_health_plan\functions\plan\get_section_info($section_key); |
|
| 911 | + if (isset($section_info['connected_workouts']) && '' !== $section_info['connected_workouts']) { |
|
| 912 | 912 | |
| 913 | - $connected_workouts = \lsx_health_plan\functions\prep_array( $section_info['connected_workouts'] ); |
|
| 913 | + $connected_workouts = \lsx_health_plan\functions\prep_array($section_info['connected_workouts']); |
|
| 914 | 914 | } |
| 915 | 915 | } |
| 916 | 916 | } |
| 917 | 917 | $template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-sets.php'; |
| 918 | - $template_path = apply_filters( 'lsx_health_plan_workout_set_template_path', $template_path ); |
|
| 919 | - if ( '' !== $template_path && ! empty( $template_path ) ) { |
|
| 918 | + $template_path = apply_filters('lsx_health_plan_workout_set_template_path', $template_path); |
|
| 919 | + if ('' !== $template_path && ! empty($template_path)) { |
|
| 920 | 920 | include $template_path; |
| 921 | 921 | } |
| 922 | 922 | } |
@@ -927,11 +927,11 @@ discard block |
||
| 927 | 927 | * @param [type] $connected_workouts |
| 928 | 928 | * @return void |
| 929 | 929 | */ |
| 930 | -function lsx_health_plan_warmup_sets( $connected_workouts ) { |
|
| 930 | +function lsx_health_plan_warmup_sets($connected_workouts) { |
|
| 931 | 931 | |
| 932 | 932 | $template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-sets.php'; |
| 933 | - $template_path = apply_filters( 'lsx_health_plan_workout_set_template_path', $template_path ); |
|
| 934 | - if ( '' !== $template_path && ! empty( $template_path ) ) { |
|
| 933 | + $template_path = apply_filters('lsx_health_plan_workout_set_template_path', $template_path); |
|
| 934 | + if ('' !== $template_path && ! empty($template_path)) { |
|
| 935 | 935 | include $template_path; |
| 936 | 936 | } |
| 937 | 937 | } |
@@ -942,46 +942,46 @@ discard block |
||
| 942 | 942 | * @param array $args |
| 943 | 943 | * @return void |
| 944 | 944 | */ |
| 945 | -function lsx_hp_meal_plan_recipes( $args = array() ) { |
|
| 945 | +function lsx_hp_meal_plan_recipes($args = array()) { |
|
| 946 | 946 | $defaults = array( |
| 947 | 947 | 'meal_id' => false, |
| 948 | 948 | 'meal_time' => '', |
| 949 | 949 | 'modal' => true, |
| 950 | 950 | ); |
| 951 | - $args = wp_parse_args( $args, $defaults ); |
|
| 951 | + $args = wp_parse_args($args, $defaults); |
|
| 952 | 952 | // Looking for recipes. |
| 953 | - $connected_recipes = get_post_meta( $args['meal_id'], $args['meal_time'] . '_recipes', true ); |
|
| 954 | - if ( ! empty( $connected_recipes ) ) { |
|
| 955 | - $query_args = array( |
|
| 953 | + $connected_recipes = get_post_meta($args['meal_id'], $args['meal_time'] . '_recipes', true); |
|
| 954 | + if ( ! empty($connected_recipes)) { |
|
| 955 | + $query_args = array( |
|
| 956 | 956 | 'orderby' => 'date', |
| 957 | 957 | 'order' => 'DESC', |
| 958 | 958 | 'post_type' => 'recipe', |
| 959 | 959 | 'post__in' => $connected_recipes, |
| 960 | 960 | ); |
| 961 | - $recipes = new WP_Query( $query_args ); |
|
| 961 | + $recipes = new WP_Query($query_args); |
|
| 962 | 962 | ?> |
| 963 | 963 | <div class="recipes"> |
| 964 | 964 | <div class="row eating-row"> |
| 965 | 965 | <?php |
| 966 | - if ( $recipes->have_posts() ) { |
|
| 967 | - while ( $recipes->have_posts() ) { |
|
| 966 | + if ($recipes->have_posts()) { |
|
| 967 | + while ($recipes->have_posts()) { |
|
| 968 | 968 | $recipes->the_post(); |
| 969 | - if ( false !== $args['modal'] ) { |
|
| 969 | + if (false !== $args['modal']) { |
|
| 970 | 970 | \lsx_health_plan\functions\recipes\register_recipe_modal(); |
| 971 | 971 | } |
| 972 | 972 | ?> |
| 973 | 973 | <div class="recipe-column"> |
| 974 | - <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"> |
|
| 974 | + <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"> |
|
| 975 | 975 | <div class="recipe-feature-img"> |
| 976 | 976 | <?php |
| 977 | 977 | $featured_image = get_the_post_thumbnail(); |
| 978 | - if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
| 979 | - the_post_thumbnail( 'lsx-thumbnail-square', array( |
|
| 978 | + if ( ! empty($featured_image) && '' !== $featured_image) { |
|
| 979 | + the_post_thumbnail('lsx-thumbnail-square', array( |
|
| 980 | 980 | 'class' => 'aligncenter', |
| 981 | - ) ); |
|
| 981 | + )); |
|
| 982 | 982 | } else { |
| 983 | 983 | ?> |
| 984 | - <img loading="lazy" class="placeholder" src="<?php echo esc_attr( plugin_dir_url( __DIR__ ) . 'assets/images/placeholder.jpg' ); ?>"> |
|
| 984 | + <img loading="lazy" class="placeholder" src="<?php echo esc_attr(plugin_dir_url(__DIR__) . 'assets/images/placeholder.jpg'); ?>"> |
|
| 985 | 985 | <?php |
| 986 | 986 | } |
| 987 | 987 | ?> |
@@ -1007,25 +1007,25 @@ discard block |
||
| 1007 | 1007 | /** |
| 1008 | 1008 | * Output the connected. |
| 1009 | 1009 | */ |
| 1010 | -function lsx_hp_recipe_plan_meta( $args = array() ) { |
|
| 1010 | +function lsx_hp_recipe_plan_meta($args = array()) { |
|
| 1011 | 1011 | $defaults = array(); |
| 1012 | 1012 | $top_level_plans = array(); |
| 1013 | 1013 | // Get meals this exercise is connected to. |
| 1014 | - $plans = get_post_meta( get_the_ID(), 'connected_plans', true ); |
|
| 1015 | - if ( ! empty( $plans ) ) { |
|
| 1016 | - $plan = end( $plans ); |
|
| 1017 | - $has_parent = wp_get_post_parent_id( $plan ); |
|
| 1018 | - if ( 0 === $has_parent ) { |
|
| 1014 | + $plans = get_post_meta(get_the_ID(), 'connected_plans', true); |
|
| 1015 | + if ( ! empty($plans)) { |
|
| 1016 | + $plan = end($plans); |
|
| 1017 | + $has_parent = wp_get_post_parent_id($plan); |
|
| 1018 | + if (0 === $has_parent) { |
|
| 1019 | 1019 | $top_level_plans[] = $plan; |
| 1020 | - } elseif ( false !== $top_level_plans ) { |
|
| 1020 | + } elseif (false !== $top_level_plans) { |
|
| 1021 | 1021 | $top_level_plans[] = $has_parent; |
| 1022 | 1022 | } |
| 1023 | 1023 | } |
| 1024 | - if ( ! empty( $top_level_plans ) && ( '' !== $top_level_plans ) ) { |
|
| 1025 | - $top_level_plans = array_unique( $top_level_plans ); |
|
| 1026 | - $top_level_plan = end( $top_level_plans ); |
|
| 1024 | + if ( ! empty($top_level_plans) && ('' !== $top_level_plans)) { |
|
| 1025 | + $top_level_plans = array_unique($top_level_plans); |
|
| 1026 | + $top_level_plan = end($top_level_plans); |
|
| 1027 | 1027 | ?> |
| 1028 | - <span class="recipe-type recipe-parent"><?php echo esc_html( get_the_title( $top_level_plan ) ); ?></span> |
|
| 1028 | + <span class="recipe-type recipe-parent"><?php echo esc_html(get_the_title($top_level_plan)); ?></span> |
|
| 1029 | 1029 | <?php |
| 1030 | 1030 | } |
| 1031 | 1031 | } |
@@ -1038,23 +1038,23 @@ discard block |
||
| 1038 | 1038 | $top_level_plans = array(); |
| 1039 | 1039 | |
| 1040 | 1040 | // Get workouts this exercise is connected to. |
| 1041 | - $workouts = get_post_meta( get_the_ID(), 'connected_workouts', true ); |
|
| 1041 | + $workouts = get_post_meta(get_the_ID(), 'connected_workouts', true); |
|
| 1042 | 1042 | |
| 1043 | - if ( '' !== $workouts && ! is_array( $workouts ) ) { |
|
| 1044 | - $workouts = array( $workouts ); |
|
| 1043 | + if ('' !== $workouts && ! is_array($workouts)) { |
|
| 1044 | + $workouts = array($workouts); |
|
| 1045 | 1045 | } |
| 1046 | - if ( ! empty( $workouts ) ) { |
|
| 1047 | - foreach ( $workouts as $workout ) { |
|
| 1046 | + if ( ! empty($workouts)) { |
|
| 1047 | + foreach ($workouts as $workout) { |
|
| 1048 | 1048 | // Get the plans this workout is connected to. |
| 1049 | - $plans = get_post_meta( $workout, 'connected_plans', true ); |
|
| 1049 | + $plans = get_post_meta($workout, 'connected_plans', true); |
|
| 1050 | 1050 | |
| 1051 | - if ( '' !== $plans && ! is_array( $plans ) ) { |
|
| 1052 | - $plans = array( $plans ); |
|
| 1051 | + if ('' !== $plans && ! is_array($plans)) { |
|
| 1052 | + $plans = array($plans); |
|
| 1053 | 1053 | } |
| 1054 | - if ( ! empty( $plans ) ) { |
|
| 1055 | - foreach ( $plans as $plan ) { |
|
| 1056 | - $has_parent = wp_get_post_parent_id( $plan ); |
|
| 1057 | - if ( 0 === $has_parent ) { |
|
| 1054 | + if ( ! empty($plans)) { |
|
| 1055 | + foreach ($plans as $plan) { |
|
| 1056 | + $has_parent = wp_get_post_parent_id($plan); |
|
| 1057 | + if (0 === $has_parent) { |
|
| 1058 | 1058 | $top_level_plans = $plan; |
| 1059 | 1059 | } else { |
| 1060 | 1060 | $top_level_plans = $has_parent; |
@@ -1064,11 +1064,11 @@ discard block |
||
| 1064 | 1064 | } |
| 1065 | 1065 | } |
| 1066 | 1066 | |
| 1067 | - if ( ! empty( $top_level_plans ) && ( '' !== $top_level_plans ) ) { |
|
| 1068 | - $top_level_plans = array_unique( $top_level_plans ); |
|
| 1069 | - $top_level_plan = end( $top_level_plans ); |
|
| 1067 | + if ( ! empty($top_level_plans) && ('' !== $top_level_plans)) { |
|
| 1068 | + $top_level_plans = array_unique($top_level_plans); |
|
| 1069 | + $top_level_plan = end($top_level_plans); |
|
| 1070 | 1070 | ?> |
| 1071 | - <span class="recipe-type recipe-parent"><?php echo esc_html( get_the_title( $top_level_plan ) ); ?></span> |
|
| 1071 | + <span class="recipe-type recipe-parent"><?php echo esc_html(get_the_title($top_level_plan)); ?></span> |
|
| 1072 | 1072 | <?php |
| 1073 | 1073 | } |
| 1074 | 1074 | } |
@@ -1079,12 +1079,12 @@ discard block |
||
| 1079 | 1079 | * @param [type] $related_content |
| 1080 | 1080 | * @return void |
| 1081 | 1081 | */ |
| 1082 | -function lsx_hp_single_related( $related_content, $post_type_text ) { |
|
| 1082 | +function lsx_hp_single_related($related_content, $post_type_text) { |
|
| 1083 | 1083 | ?> |
| 1084 | 1084 | <section id="lsx-hp-related"> |
| 1085 | 1085 | <div class="row lsx-related-posts lsx-related-posts-title"> |
| 1086 | 1086 | <div class="col-xs-12"> |
| 1087 | - <h2 class="lsx-related-posts-headline"><?php echo esc_html( $post_type_text ); ?></h2> |
|
| 1087 | + <h2 class="lsx-related-posts-headline"><?php echo esc_html($post_type_text); ?></h2> |
|
| 1088 | 1088 | </div> |
| 1089 | 1089 | </div> |
| 1090 | 1090 | <div class="row lsx-related-posts lsx-related-posts-content"> |
@@ -1092,26 +1092,26 @@ discard block |
||
| 1092 | 1092 | <div class="lsx-related-posts-wrapper"> |
| 1093 | 1093 | <?php |
| 1094 | 1094 | $i = 0; |
| 1095 | - foreach ( $related_content as $article ) { |
|
| 1096 | - $post_title = get_the_title( $article ); |
|
| 1097 | - $post_categories = wp_get_post_categories( $article ); |
|
| 1098 | - $post_link = get_permalink( $article ); |
|
| 1095 | + foreach ($related_content as $article) { |
|
| 1096 | + $post_title = get_the_title($article); |
|
| 1097 | + $post_categories = wp_get_post_categories($article); |
|
| 1098 | + $post_link = get_permalink($article); |
|
| 1099 | 1099 | |
| 1100 | 1100 | $cats = array(); |
| 1101 | 1101 | ?> |
| 1102 | - <article id="post-<?php echo esc_html( $article ); ?>" class="lsx-slot post"> |
|
| 1102 | + <article id="post-<?php echo esc_html($article); ?>" class="lsx-slot post"> |
|
| 1103 | 1103 | <div class="entry-layout lsx-hp-shadow"> |
| 1104 | 1104 | <div class="entry-layout-content"> |
| 1105 | 1105 | <header class="entry-header"> |
| 1106 | 1106 | <div class="entry-image"> |
| 1107 | - <a href="<?php echo esc_url( $post_link ); ?>" class="thumbnail"> |
|
| 1107 | + <a href="<?php echo esc_url($post_link); ?>" class="thumbnail"> |
|
| 1108 | 1108 | <?php |
| 1109 | - $featured_image = get_the_post_thumbnail( $article, 'lsx-thumbnail-wide' ); |
|
| 1110 | - if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
| 1111 | - echo wp_kses_post( $featured_image ); |
|
| 1109 | + $featured_image = get_the_post_thumbnail($article, 'lsx-thumbnail-wide'); |
|
| 1110 | + if ( ! empty($featured_image) && '' !== $featured_image) { |
|
| 1111 | + echo wp_kses_post($featured_image); |
|
| 1112 | 1112 | } else { |
| 1113 | 1113 | ?> |
| 1114 | - <img loading="lazy" class="placeholder" src="<?php echo esc_attr( plugin_dir_url( __FILE__ ) . '../assets/images/placeholder.jpg' ); ?>"> |
|
| 1114 | + <img loading="lazy" class="placeholder" src="<?php echo esc_attr(plugin_dir_url(__FILE__) . '../assets/images/placeholder.jpg'); ?>"> |
|
| 1115 | 1115 | <?php |
| 1116 | 1116 | } |
| 1117 | 1117 | ?> |
@@ -1119,18 +1119,18 @@ discard block |
||
| 1119 | 1119 | </div> |
| 1120 | 1120 | <div class="entry-meta"> |
| 1121 | 1121 | <?php |
| 1122 | - foreach ( $post_categories as $c ) { |
|
| 1123 | - $cat = get_category( $c ); |
|
| 1122 | + foreach ($post_categories as $c) { |
|
| 1123 | + $cat = get_category($c); |
|
| 1124 | 1124 | /* Translators: %s: category name */ |
| 1125 | - $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>'; |
|
| 1125 | + $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>'; |
|
| 1126 | 1126 | } |
| 1127 | - if ( ! empty( $cats ) ) { ?> |
|
| 1128 | - <div class="post-categories"><span></span><?php echo wp_kses_post( implode( ', ', $cats ) ); ?></div> |
|
| 1127 | + if ( ! empty($cats)) { ?> |
|
| 1128 | + <div class="post-categories"><span></span><?php echo wp_kses_post(implode(', ', $cats)); ?></div> |
|
| 1129 | 1129 | <?php } ?> |
| 1130 | 1130 | </div> |
| 1131 | 1131 | <h2 class="entry-title"> |
| 1132 | - <a href="<?php echo esc_url( $post_link ); ?>"> |
|
| 1133 | - <?php echo esc_html( $post_title ); ?> |
|
| 1132 | + <a href="<?php echo esc_url($post_link); ?>"> |
|
| 1133 | + <?php echo esc_html($post_title); ?> |
|
| 1134 | 1134 | </a> |
| 1135 | 1135 | </h2> |
| 1136 | 1136 | </header> |
@@ -1154,27 +1154,27 @@ discard block |
||
| 1154 | 1154 | * @param [type] $connected_members |
| 1155 | 1155 | * @return void |
| 1156 | 1156 | */ |
| 1157 | -function lsx_hp_member_connected( $connected_members, $post_type ) { |
|
| 1158 | - if ( ! empty( $connected_members ) ) { |
|
| 1157 | +function lsx_hp_member_connected($connected_members, $post_type) { |
|
| 1158 | + if ( ! empty($connected_members)) { |
|
| 1159 | 1159 | $content = '<div id="hp-connected-members" class="hp-connected-members connected-' . $post_type . '">'; |
| 1160 | - foreach ( $connected_members as $member ) { |
|
| 1161 | - $post_link = get_permalink( $member ); |
|
| 1162 | - $member_name = get_the_title( $member ); |
|
| 1160 | + foreach ($connected_members as $member) { |
|
| 1161 | + $post_link = get_permalink($member); |
|
| 1162 | + $member_name = get_the_title($member); |
|
| 1163 | 1163 | $member_name = '<span class="lsx-team-name">' . $member_name . '</span>'; |
| 1164 | 1164 | |
| 1165 | 1165 | $member_link = '<a href="' . $post_link . '" >' . $member_name . '</a>'; |
| 1166 | 1166 | |
| 1167 | 1167 | $roles = ''; |
| 1168 | - $terms = get_the_terms( $member, 'team_role' ); |
|
| 1168 | + $terms = get_the_terms($member, 'team_role'); |
|
| 1169 | 1169 | |
| 1170 | - if ( $terms && ! is_wp_error( $terms ) ) { |
|
| 1170 | + if ($terms && ! is_wp_error($terms)) { |
|
| 1171 | 1171 | $roles = array(); |
| 1172 | 1172 | |
| 1173 | - foreach ( $terms as $term ) { |
|
| 1173 | + foreach ($terms as $term) { |
|
| 1174 | 1174 | $roles[] = $term->name; |
| 1175 | 1175 | } |
| 1176 | 1176 | |
| 1177 | - $roles = join( ', ', $roles ); |
|
| 1177 | + $roles = join(', ', $roles); |
|
| 1178 | 1178 | } |
| 1179 | 1179 | $member_roles = '' !== $roles ? "<small class='lsx-team-roles'>$roles</small>" : ''; |
| 1180 | 1180 | |
@@ -14,151 +14,151 @@ |
||
| 14 | 14 | */ |
| 15 | 15 | class Tip { |
| 16 | 16 | |
| 17 | - /** |
|
| 18 | - * Holds class instance |
|
| 19 | - * |
|
| 20 | - * @since 1.0.0 |
|
| 21 | - * |
|
| 22 | - * @var object \lsx_health_plan\classes\Tip() |
|
| 23 | - */ |
|
| 24 | - protected static $instance = null; |
|
| 17 | + /** |
|
| 18 | + * Holds class instance |
|
| 19 | + * |
|
| 20 | + * @since 1.0.0 |
|
| 21 | + * |
|
| 22 | + * @var object \lsx_health_plan\classes\Tip() |
|
| 23 | + */ |
|
| 24 | + protected static $instance = null; |
|
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * Holds post_type slug used as an index |
|
| 28 | - * |
|
| 29 | - * @since 1.0.0 |
|
| 30 | - * |
|
| 31 | - * @var string |
|
| 32 | - */ |
|
| 33 | - public $slug = 'tip'; |
|
| 26 | + /** |
|
| 27 | + * Holds post_type slug used as an index |
|
| 28 | + * |
|
| 29 | + * @since 1.0.0 |
|
| 30 | + * |
|
| 31 | + * @var string |
|
| 32 | + */ |
|
| 33 | + public $slug = 'tip'; |
|
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * Constructor |
|
| 37 | - */ |
|
| 38 | - public function __construct() { |
|
| 39 | - $this->default_types = array( |
|
| 40 | - \lsx_health_plan\functions\get_option( 'endpoint_meal', 'meal' ), |
|
| 41 | - \lsx_health_plan\functions\get_option( 'endpoint_exercise_single', 'exercise' ), |
|
| 42 | - \lsx_health_plan\functions\get_option( 'endpoint_recipe_single', 'recipe' ), |
|
| 43 | - \lsx_health_plan\functions\get_option( 'endpoint_workout', 'workout' ), |
|
| 44 | - \lsx_health_plan\functions\get_option( 'endpoint_plan', 'plan' ), |
|
| 45 | - ); |
|
| 46 | - add_action( 'init', array( $this, 'register_post_type' ) ); |
|
| 47 | - add_action( 'admin_menu', array( $this, 'register_menus' ) ); |
|
| 48 | - add_filter( 'lsx_health_plan_connections', array( $this, 'enable_connections' ), 10, 1 ); |
|
| 49 | - add_action( 'cmb2_admin_init', array( $this, 'tips_connections' ), 15 ); |
|
| 50 | - } |
|
| 35 | + /** |
|
| 36 | + * Constructor |
|
| 37 | + */ |
|
| 38 | + public function __construct() { |
|
| 39 | + $this->default_types = array( |
|
| 40 | + \lsx_health_plan\functions\get_option( 'endpoint_meal', 'meal' ), |
|
| 41 | + \lsx_health_plan\functions\get_option( 'endpoint_exercise_single', 'exercise' ), |
|
| 42 | + \lsx_health_plan\functions\get_option( 'endpoint_recipe_single', 'recipe' ), |
|
| 43 | + \lsx_health_plan\functions\get_option( 'endpoint_workout', 'workout' ), |
|
| 44 | + \lsx_health_plan\functions\get_option( 'endpoint_plan', 'plan' ), |
|
| 45 | + ); |
|
| 46 | + add_action( 'init', array( $this, 'register_post_type' ) ); |
|
| 47 | + add_action( 'admin_menu', array( $this, 'register_menus' ) ); |
|
| 48 | + add_filter( 'lsx_health_plan_connections', array( $this, 'enable_connections' ), 10, 1 ); |
|
| 49 | + add_action( 'cmb2_admin_init', array( $this, 'tips_connections' ), 15 ); |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | - /** |
|
| 53 | - * Return an instance of this class. |
|
| 54 | - * |
|
| 55 | - * @since 1.0.0 |
|
| 56 | - * |
|
| 57 | - * @return object \lsx_health_plan\classes\Tip() A single instance of this class. |
|
| 58 | - */ |
|
| 59 | - public static function get_instance() { |
|
| 60 | - // If the single instance hasn't been set, set it now. |
|
| 61 | - if ( null === self::$instance ) { |
|
| 62 | - self::$instance = new self(); |
|
| 63 | - } |
|
| 64 | - return self::$instance; |
|
| 65 | - } |
|
| 66 | - /** |
|
| 67 | - * Register the post type. |
|
| 68 | - */ |
|
| 69 | - public function register_post_type() { |
|
| 70 | - $labels = array( |
|
| 71 | - 'name' => esc_html__( 'Tips', 'lsx-health-plan' ), |
|
| 72 | - 'singular_name' => esc_html__( 'Tip', 'lsx-health-plan' ), |
|
| 73 | - 'add_new' => esc_html_x( 'Add New', 'post type general name', 'lsx-health-plan' ), |
|
| 74 | - 'add_new_item' => esc_html__( 'Add New', 'lsx-health-plan' ), |
|
| 75 | - 'edit_item' => esc_html__( 'Edit', 'lsx-health-plan' ), |
|
| 76 | - 'new_item' => esc_html__( 'New', 'lsx-health-plan' ), |
|
| 77 | - 'all_items' => esc_html__( 'All Tips', 'lsx-health-plan' ), |
|
| 78 | - 'view_item' => esc_html__( 'View', 'lsx-health-plan' ), |
|
| 79 | - 'search_items' => esc_html__( 'Search', 'lsx-health-plan' ), |
|
| 80 | - 'not_found' => esc_html__( 'None found', 'lsx-health-plan' ), |
|
| 81 | - 'not_found_in_trash' => esc_html__( 'None found in Trash', 'lsx-health-plan' ), |
|
| 82 | - 'parent_item_colon' => '', |
|
| 83 | - 'menu_name' => esc_html__( 'Tips', 'lsx-health-plan' ), |
|
| 84 | - ); |
|
| 85 | - $args = array( |
|
| 86 | - 'labels' => $labels, |
|
| 87 | - 'public' => true, |
|
| 88 | - 'publicly_queryable' => false, |
|
| 89 | - 'show_ui' => true, |
|
| 90 | - 'show_in_menu' => false, |
|
| 91 | - 'show_in_rest' => true, |
|
| 92 | - 'menu_icon' => 'dashicons-admin-post', |
|
| 93 | - 'query_var' => true, |
|
| 94 | - 'rewrite' => false, |
|
| 95 | - 'capability_type' => 'post', |
|
| 96 | - 'has_archive' => false, |
|
| 97 | - 'hierarchical' => false, |
|
| 98 | - 'menu_position' => null, |
|
| 99 | - 'supports' => array( |
|
| 100 | - 'title', |
|
| 101 | - 'editor', |
|
| 102 | - 'custom-fields', |
|
| 103 | - ), |
|
| 104 | - ); |
|
| 105 | - register_post_type( 'tip', $args ); |
|
| 106 | - } |
|
| 52 | + /** |
|
| 53 | + * Return an instance of this class. |
|
| 54 | + * |
|
| 55 | + * @since 1.0.0 |
|
| 56 | + * |
|
| 57 | + * @return object \lsx_health_plan\classes\Tip() A single instance of this class. |
|
| 58 | + */ |
|
| 59 | + public static function get_instance() { |
|
| 60 | + // If the single instance hasn't been set, set it now. |
|
| 61 | + if ( null === self::$instance ) { |
|
| 62 | + self::$instance = new self(); |
|
| 63 | + } |
|
| 64 | + return self::$instance; |
|
| 65 | + } |
|
| 66 | + /** |
|
| 67 | + * Register the post type. |
|
| 68 | + */ |
|
| 69 | + public function register_post_type() { |
|
| 70 | + $labels = array( |
|
| 71 | + 'name' => esc_html__( 'Tips', 'lsx-health-plan' ), |
|
| 72 | + 'singular_name' => esc_html__( 'Tip', 'lsx-health-plan' ), |
|
| 73 | + 'add_new' => esc_html_x( 'Add New', 'post type general name', 'lsx-health-plan' ), |
|
| 74 | + 'add_new_item' => esc_html__( 'Add New', 'lsx-health-plan' ), |
|
| 75 | + 'edit_item' => esc_html__( 'Edit', 'lsx-health-plan' ), |
|
| 76 | + 'new_item' => esc_html__( 'New', 'lsx-health-plan' ), |
|
| 77 | + 'all_items' => esc_html__( 'All Tips', 'lsx-health-plan' ), |
|
| 78 | + 'view_item' => esc_html__( 'View', 'lsx-health-plan' ), |
|
| 79 | + 'search_items' => esc_html__( 'Search', 'lsx-health-plan' ), |
|
| 80 | + 'not_found' => esc_html__( 'None found', 'lsx-health-plan' ), |
|
| 81 | + 'not_found_in_trash' => esc_html__( 'None found in Trash', 'lsx-health-plan' ), |
|
| 82 | + 'parent_item_colon' => '', |
|
| 83 | + 'menu_name' => esc_html__( 'Tips', 'lsx-health-plan' ), |
|
| 84 | + ); |
|
| 85 | + $args = array( |
|
| 86 | + 'labels' => $labels, |
|
| 87 | + 'public' => true, |
|
| 88 | + 'publicly_queryable' => false, |
|
| 89 | + 'show_ui' => true, |
|
| 90 | + 'show_in_menu' => false, |
|
| 91 | + 'show_in_rest' => true, |
|
| 92 | + 'menu_icon' => 'dashicons-admin-post', |
|
| 93 | + 'query_var' => true, |
|
| 94 | + 'rewrite' => false, |
|
| 95 | + 'capability_type' => 'post', |
|
| 96 | + 'has_archive' => false, |
|
| 97 | + 'hierarchical' => false, |
|
| 98 | + 'menu_position' => null, |
|
| 99 | + 'supports' => array( |
|
| 100 | + 'title', |
|
| 101 | + 'editor', |
|
| 102 | + 'custom-fields', |
|
| 103 | + ), |
|
| 104 | + ); |
|
| 105 | + register_post_type( 'tip', $args ); |
|
| 106 | + } |
|
| 107 | 107 | |
| 108 | - /** |
|
| 109 | - * Registers the Recipes under the Meals Post type menu. |
|
| 110 | - * |
|
| 111 | - * @return void |
|
| 112 | - */ |
|
| 113 | - public function register_menus() { |
|
| 114 | - add_submenu_page( 'edit.php?post_type=plan', esc_html__( 'Tips', 'lsx-health-plan' ), esc_html__( 'Tips', 'lsx-health-plan' ), 'edit_posts', 'edit.php?post_type=tip' ); |
|
| 115 | - } |
|
| 108 | + /** |
|
| 109 | + * Registers the Recipes under the Meals Post type menu. |
|
| 110 | + * |
|
| 111 | + * @return void |
|
| 112 | + */ |
|
| 113 | + public function register_menus() { |
|
| 114 | + add_submenu_page( 'edit.php?post_type=plan', esc_html__( 'Tips', 'lsx-health-plan' ), esc_html__( 'Tips', 'lsx-health-plan' ), 'edit_posts', 'edit.php?post_type=tip' ); |
|
| 115 | + } |
|
| 116 | 116 | |
| 117 | - /** |
|
| 118 | - * Enables the Bi Directional relationships |
|
| 119 | - * |
|
| 120 | - * @param array $connections |
|
| 121 | - * @return void |
|
| 122 | - */ |
|
| 123 | - public function enable_connections( $connections = array() ) { |
|
| 124 | - $connections['tip']['connected_plans'] = 'plan_connected_tips'; |
|
| 125 | - $connections['plan']['plan_connected_tips'] = 'connected_plans'; |
|
| 126 | - return $connections; |
|
| 127 | - } |
|
| 117 | + /** |
|
| 118 | + * Enables the Bi Directional relationships |
|
| 119 | + * |
|
| 120 | + * @param array $connections |
|
| 121 | + * @return void |
|
| 122 | + */ |
|
| 123 | + public function enable_connections( $connections = array() ) { |
|
| 124 | + $connections['tip']['connected_plans'] = 'plan_connected_tips'; |
|
| 125 | + $connections['plan']['plan_connected_tips'] = 'connected_plans'; |
|
| 126 | + return $connections; |
|
| 127 | + } |
|
| 128 | 128 | |
| 129 | - /** |
|
| 130 | - * Registers the workout connections on the plan post type. |
|
| 131 | - * |
|
| 132 | - * @return void |
|
| 133 | - */ |
|
| 134 | - public function tips_connections() { |
|
| 135 | - foreach ( $this->default_types as $type => $default_type ) { |
|
| 136 | - $cmb = new_cmb2_box( |
|
| 137 | - array( |
|
| 138 | - 'id' => $default_type . '_tips_connections_metabox', |
|
| 139 | - 'title' => __( 'Related Tips', 'lsx-health-plan' ), |
|
| 140 | - 'object_types' => array( $default_type ), // Post types. |
|
| 141 | - 'context' => 'normal', |
|
| 142 | - 'priority' => 'high', |
|
| 143 | - 'show_names' => false, |
|
| 144 | - ) |
|
| 145 | - ); |
|
| 146 | - $cmb->add_field( |
|
| 147 | - array( |
|
| 148 | - 'name' => __( 'Tips', 'lsx-health-plan' ), |
|
| 149 | - 'id' => $default_type . '_connected_tips', |
|
| 150 | - 'desc' => __( 'Connect the tips that apply to this ', 'lsx-health-plan' ) . $default_type, |
|
| 151 | - 'type' => 'post_search_ajax', |
|
| 152 | - 'limit' => 15, |
|
| 153 | - 'sortable' => true, |
|
| 154 | - 'query_args' => array( |
|
| 155 | - 'post_type' => array( 'tip' ), |
|
| 156 | - 'post_status' => array( 'publish' ), |
|
| 157 | - 'posts_per_page' => -1, |
|
| 158 | - ), |
|
| 159 | - ) |
|
| 160 | - ); |
|
| 161 | - } |
|
| 162 | - } |
|
| 129 | + /** |
|
| 130 | + * Registers the workout connections on the plan post type. |
|
| 131 | + * |
|
| 132 | + * @return void |
|
| 133 | + */ |
|
| 134 | + public function tips_connections() { |
|
| 135 | + foreach ( $this->default_types as $type => $default_type ) { |
|
| 136 | + $cmb = new_cmb2_box( |
|
| 137 | + array( |
|
| 138 | + 'id' => $default_type . '_tips_connections_metabox', |
|
| 139 | + 'title' => __( 'Related Tips', 'lsx-health-plan' ), |
|
| 140 | + 'object_types' => array( $default_type ), // Post types. |
|
| 141 | + 'context' => 'normal', |
|
| 142 | + 'priority' => 'high', |
|
| 143 | + 'show_names' => false, |
|
| 144 | + ) |
|
| 145 | + ); |
|
| 146 | + $cmb->add_field( |
|
| 147 | + array( |
|
| 148 | + 'name' => __( 'Tips', 'lsx-health-plan' ), |
|
| 149 | + 'id' => $default_type . '_connected_tips', |
|
| 150 | + 'desc' => __( 'Connect the tips that apply to this ', 'lsx-health-plan' ) . $default_type, |
|
| 151 | + 'type' => 'post_search_ajax', |
|
| 152 | + 'limit' => 15, |
|
| 153 | + 'sortable' => true, |
|
| 154 | + 'query_args' => array( |
|
| 155 | + 'post_type' => array( 'tip' ), |
|
| 156 | + 'post_status' => array( 'publish' ), |
|
| 157 | + 'posts_per_page' => -1, |
|
| 158 | + ), |
|
| 159 | + ) |
|
| 160 | + ); |
|
| 161 | + } |
|
| 162 | + } |
|
| 163 | 163 | |
| 164 | 164 | } |
@@ -12,239 +12,239 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | class Workout { |
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * Holds class instance |
|
| 17 | - * |
|
| 18 | - * @since 1.0.0 |
|
| 19 | - * |
|
| 20 | - * @var object \lsx_health_plan\classes\admin\Workout() |
|
| 21 | - */ |
|
| 22 | - protected static $instance = null; |
|
| 15 | + /** |
|
| 16 | + * Holds class instance |
|
| 17 | + * |
|
| 18 | + * @since 1.0.0 |
|
| 19 | + * |
|
| 20 | + * @var object \lsx_health_plan\classes\admin\Workout() |
|
| 21 | + */ |
|
| 22 | + protected static $instance = null; |
|
| 23 | 23 | |
| 24 | - /** |
|
| 25 | - * Constructor |
|
| 26 | - */ |
|
| 27 | - public function __construct() { |
|
| 28 | - add_action( 'lsx_hp_settings_page_workout_top', array( $this, 'settings' ), 1, 1 ); |
|
| 29 | - } |
|
| 24 | + /** |
|
| 25 | + * Constructor |
|
| 26 | + */ |
|
| 27 | + public function __construct() { |
|
| 28 | + add_action( 'lsx_hp_settings_page_workout_top', array( $this, 'settings' ), 1, 1 ); |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * Return an instance of this class. |
|
| 33 | - * |
|
| 34 | - * @since 1.0.0 |
|
| 35 | - * |
|
| 36 | - * @return object \lsx_health_plan\classes\admin\Workout() A single instance of this class. |
|
| 37 | - */ |
|
| 38 | - public static function get_instance() { |
|
| 39 | - // If the single instance hasn't been set, set it now. |
|
| 40 | - if ( null === self::$instance ) { |
|
| 41 | - self::$instance = new self(); |
|
| 42 | - } |
|
| 43 | - return self::$instance; |
|
| 44 | - } |
|
| 31 | + /** |
|
| 32 | + * Return an instance of this class. |
|
| 33 | + * |
|
| 34 | + * @since 1.0.0 |
|
| 35 | + * |
|
| 36 | + * @return object \lsx_health_plan\classes\admin\Workout() A single instance of this class. |
|
| 37 | + */ |
|
| 38 | + public static function get_instance() { |
|
| 39 | + // If the single instance hasn't been set, set it now. |
|
| 40 | + if ( null === self::$instance ) { |
|
| 41 | + self::$instance = new self(); |
|
| 42 | + } |
|
| 43 | + return self::$instance; |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - /** |
|
| 47 | - * Registers the general settings. |
|
| 48 | - * |
|
| 49 | - * @param object $cmb new_cmb2_box(). |
|
| 50 | - * @return void |
|
| 51 | - */ |
|
| 52 | - public function settings( $cmb ) { |
|
| 53 | - $cmb->add_field( |
|
| 54 | - array( |
|
| 55 | - 'name' => __( 'Disable Workouts', 'lsx-health-plan' ), |
|
| 56 | - 'id' => 'workout_disabled', |
|
| 57 | - 'type' => 'checkbox', |
|
| 58 | - 'value' => 1, |
|
| 59 | - 'default' => 0, |
|
| 60 | - 'description' => __( 'Disable workout post type if you are wanting a minimal site.', 'lsx-health-plan' ), |
|
| 61 | - ) |
|
| 62 | - ); |
|
| 63 | - if ( post_type_exists( 'workout' ) ) { |
|
| 64 | - $cmb->add_field( |
|
| 65 | - array( |
|
| 66 | - 'name' => __( 'Your Workout Intro', 'lsx-health-plan' ), |
|
| 67 | - 'id' => 'workout_intro', |
|
| 68 | - 'type' => 'wysiwyg', |
|
| 69 | - 'value' => '', |
|
| 70 | - 'default' => __( "Let's do this! Smash your daily workout and reach your fitness goals.", 'lsx-health-plan' ), |
|
| 71 | - 'options' => array( |
|
| 72 | - 'textarea_rows' => get_option('default_post_edit_rows', 6), |
|
| 73 | - ), |
|
| 74 | - ) |
|
| 75 | - ); |
|
| 76 | - } |
|
| 77 | - $cmb->add_field( |
|
| 78 | - array( |
|
| 79 | - 'before_row' => '<h4><b><u>Layout Options</u></b></h4>', |
|
| 80 | - 'id' => 'workout_tab_layout', |
|
| 81 | - 'type' => 'select', |
|
| 82 | - 'name' => __( 'Workout Tab Layout', 'lsx-health-plan' ), |
|
| 83 | - 'description' => __( 'Choose the layout for the workouts.', 'lsx-health-plan' ), |
|
| 84 | - 'options' => array( |
|
| 85 | - 'table' => __( 'Table', 'lsx-health-plan' ), |
|
| 86 | - 'list' => __( 'List', 'lsx-health-plan' ), |
|
| 87 | - 'grid' => __( 'Grid', 'lsx-health-plan' ), |
|
| 88 | - ), |
|
| 89 | - ) |
|
| 90 | - ); |
|
| 91 | - $cmb->add_field( |
|
| 92 | - array( |
|
| 93 | - 'id' => 'workout_tab_link', |
|
| 94 | - 'type' => 'select', |
|
| 95 | - 'name' => __( 'Workout Tab Link', 'lsx-health-plan' ), |
|
| 96 | - 'description' => __( 'Choose to show the excerpt, full content or nothing.', 'lsx-health-plan' ), |
|
| 97 | - 'options' => array( |
|
| 98 | - 'none' => __( 'None', 'lsx-health-plan' ), |
|
| 99 | - 'single' => __( 'Single', 'lsx-health-plan' ), |
|
| 100 | - 'modal' => __( 'Modal', 'lsx-health-plan' ), |
|
| 101 | - ), |
|
| 102 | - 'default' => '', |
|
| 103 | - ) |
|
| 104 | - ); |
|
| 105 | - $cmb->add_field( |
|
| 106 | - array( |
|
| 107 | - 'id' => 'workout_tab_modal_content', |
|
| 108 | - 'type' => 'select', |
|
| 109 | - 'name' => __( 'Modal Content', 'lsx-health-plan' ), |
|
| 110 | - 'description' => __( 'Choose to show the excerpt, full content or nothing. For the modal content only', 'lsx-health-plan' ), |
|
| 111 | - 'options' => array( |
|
| 112 | - '' => __( 'None', 'lsx-health-plan' ), |
|
| 113 | - 'excerpt' => __( 'Excerpt', 'lsx-health-plan' ), |
|
| 114 | - 'full' => __( 'Full Content', 'lsx-health-plan' ), |
|
| 115 | - ), |
|
| 116 | - 'default' => '', |
|
| 117 | - ) |
|
| 118 | - ); |
|
| 119 | - $cmb->add_field( |
|
| 120 | - array( |
|
| 121 | - 'id' => 'workout_tab_columns', |
|
| 122 | - 'type' => 'select', |
|
| 123 | - 'name' => __( 'Grid Columns', 'lsx-health-plan' ), |
|
| 124 | - 'description' => __( 'If you are displaying a grid, set the amount of columns you want to use.', 'lsx-health-plan' ), |
|
| 125 | - 'options' => array( |
|
| 126 | - '12' => __( '1', 'lsx-health-plan' ), |
|
| 127 | - '6' => __( '2', 'lsx-health-plan' ), |
|
| 128 | - '4' => __( '3', 'lsx-health-plan' ), |
|
| 129 | - '3' => __( '4', 'lsx-health-plan' ), |
|
| 130 | - '2' => __( '6', 'lsx-health-plan' ), |
|
| 131 | - ), |
|
| 132 | - 'default' => '4', |
|
| 133 | - ) |
|
| 134 | - ); |
|
| 135 | - $cmb->add_field( |
|
| 136 | - array( |
|
| 137 | - 'id' => 'workout_tab_content', |
|
| 138 | - 'type' => 'select', |
|
| 139 | - 'name' => __( 'Grid Content', 'lsx-health-plan' ), |
|
| 140 | - 'description' => __( 'Choose to show the excerpt, full content or nothing. For the grid layout only', 'lsx-health-plan' ), |
|
| 141 | - 'options' => array( |
|
| 142 | - '' => __( 'None', 'lsx-health-plan' ), |
|
| 143 | - 'excerpt' => __( 'Excerpt', 'lsx-health-plan' ), |
|
| 144 | - 'full' => __( 'Full Content', 'lsx-health-plan' ), |
|
| 145 | - ), |
|
| 146 | - 'default' => '', |
|
| 147 | - ) |
|
| 148 | - ); |
|
| 46 | + /** |
|
| 47 | + * Registers the general settings. |
|
| 48 | + * |
|
| 49 | + * @param object $cmb new_cmb2_box(). |
|
| 50 | + * @return void |
|
| 51 | + */ |
|
| 52 | + public function settings( $cmb ) { |
|
| 53 | + $cmb->add_field( |
|
| 54 | + array( |
|
| 55 | + 'name' => __( 'Disable Workouts', 'lsx-health-plan' ), |
|
| 56 | + 'id' => 'workout_disabled', |
|
| 57 | + 'type' => 'checkbox', |
|
| 58 | + 'value' => 1, |
|
| 59 | + 'default' => 0, |
|
| 60 | + 'description' => __( 'Disable workout post type if you are wanting a minimal site.', 'lsx-health-plan' ), |
|
| 61 | + ) |
|
| 62 | + ); |
|
| 63 | + if ( post_type_exists( 'workout' ) ) { |
|
| 64 | + $cmb->add_field( |
|
| 65 | + array( |
|
| 66 | + 'name' => __( 'Your Workout Intro', 'lsx-health-plan' ), |
|
| 67 | + 'id' => 'workout_intro', |
|
| 68 | + 'type' => 'wysiwyg', |
|
| 69 | + 'value' => '', |
|
| 70 | + 'default' => __( "Let's do this! Smash your daily workout and reach your fitness goals.", 'lsx-health-plan' ), |
|
| 71 | + 'options' => array( |
|
| 72 | + 'textarea_rows' => get_option('default_post_edit_rows', 6), |
|
| 73 | + ), |
|
| 74 | + ) |
|
| 75 | + ); |
|
| 76 | + } |
|
| 77 | + $cmb->add_field( |
|
| 78 | + array( |
|
| 79 | + 'before_row' => '<h4><b><u>Layout Options</u></b></h4>', |
|
| 80 | + 'id' => 'workout_tab_layout', |
|
| 81 | + 'type' => 'select', |
|
| 82 | + 'name' => __( 'Workout Tab Layout', 'lsx-health-plan' ), |
|
| 83 | + 'description' => __( 'Choose the layout for the workouts.', 'lsx-health-plan' ), |
|
| 84 | + 'options' => array( |
|
| 85 | + 'table' => __( 'Table', 'lsx-health-plan' ), |
|
| 86 | + 'list' => __( 'List', 'lsx-health-plan' ), |
|
| 87 | + 'grid' => __( 'Grid', 'lsx-health-plan' ), |
|
| 88 | + ), |
|
| 89 | + ) |
|
| 90 | + ); |
|
| 91 | + $cmb->add_field( |
|
| 92 | + array( |
|
| 93 | + 'id' => 'workout_tab_link', |
|
| 94 | + 'type' => 'select', |
|
| 95 | + 'name' => __( 'Workout Tab Link', 'lsx-health-plan' ), |
|
| 96 | + 'description' => __( 'Choose to show the excerpt, full content or nothing.', 'lsx-health-plan' ), |
|
| 97 | + 'options' => array( |
|
| 98 | + 'none' => __( 'None', 'lsx-health-plan' ), |
|
| 99 | + 'single' => __( 'Single', 'lsx-health-plan' ), |
|
| 100 | + 'modal' => __( 'Modal', 'lsx-health-plan' ), |
|
| 101 | + ), |
|
| 102 | + 'default' => '', |
|
| 103 | + ) |
|
| 104 | + ); |
|
| 105 | + $cmb->add_field( |
|
| 106 | + array( |
|
| 107 | + 'id' => 'workout_tab_modal_content', |
|
| 108 | + 'type' => 'select', |
|
| 109 | + 'name' => __( 'Modal Content', 'lsx-health-plan' ), |
|
| 110 | + 'description' => __( 'Choose to show the excerpt, full content or nothing. For the modal content only', 'lsx-health-plan' ), |
|
| 111 | + 'options' => array( |
|
| 112 | + '' => __( 'None', 'lsx-health-plan' ), |
|
| 113 | + 'excerpt' => __( 'Excerpt', 'lsx-health-plan' ), |
|
| 114 | + 'full' => __( 'Full Content', 'lsx-health-plan' ), |
|
| 115 | + ), |
|
| 116 | + 'default' => '', |
|
| 117 | + ) |
|
| 118 | + ); |
|
| 119 | + $cmb->add_field( |
|
| 120 | + array( |
|
| 121 | + 'id' => 'workout_tab_columns', |
|
| 122 | + 'type' => 'select', |
|
| 123 | + 'name' => __( 'Grid Columns', 'lsx-health-plan' ), |
|
| 124 | + 'description' => __( 'If you are displaying a grid, set the amount of columns you want to use.', 'lsx-health-plan' ), |
|
| 125 | + 'options' => array( |
|
| 126 | + '12' => __( '1', 'lsx-health-plan' ), |
|
| 127 | + '6' => __( '2', 'lsx-health-plan' ), |
|
| 128 | + '4' => __( '3', 'lsx-health-plan' ), |
|
| 129 | + '3' => __( '4', 'lsx-health-plan' ), |
|
| 130 | + '2' => __( '6', 'lsx-health-plan' ), |
|
| 131 | + ), |
|
| 132 | + 'default' => '4', |
|
| 133 | + ) |
|
| 134 | + ); |
|
| 135 | + $cmb->add_field( |
|
| 136 | + array( |
|
| 137 | + 'id' => 'workout_tab_content', |
|
| 138 | + 'type' => 'select', |
|
| 139 | + 'name' => __( 'Grid Content', 'lsx-health-plan' ), |
|
| 140 | + 'description' => __( 'Choose to show the excerpt, full content or nothing. For the grid layout only', 'lsx-health-plan' ), |
|
| 141 | + 'options' => array( |
|
| 142 | + '' => __( 'None', 'lsx-health-plan' ), |
|
| 143 | + 'excerpt' => __( 'Excerpt', 'lsx-health-plan' ), |
|
| 144 | + 'full' => __( 'Full Content', 'lsx-health-plan' ), |
|
| 145 | + ), |
|
| 146 | + 'default' => '', |
|
| 147 | + ) |
|
| 148 | + ); |
|
| 149 | 149 | |
| 150 | - $cmb->add_field( |
|
| 151 | - array( |
|
| 152 | - 'before_row' => '<h4><b><u>URL Slug Options</u></b></h4><p style="font-style: italic;">If you need to translate the custom slug for this custom post type, do so below.</p>', |
|
| 153 | - 'name' => __( 'Single Workout Slug', 'lsx-health-plan' ), |
|
| 154 | - 'id' => 'endpoint_workout', |
|
| 155 | - 'type' => 'input', |
|
| 156 | - 'value' => '', |
|
| 157 | - 'default' => 'workout', |
|
| 158 | - ) |
|
| 159 | - ); |
|
| 160 | - $cmb->add_field( |
|
| 161 | - array( |
|
| 162 | - 'name' => __( 'Workouts Archive Slug', 'lsx-health-plan' ), |
|
| 163 | - 'id' => 'endpoint_workout_archive', |
|
| 164 | - 'type' => 'input', |
|
| 165 | - 'value' => '', |
|
| 166 | - 'default' => 'workouts', |
|
| 167 | - ) |
|
| 168 | - ); |
|
| 169 | - $cmb->add_field( |
|
| 170 | - array( |
|
| 171 | - 'name' => __( 'Warm Up Slug', 'lsx-health-plan' ), |
|
| 172 | - 'id' => 'endpoint_warm_up', |
|
| 173 | - 'type' => 'input', |
|
| 174 | - 'value' => '', |
|
| 175 | - 'default' => 'warm-up', |
|
| 176 | - ) |
|
| 177 | - ); |
|
| 150 | + $cmb->add_field( |
|
| 151 | + array( |
|
| 152 | + 'before_row' => '<h4><b><u>URL Slug Options</u></b></h4><p style="font-style: italic;">If you need to translate the custom slug for this custom post type, do so below.</p>', |
|
| 153 | + 'name' => __( 'Single Workout Slug', 'lsx-health-plan' ), |
|
| 154 | + 'id' => 'endpoint_workout', |
|
| 155 | + 'type' => 'input', |
|
| 156 | + 'value' => '', |
|
| 157 | + 'default' => 'workout', |
|
| 158 | + ) |
|
| 159 | + ); |
|
| 160 | + $cmb->add_field( |
|
| 161 | + array( |
|
| 162 | + 'name' => __( 'Workouts Archive Slug', 'lsx-health-plan' ), |
|
| 163 | + 'id' => 'endpoint_workout_archive', |
|
| 164 | + 'type' => 'input', |
|
| 165 | + 'value' => '', |
|
| 166 | + 'default' => 'workouts', |
|
| 167 | + ) |
|
| 168 | + ); |
|
| 169 | + $cmb->add_field( |
|
| 170 | + array( |
|
| 171 | + 'name' => __( 'Warm Up Slug', 'lsx-health-plan' ), |
|
| 172 | + 'id' => 'endpoint_warm_up', |
|
| 173 | + 'type' => 'input', |
|
| 174 | + 'value' => '', |
|
| 175 | + 'default' => 'warm-up', |
|
| 176 | + ) |
|
| 177 | + ); |
|
| 178 | 178 | |
| 179 | 179 | |
| 180 | - $cmb->add_field( |
|
| 181 | - array( |
|
| 182 | - 'before_row' => '<h4><b><u>Default Options</u></b></h4>', |
|
| 183 | - 'name' => __( 'Warm Up', 'lsx-health-plan' ), |
|
| 184 | - 'description' => __( 'Set a default warm up routine.', 'lsx-health-plan' ), |
|
| 185 | - 'limit' => 1, |
|
| 186 | - 'id' => 'plan_warmup', |
|
| 187 | - 'type' => 'post_search_ajax', |
|
| 188 | - 'query_args' => array( |
|
| 189 | - 'post_type' => 'post', |
|
| 190 | - 'post_status' => array( 'publish' ), |
|
| 191 | - 'posts_per_page' => -1, |
|
| 192 | - ), |
|
| 193 | - ) |
|
| 194 | - ); |
|
| 195 | - $cmb->add_field( |
|
| 196 | - array( |
|
| 197 | - 'name' => __( 'Workout', 'lsx-health-plan' ), |
|
| 198 | - 'description' => __( 'Set a default workout routine.', 'lsx-health-plan' ), |
|
| 199 | - 'limit' => 1, |
|
| 200 | - 'id' => 'connected_workouts', |
|
| 201 | - 'type' => 'post_search_ajax', |
|
| 202 | - 'query_args' => array( |
|
| 203 | - 'post_type' => 'workout', |
|
| 204 | - 'post_status' => array( 'publish' ), |
|
| 205 | - 'posts_per_page' => -1, |
|
| 206 | - ), |
|
| 207 | - ) |
|
| 208 | - ); |
|
| 209 | - if ( function_exists( 'download_monitor' ) ) { |
|
| 210 | - $page_url = 'https://wordpress.org/plugins/download-monitor/'; |
|
| 211 | - $plugin_name = 'Download Monitor'; |
|
| 212 | - $description = sprintf( |
|
| 213 | - /* translators: %s: The subscription info */ |
|
| 214 | - __( 'If you are using <a target="_blank" href="%1$s">%2$s</a> you can set a default download file for your meal here.', 'lsx-search' ), |
|
| 215 | - $page_url, |
|
| 216 | - $plugin_name |
|
| 217 | - ); |
|
| 218 | - $cmb->add_field( |
|
| 219 | - array( |
|
| 220 | - 'name' => __( 'Default Warm Up PDF', 'lsx-health-plan' ), |
|
| 221 | - 'description' => $description, |
|
| 222 | - 'id' => 'download_page', |
|
| 223 | - 'type' => 'post_search_ajax', |
|
| 224 | - 'limit' => 1, |
|
| 225 | - 'query_args' => array( |
|
| 226 | - 'post_type' => array( 'dlm_download' ), |
|
| 227 | - 'post_status' => array( 'publish' ), |
|
| 228 | - 'posts_per_page' => -1, |
|
| 229 | - ), |
|
| 230 | - ) |
|
| 231 | - ); |
|
| 232 | - $cmb->add_field( |
|
| 233 | - array( |
|
| 234 | - 'name' => __( 'Default Workout PDF', 'lsx-health-plan' ), |
|
| 235 | - 'description' => $description, |
|
| 236 | - 'id' => 'download_workout', |
|
| 237 | - 'type' => 'post_search_ajax', |
|
| 238 | - 'limit' => 1, |
|
| 239 | - 'query_args' => array( |
|
| 240 | - 'post_type' => array( 'dlm_download' ), |
|
| 241 | - 'post_status' => array( 'publish' ), |
|
| 242 | - 'posts_per_page' => -1, |
|
| 243 | - ), |
|
| 244 | - 'after_row' => __( '<p style="font-style: italic;">If you have changed any URL slugs, please remember re-save your permalinks in Settings > Permalinks.</p>', 'lsx-health-plan' ), |
|
| 245 | - ) |
|
| 246 | - ); |
|
| 247 | - } |
|
| 248 | - } |
|
| 180 | + $cmb->add_field( |
|
| 181 | + array( |
|
| 182 | + 'before_row' => '<h4><b><u>Default Options</u></b></h4>', |
|
| 183 | + 'name' => __( 'Warm Up', 'lsx-health-plan' ), |
|
| 184 | + 'description' => __( 'Set a default warm up routine.', 'lsx-health-plan' ), |
|
| 185 | + 'limit' => 1, |
|
| 186 | + 'id' => 'plan_warmup', |
|
| 187 | + 'type' => 'post_search_ajax', |
|
| 188 | + 'query_args' => array( |
|
| 189 | + 'post_type' => 'post', |
|
| 190 | + 'post_status' => array( 'publish' ), |
|
| 191 | + 'posts_per_page' => -1, |
|
| 192 | + ), |
|
| 193 | + ) |
|
| 194 | + ); |
|
| 195 | + $cmb->add_field( |
|
| 196 | + array( |
|
| 197 | + 'name' => __( 'Workout', 'lsx-health-plan' ), |
|
| 198 | + 'description' => __( 'Set a default workout routine.', 'lsx-health-plan' ), |
|
| 199 | + 'limit' => 1, |
|
| 200 | + 'id' => 'connected_workouts', |
|
| 201 | + 'type' => 'post_search_ajax', |
|
| 202 | + 'query_args' => array( |
|
| 203 | + 'post_type' => 'workout', |
|
| 204 | + 'post_status' => array( 'publish' ), |
|
| 205 | + 'posts_per_page' => -1, |
|
| 206 | + ), |
|
| 207 | + ) |
|
| 208 | + ); |
|
| 209 | + if ( function_exists( 'download_monitor' ) ) { |
|
| 210 | + $page_url = 'https://wordpress.org/plugins/download-monitor/'; |
|
| 211 | + $plugin_name = 'Download Monitor'; |
|
| 212 | + $description = sprintf( |
|
| 213 | + /* translators: %s: The subscription info */ |
|
| 214 | + __( 'If you are using <a target="_blank" href="%1$s">%2$s</a> you can set a default download file for your meal here.', 'lsx-search' ), |
|
| 215 | + $page_url, |
|
| 216 | + $plugin_name |
|
| 217 | + ); |
|
| 218 | + $cmb->add_field( |
|
| 219 | + array( |
|
| 220 | + 'name' => __( 'Default Warm Up PDF', 'lsx-health-plan' ), |
|
| 221 | + 'description' => $description, |
|
| 222 | + 'id' => 'download_page', |
|
| 223 | + 'type' => 'post_search_ajax', |
|
| 224 | + 'limit' => 1, |
|
| 225 | + 'query_args' => array( |
|
| 226 | + 'post_type' => array( 'dlm_download' ), |
|
| 227 | + 'post_status' => array( 'publish' ), |
|
| 228 | + 'posts_per_page' => -1, |
|
| 229 | + ), |
|
| 230 | + ) |
|
| 231 | + ); |
|
| 232 | + $cmb->add_field( |
|
| 233 | + array( |
|
| 234 | + 'name' => __( 'Default Workout PDF', 'lsx-health-plan' ), |
|
| 235 | + 'description' => $description, |
|
| 236 | + 'id' => 'download_workout', |
|
| 237 | + 'type' => 'post_search_ajax', |
|
| 238 | + 'limit' => 1, |
|
| 239 | + 'query_args' => array( |
|
| 240 | + 'post_type' => array( 'dlm_download' ), |
|
| 241 | + 'post_status' => array( 'publish' ), |
|
| 242 | + 'posts_per_page' => -1, |
|
| 243 | + ), |
|
| 244 | + 'after_row' => __( '<p style="font-style: italic;">If you have changed any URL slugs, please remember re-save your permalinks in Settings > Permalinks.</p>', 'lsx-health-plan' ), |
|
| 245 | + ) |
|
| 246 | + ); |
|
| 247 | + } |
|
| 248 | + } |
|
| 249 | 249 | } |
| 250 | 250 | Workout::get_instance(); |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | * Constructor |
| 26 | 26 | */ |
| 27 | 27 | public function __construct() { |
| 28 | - add_action( 'lsx_hp_settings_page_workout_top', array( $this, 'settings' ), 1, 1 ); |
|
| 28 | + add_action('lsx_hp_settings_page_workout_top', array($this, 'settings'), 1, 1); |
|
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | /** |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | */ |
| 38 | 38 | public static function get_instance() { |
| 39 | 39 | // If the single instance hasn't been set, set it now. |
| 40 | - if ( null === self::$instance ) { |
|
| 40 | + if (null === self::$instance) { |
|
| 41 | 41 | self::$instance = new self(); |
| 42 | 42 | } |
| 43 | 43 | return self::$instance; |
@@ -49,25 +49,25 @@ discard block |
||
| 49 | 49 | * @param object $cmb new_cmb2_box(). |
| 50 | 50 | * @return void |
| 51 | 51 | */ |
| 52 | - public function settings( $cmb ) { |
|
| 52 | + public function settings($cmb) { |
|
| 53 | 53 | $cmb->add_field( |
| 54 | 54 | array( |
| 55 | - 'name' => __( 'Disable Workouts', 'lsx-health-plan' ), |
|
| 55 | + 'name' => __('Disable Workouts', 'lsx-health-plan'), |
|
| 56 | 56 | 'id' => 'workout_disabled', |
| 57 | 57 | 'type' => 'checkbox', |
| 58 | 58 | 'value' => 1, |
| 59 | 59 | 'default' => 0, |
| 60 | - 'description' => __( 'Disable workout post type if you are wanting a minimal site.', 'lsx-health-plan' ), |
|
| 60 | + 'description' => __('Disable workout post type if you are wanting a minimal site.', 'lsx-health-plan'), |
|
| 61 | 61 | ) |
| 62 | 62 | ); |
| 63 | - if ( post_type_exists( 'workout' ) ) { |
|
| 63 | + if (post_type_exists('workout')) { |
|
| 64 | 64 | $cmb->add_field( |
| 65 | 65 | array( |
| 66 | - 'name' => __( 'Your Workout Intro', 'lsx-health-plan' ), |
|
| 66 | + 'name' => __('Your Workout Intro', 'lsx-health-plan'), |
|
| 67 | 67 | 'id' => 'workout_intro', |
| 68 | 68 | 'type' => 'wysiwyg', |
| 69 | 69 | 'value' => '', |
| 70 | - 'default' => __( "Let's do this! Smash your daily workout and reach your fitness goals.", 'lsx-health-plan' ), |
|
| 70 | + 'default' => __("Let's do this! Smash your daily workout and reach your fitness goals.", 'lsx-health-plan'), |
|
| 71 | 71 | 'options' => array( |
| 72 | 72 | 'textarea_rows' => get_option('default_post_edit_rows', 6), |
| 73 | 73 | ), |
@@ -79,12 +79,12 @@ discard block |
||
| 79 | 79 | 'before_row' => '<h4><b><u>Layout Options</u></b></h4>', |
| 80 | 80 | 'id' => 'workout_tab_layout', |
| 81 | 81 | 'type' => 'select', |
| 82 | - 'name' => __( 'Workout Tab Layout', 'lsx-health-plan' ), |
|
| 83 | - 'description' => __( 'Choose the layout for the workouts.', 'lsx-health-plan' ), |
|
| 82 | + 'name' => __('Workout Tab Layout', 'lsx-health-plan'), |
|
| 83 | + 'description' => __('Choose the layout for the workouts.', 'lsx-health-plan'), |
|
| 84 | 84 | 'options' => array( |
| 85 | - 'table' => __( 'Table', 'lsx-health-plan' ), |
|
| 86 | - 'list' => __( 'List', 'lsx-health-plan' ), |
|
| 87 | - 'grid' => __( 'Grid', 'lsx-health-plan' ), |
|
| 85 | + 'table' => __('Table', 'lsx-health-plan'), |
|
| 86 | + 'list' => __('List', 'lsx-health-plan'), |
|
| 87 | + 'grid' => __('Grid', 'lsx-health-plan'), |
|
| 88 | 88 | ), |
| 89 | 89 | ) |
| 90 | 90 | ); |
@@ -92,12 +92,12 @@ discard block |
||
| 92 | 92 | array( |
| 93 | 93 | 'id' => 'workout_tab_link', |
| 94 | 94 | 'type' => 'select', |
| 95 | - 'name' => __( 'Workout Tab Link', 'lsx-health-plan' ), |
|
| 96 | - 'description' => __( 'Choose to show the excerpt, full content or nothing.', 'lsx-health-plan' ), |
|
| 95 | + 'name' => __('Workout Tab Link', 'lsx-health-plan'), |
|
| 96 | + 'description' => __('Choose to show the excerpt, full content or nothing.', 'lsx-health-plan'), |
|
| 97 | 97 | 'options' => array( |
| 98 | - 'none' => __( 'None', 'lsx-health-plan' ), |
|
| 99 | - 'single' => __( 'Single', 'lsx-health-plan' ), |
|
| 100 | - 'modal' => __( 'Modal', 'lsx-health-plan' ), |
|
| 98 | + 'none' => __('None', 'lsx-health-plan'), |
|
| 99 | + 'single' => __('Single', 'lsx-health-plan'), |
|
| 100 | + 'modal' => __('Modal', 'lsx-health-plan'), |
|
| 101 | 101 | ), |
| 102 | 102 | 'default' => '', |
| 103 | 103 | ) |
@@ -106,12 +106,12 @@ discard block |
||
| 106 | 106 | array( |
| 107 | 107 | 'id' => 'workout_tab_modal_content', |
| 108 | 108 | 'type' => 'select', |
| 109 | - 'name' => __( 'Modal Content', 'lsx-health-plan' ), |
|
| 110 | - 'description' => __( 'Choose to show the excerpt, full content or nothing. For the modal content only', 'lsx-health-plan' ), |
|
| 109 | + 'name' => __('Modal Content', 'lsx-health-plan'), |
|
| 110 | + 'description' => __('Choose to show the excerpt, full content or nothing. For the modal content only', 'lsx-health-plan'), |
|
| 111 | 111 | 'options' => array( |
| 112 | - '' => __( 'None', 'lsx-health-plan' ), |
|
| 113 | - 'excerpt' => __( 'Excerpt', 'lsx-health-plan' ), |
|
| 114 | - 'full' => __( 'Full Content', 'lsx-health-plan' ), |
|
| 112 | + '' => __('None', 'lsx-health-plan'), |
|
| 113 | + 'excerpt' => __('Excerpt', 'lsx-health-plan'), |
|
| 114 | + 'full' => __('Full Content', 'lsx-health-plan'), |
|
| 115 | 115 | ), |
| 116 | 116 | 'default' => '', |
| 117 | 117 | ) |
@@ -120,14 +120,14 @@ discard block |
||
| 120 | 120 | array( |
| 121 | 121 | 'id' => 'workout_tab_columns', |
| 122 | 122 | 'type' => 'select', |
| 123 | - 'name' => __( 'Grid Columns', 'lsx-health-plan' ), |
|
| 124 | - 'description' => __( 'If you are displaying a grid, set the amount of columns you want to use.', 'lsx-health-plan' ), |
|
| 123 | + 'name' => __('Grid Columns', 'lsx-health-plan'), |
|
| 124 | + 'description' => __('If you are displaying a grid, set the amount of columns you want to use.', 'lsx-health-plan'), |
|
| 125 | 125 | 'options' => array( |
| 126 | - '12' => __( '1', 'lsx-health-plan' ), |
|
| 127 | - '6' => __( '2', 'lsx-health-plan' ), |
|
| 128 | - '4' => __( '3', 'lsx-health-plan' ), |
|
| 129 | - '3' => __( '4', 'lsx-health-plan' ), |
|
| 130 | - '2' => __( '6', 'lsx-health-plan' ), |
|
| 126 | + '12' => __('1', 'lsx-health-plan'), |
|
| 127 | + '6' => __('2', 'lsx-health-plan'), |
|
| 128 | + '4' => __('3', 'lsx-health-plan'), |
|
| 129 | + '3' => __('4', 'lsx-health-plan'), |
|
| 130 | + '2' => __('6', 'lsx-health-plan'), |
|
| 131 | 131 | ), |
| 132 | 132 | 'default' => '4', |
| 133 | 133 | ) |
@@ -136,12 +136,12 @@ discard block |
||
| 136 | 136 | array( |
| 137 | 137 | 'id' => 'workout_tab_content', |
| 138 | 138 | 'type' => 'select', |
| 139 | - 'name' => __( 'Grid Content', 'lsx-health-plan' ), |
|
| 140 | - 'description' => __( 'Choose to show the excerpt, full content or nothing. For the grid layout only', 'lsx-health-plan' ), |
|
| 139 | + 'name' => __('Grid Content', 'lsx-health-plan'), |
|
| 140 | + 'description' => __('Choose to show the excerpt, full content or nothing. For the grid layout only', 'lsx-health-plan'), |
|
| 141 | 141 | 'options' => array( |
| 142 | - '' => __( 'None', 'lsx-health-plan' ), |
|
| 143 | - 'excerpt' => __( 'Excerpt', 'lsx-health-plan' ), |
|
| 144 | - 'full' => __( 'Full Content', 'lsx-health-plan' ), |
|
| 142 | + '' => __('None', 'lsx-health-plan'), |
|
| 143 | + 'excerpt' => __('Excerpt', 'lsx-health-plan'), |
|
| 144 | + 'full' => __('Full Content', 'lsx-health-plan'), |
|
| 145 | 145 | ), |
| 146 | 146 | 'default' => '', |
| 147 | 147 | ) |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | $cmb->add_field( |
| 151 | 151 | array( |
| 152 | 152 | 'before_row' => '<h4><b><u>URL Slug Options</u></b></h4><p style="font-style: italic;">If you need to translate the custom slug for this custom post type, do so below.</p>', |
| 153 | - 'name' => __( 'Single Workout Slug', 'lsx-health-plan' ), |
|
| 153 | + 'name' => __('Single Workout Slug', 'lsx-health-plan'), |
|
| 154 | 154 | 'id' => 'endpoint_workout', |
| 155 | 155 | 'type' => 'input', |
| 156 | 156 | 'value' => '', |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | ); |
| 160 | 160 | $cmb->add_field( |
| 161 | 161 | array( |
| 162 | - 'name' => __( 'Workouts Archive Slug', 'lsx-health-plan' ), |
|
| 162 | + 'name' => __('Workouts Archive Slug', 'lsx-health-plan'), |
|
| 163 | 163 | 'id' => 'endpoint_workout_archive', |
| 164 | 164 | 'type' => 'input', |
| 165 | 165 | 'value' => '', |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | ); |
| 169 | 169 | $cmb->add_field( |
| 170 | 170 | array( |
| 171 | - 'name' => __( 'Warm Up Slug', 'lsx-health-plan' ), |
|
| 171 | + 'name' => __('Warm Up Slug', 'lsx-health-plan'), |
|
| 172 | 172 | 'id' => 'endpoint_warm_up', |
| 173 | 173 | 'type' => 'input', |
| 174 | 174 | 'value' => '', |
@@ -180,68 +180,68 @@ discard block |
||
| 180 | 180 | $cmb->add_field( |
| 181 | 181 | array( |
| 182 | 182 | 'before_row' => '<h4><b><u>Default Options</u></b></h4>', |
| 183 | - 'name' => __( 'Warm Up', 'lsx-health-plan' ), |
|
| 184 | - 'description' => __( 'Set a default warm up routine.', 'lsx-health-plan' ), |
|
| 183 | + 'name' => __('Warm Up', 'lsx-health-plan'), |
|
| 184 | + 'description' => __('Set a default warm up routine.', 'lsx-health-plan'), |
|
| 185 | 185 | 'limit' => 1, |
| 186 | 186 | 'id' => 'plan_warmup', |
| 187 | 187 | 'type' => 'post_search_ajax', |
| 188 | 188 | 'query_args' => array( |
| 189 | 189 | 'post_type' => 'post', |
| 190 | - 'post_status' => array( 'publish' ), |
|
| 190 | + 'post_status' => array('publish'), |
|
| 191 | 191 | 'posts_per_page' => -1, |
| 192 | 192 | ), |
| 193 | 193 | ) |
| 194 | 194 | ); |
| 195 | 195 | $cmb->add_field( |
| 196 | 196 | array( |
| 197 | - 'name' => __( 'Workout', 'lsx-health-plan' ), |
|
| 198 | - 'description' => __( 'Set a default workout routine.', 'lsx-health-plan' ), |
|
| 197 | + 'name' => __('Workout', 'lsx-health-plan'), |
|
| 198 | + 'description' => __('Set a default workout routine.', 'lsx-health-plan'), |
|
| 199 | 199 | 'limit' => 1, |
| 200 | 200 | 'id' => 'connected_workouts', |
| 201 | 201 | 'type' => 'post_search_ajax', |
| 202 | 202 | 'query_args' => array( |
| 203 | 203 | 'post_type' => 'workout', |
| 204 | - 'post_status' => array( 'publish' ), |
|
| 204 | + 'post_status' => array('publish'), |
|
| 205 | 205 | 'posts_per_page' => -1, |
| 206 | 206 | ), |
| 207 | 207 | ) |
| 208 | 208 | ); |
| 209 | - if ( function_exists( 'download_monitor' ) ) { |
|
| 209 | + if (function_exists('download_monitor')) { |
|
| 210 | 210 | $page_url = 'https://wordpress.org/plugins/download-monitor/'; |
| 211 | 211 | $plugin_name = 'Download Monitor'; |
| 212 | 212 | $description = sprintf( |
| 213 | 213 | /* translators: %s: The subscription info */ |
| 214 | - __( 'If you are using <a target="_blank" href="%1$s">%2$s</a> you can set a default download file for your meal here.', 'lsx-search' ), |
|
| 214 | + __('If you are using <a target="_blank" href="%1$s">%2$s</a> you can set a default download file for your meal here.', 'lsx-search'), |
|
| 215 | 215 | $page_url, |
| 216 | 216 | $plugin_name |
| 217 | 217 | ); |
| 218 | 218 | $cmb->add_field( |
| 219 | 219 | array( |
| 220 | - 'name' => __( 'Default Warm Up PDF', 'lsx-health-plan' ), |
|
| 220 | + 'name' => __('Default Warm Up PDF', 'lsx-health-plan'), |
|
| 221 | 221 | 'description' => $description, |
| 222 | 222 | 'id' => 'download_page', |
| 223 | 223 | 'type' => 'post_search_ajax', |
| 224 | 224 | 'limit' => 1, |
| 225 | 225 | 'query_args' => array( |
| 226 | - 'post_type' => array( 'dlm_download' ), |
|
| 227 | - 'post_status' => array( 'publish' ), |
|
| 226 | + 'post_type' => array('dlm_download'), |
|
| 227 | + 'post_status' => array('publish'), |
|
| 228 | 228 | 'posts_per_page' => -1, |
| 229 | 229 | ), |
| 230 | 230 | ) |
| 231 | 231 | ); |
| 232 | 232 | $cmb->add_field( |
| 233 | 233 | array( |
| 234 | - 'name' => __( 'Default Workout PDF', 'lsx-health-plan' ), |
|
| 234 | + 'name' => __('Default Workout PDF', 'lsx-health-plan'), |
|
| 235 | 235 | 'description' => $description, |
| 236 | 236 | 'id' => 'download_workout', |
| 237 | 237 | 'type' => 'post_search_ajax', |
| 238 | 238 | 'limit' => 1, |
| 239 | 239 | 'query_args' => array( |
| 240 | - 'post_type' => array( 'dlm_download' ), |
|
| 241 | - 'post_status' => array( 'publish' ), |
|
| 240 | + 'post_type' => array('dlm_download'), |
|
| 241 | + 'post_status' => array('publish'), |
|
| 242 | 242 | 'posts_per_page' => -1, |
| 243 | 243 | ), |
| 244 | - 'after_row' => __( '<p style="font-style: italic;">If you have changed any URL slugs, please remember re-save your permalinks in Settings > Permalinks.</p>', 'lsx-health-plan' ), |
|
| 244 | + 'after_row' => __('<p style="font-style: italic;">If you have changed any URL slugs, please remember re-save your permalinks in Settings > Permalinks.</p>', 'lsx-health-plan'), |
|
| 245 | 245 | ) |
| 246 | 246 | ); |
| 247 | 247 | } |