@@ -15,12 +15,12 @@ discard block |
||
15 | 15 | <div class="lsx-tips-shortcode lsx-tips-slider slick-slider slick-dotted" > |
16 | 16 | <?php |
17 | 17 | |
18 | - foreach ( $connected_tips as $tip ) { |
|
19 | - $tip_link = get_permalink( $tip ); |
|
20 | - $tip_name = get_the_title( $tip ); |
|
21 | - $tip_content = get_post_field( 'post_content', $tip ); |
|
22 | - $icon = LSX_HEALTH_PLAN_URL . 'assets/images/tips-icon.svg'; |
|
23 | - ?> |
|
18 | + foreach ( $connected_tips as $tip ) { |
|
19 | + $tip_link = get_permalink( $tip ); |
|
20 | + $tip_name = get_the_title( $tip ); |
|
21 | + $tip_content = get_post_field( 'post_content', $tip ); |
|
22 | + $icon = LSX_HEALTH_PLAN_URL . 'assets/images/tips-icon.svg'; |
|
23 | + ?> |
|
24 | 24 | <div class="content-box diet-tip-wrapper quick-tip"> |
25 | 25 | <div class="row"> |
26 | 26 | <div class="col-lg-1 col-md-1 col-sm-1 col-xs-2"> |
@@ -33,8 +33,8 @@ discard block |
||
33 | 33 | </div> |
34 | 34 | </div> |
35 | 35 | <?php |
36 | - } |
|
37 | - ?> |
|
36 | + } |
|
37 | + ?> |
|
38 | 38 | </div> |
39 | 39 | </div> |
40 | 40 | <?php |
@@ -10,8 +10,8 @@ discard block |
||
10 | 10 | <?php lsx_content_wrap_before(); ?> |
11 | 11 | |
12 | 12 | <?php |
13 | - $page_id = get_the_ID(); |
|
14 | - $redirect = '/content-restricted/?r=' . $page_id . '&wcm_redirect_to=archive&wcm_redirect_id=' . $page_id; |
|
13 | + $page_id = get_the_ID(); |
|
14 | + $redirect = '/content-restricted/?r=' . $page_id . '&wcm_redirect_to=archive&wcm_redirect_id=' . $page_id; |
|
15 | 15 | ?> |
16 | 16 | |
17 | 17 | <div id="primary" class="content-area <?php echo esc_attr( lsx_main_class() ); ?>"> |
@@ -20,8 +20,8 @@ discard block |
||
20 | 20 | |
21 | 21 | <!-- Begining restricted content --> |
22 | 22 | <?php |
23 | - if ( current_user_can( 'wc_memberships_view_restricted_post_content', $post_id ) ) { |
|
24 | - ?> |
|
23 | + if ( current_user_can( 'wc_memberships_view_restricted_post_content', $post_id ) ) { |
|
24 | + ?> |
|
25 | 25 | <main id="main" role="main"> |
26 | 26 | |
27 | 27 | <?php lsx_content_top(); ?> |
@@ -30,9 +30,9 @@ discard block |
||
30 | 30 | <div class="row"> |
31 | 31 | <?php if ( have_posts() ) : ?> |
32 | 32 | <?php |
33 | - while ( have_posts() ) : |
|
34 | - the_post(); |
|
35 | - ?> |
|
33 | + while ( have_posts() ) : |
|
34 | + the_post(); |
|
35 | + ?> |
|
36 | 36 | |
37 | 37 | <?php include LSX_HEALTH_PLAN_PATH . '/templates/content-archive-exercise.php'; ?> |
38 | 38 | |
@@ -51,11 +51,11 @@ discard block |
||
51 | 51 | </main><!-- #main --> |
52 | 52 | |
53 | 53 | <?php |
54 | - } else { |
|
55 | - wp_redirect( $redirect ); |
|
56 | - exit; |
|
57 | - } |
|
58 | - ?> |
|
54 | + } else { |
|
55 | + wp_redirect( $redirect ); |
|
56 | + exit; |
|
57 | + } |
|
58 | + ?> |
|
59 | 59 | |
60 | 60 | <?php lsx_content_after(); ?> |
61 | 61 |
@@ -10,8 +10,8 @@ discard block |
||
10 | 10 | <?php lsx_content_wrap_before(); ?> |
11 | 11 | |
12 | 12 | <?php |
13 | - $page_id = get_the_ID(); |
|
14 | - $redirect = '/content-restricted/?r=' . $page_id . '&wcm_redirect_to=archive&wcm_redirect_id=' . $page_id; |
|
13 | + $page_id = get_the_ID(); |
|
14 | + $redirect = '/content-restricted/?r=' . $page_id . '&wcm_redirect_to=archive&wcm_redirect_id=' . $page_id; |
|
15 | 15 | ?> |
16 | 16 | |
17 | 17 | <div id="primary" class="content-area <?php echo esc_attr( lsx_main_class() ); ?>"> |
@@ -20,8 +20,8 @@ discard block |
||
20 | 20 | |
21 | 21 | <!-- Begining restricted content --> |
22 | 22 | <?php |
23 | - if ( current_user_can( 'wc_memberships_view_restricted_post_content', $post_id ) ) { |
|
24 | - ?> |
|
23 | + if ( current_user_can( 'wc_memberships_view_restricted_post_content', $post_id ) ) { |
|
24 | + ?> |
|
25 | 25 | <main id="main" role="main"> |
26 | 26 | |
27 | 27 | <?php lsx_content_top(); ?> |
@@ -30,9 +30,9 @@ discard block |
||
30 | 30 | <div class="row"> |
31 | 31 | <?php if ( have_posts() ) : ?> |
32 | 32 | <?php |
33 | - while ( have_posts() ) : |
|
34 | - the_post(); |
|
35 | - ?> |
|
33 | + while ( have_posts() ) : |
|
34 | + the_post(); |
|
35 | + ?> |
|
36 | 36 | |
37 | 37 | <?php include LSX_HEALTH_PLAN_PATH . '/templates/content-archive-exercise.php'; ?> |
38 | 38 | |
@@ -51,11 +51,11 @@ discard block |
||
51 | 51 | </main><!-- #main --> |
52 | 52 | |
53 | 53 | <?php |
54 | - } else { |
|
55 | - wp_redirect( $redirect ); |
|
56 | - exit; |
|
57 | - } |
|
58 | - ?> |
|
54 | + } else { |
|
55 | + wp_redirect( $redirect ); |
|
56 | + exit; |
|
57 | + } |
|
58 | + ?> |
|
59 | 59 | |
60 | 60 | <?php lsx_content_after(); ?> |
61 | 61 |
@@ -17,17 +17,17 @@ discard block |
||
17 | 17 | <div class="workout-feature-img"> |
18 | 18 | <a href="<?php echo esc_url( get_permalink() ); ?>"> |
19 | 19 | <?php |
20 | - $featured_image = get_the_post_thumbnail(); |
|
21 | - if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
22 | - the_post_thumbnail( 'lsx-thumbnail-square', array( |
|
23 | - 'class' => 'aligncenter', |
|
24 | - ) ); |
|
25 | - } else { |
|
26 | - ?> |
|
20 | + $featured_image = get_the_post_thumbnail(); |
|
21 | + if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
22 | + the_post_thumbnail( 'lsx-thumbnail-square', array( |
|
23 | + 'class' => 'aligncenter', |
|
24 | + ) ); |
|
25 | + } else { |
|
26 | + ?> |
|
27 | 27 | <img loading="lazy" src="<?php echo esc_attr( plugin_dir_url( __FILE__ ) . '../assets/images/placeholder.jpg' ); ?>"> |
28 | 28 | <?php |
29 | - } |
|
30 | - ?> |
|
29 | + } |
|
30 | + ?> |
|
31 | 31 | </a> |
32 | 32 | </div> |
33 | 33 | <div class="content-box workout-content-box white-bg"> |
@@ -35,14 +35,14 @@ discard block |
||
35 | 35 | <?php the_title( '<h3 class="workout-title">', '</h3>' ); ?> |
36 | 36 | </a> |
37 | 37 | <?php |
38 | - if ( ! has_excerpt() ) { |
|
39 | - $content = wp_trim_words( get_the_content(), 20 ); |
|
40 | - $content = '<p>' . $content . '</p>'; |
|
41 | - } else { |
|
42 | - $content = apply_filters( 'the_excerpt', get_the_excerpt() ); |
|
43 | - } |
|
44 | - echo wp_kses_post( $content ); |
|
45 | - ?> |
|
38 | + if ( ! has_excerpt() ) { |
|
39 | + $content = wp_trim_words( get_the_content(), 20 ); |
|
40 | + $content = '<p>' . $content . '</p>'; |
|
41 | + } else { |
|
42 | + $content = apply_filters( 'the_excerpt', get_the_excerpt() ); |
|
43 | + } |
|
44 | + echo wp_kses_post( $content ); |
|
45 | + ?> |
|
46 | 46 | <a href="<?php echo esc_url( get_permalink() ); ?>" class="btn border-btn"><?php esc_html_e( 'See workout', 'lsx-health-plan' ); ?></a> |
47 | 47 | </div> |
48 | 48 | <?php lsx_entry_bottom(); ?> |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | global $group_name,$shortcode_args; |
9 | 9 | $groups = get_post_meta( get_the_ID(), $group_name, true ); |
10 | 10 | if ( is_singular( 'workout' ) ) { |
11 | - $groups = get_post_meta( get_queried_object_id(), $group_name, true ); |
|
11 | + $groups = get_post_meta( get_queried_object_id(), $group_name, true ); |
|
12 | 12 | } |
13 | 13 | $link_setting = \lsx_health_plan\functions\get_option( 'workout_tab_link', 'single' ); |
14 | 14 | $content_setting = \lsx_health_plan\functions\get_option( 'workout_tab_content', '' ); |
@@ -16,113 +16,113 @@ discard block |
||
16 | 16 | |
17 | 17 | // Check for shortcode overrides. |
18 | 18 | if ( null !== $shortcode_args ) { |
19 | - if ( isset( $shortcode_args['link'] ) ) { |
|
20 | - $link_setting = $shortcode_args['link']; |
|
21 | - } |
|
22 | - if ( isset( $shortcode_args['description'] ) ) { |
|
23 | - $content_setting = $shortcode_args['description']; |
|
24 | - } |
|
25 | - if ( isset( $shortcode_args['modal_content'] ) ) { |
|
26 | - $modal_content_setting = $shortcode_args['modal_content']; |
|
27 | - } |
|
19 | + if ( isset( $shortcode_args['link'] ) ) { |
|
20 | + $link_setting = $shortcode_args['link']; |
|
21 | + } |
|
22 | + if ( isset( $shortcode_args['description'] ) ) { |
|
23 | + $content_setting = $shortcode_args['description']; |
|
24 | + } |
|
25 | + if ( isset( $shortcode_args['modal_content'] ) ) { |
|
26 | + $modal_content_setting = $shortcode_args['modal_content']; |
|
27 | + } |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | $modal_args = array( |
31 | - 'modal_content' => $modal_content_setting, |
|
31 | + 'modal_content' => $modal_content_setting, |
|
32 | 32 | ); |
33 | 33 | |
34 | 34 | if ( ! empty( $groups ) ) { |
35 | - ?> |
|
35 | + ?> |
|
36 | 36 | <div class="set-list"> |
37 | 37 | <div class="workout-list"> |
38 | 38 | <?php |
39 | - foreach ( $groups as $group ) { |
|
39 | + foreach ( $groups as $group ) { |
|
40 | 40 | |
41 | - $connected_exercise = false; |
|
42 | - if ( isset( $group['connected_exercises'] ) && '' !== $group['connected_exercises'] ) { |
|
43 | - $connected_exercise = true; |
|
44 | - } |
|
41 | + $connected_exercise = false; |
|
42 | + if ( isset( $group['connected_exercises'] ) && '' !== $group['connected_exercises'] ) { |
|
43 | + $connected_exercise = true; |
|
44 | + } |
|
45 | 45 | |
46 | - if ( ( $connected_exercise ) || ( ( ! $connected_exercise ) && '' !== $group['alt_title'] && isset( $group['alt_title'] ) ) ) { |
|
46 | + if ( ( $connected_exercise ) || ( ( ! $connected_exercise ) && '' !== $group['alt_title'] && isset( $group['alt_title'] ) ) ) { |
|
47 | 47 | |
48 | - $alt_title = ''; |
|
49 | - if ( isset( $group['alt_title'] ) && '' !== $group['alt_title'] ) { |
|
50 | - $alt_title = '<span class="alt-title">' . esc_html( $group['alt_title'] ) . '</span>'; |
|
51 | - } |
|
48 | + $alt_title = ''; |
|
49 | + if ( isset( $group['alt_title'] ) && '' !== $group['alt_title'] ) { |
|
50 | + $alt_title = '<span class="alt-title">' . esc_html( $group['alt_title'] ) . '</span>'; |
|
51 | + } |
|
52 | 52 | |
53 | - $alt_description = ''; |
|
54 | - if ( isset( $group['alt_description'] ) && '' !== $group['alt_description'] ) { |
|
55 | - $alt_description = '<span class="alt-description">' . esc_html( $group['alt_description'] ) . '</span>'; |
|
56 | - } |
|
53 | + $alt_description = ''; |
|
54 | + if ( isset( $group['alt_description'] ) && '' !== $group['alt_description'] ) { |
|
55 | + $alt_description = '<span class="alt-description">' . esc_html( $group['alt_description'] ) . '</span>'; |
|
56 | + } |
|
57 | 57 | |
58 | - $alt_image = ''; |
|
59 | - if ( isset( $group['exercise_alt_thumbnail'] ) && '' !== $group['exercise_alt_thumbnail'] ) { |
|
60 | - $alt_image = $group['exercise_alt_thumbnail']; |
|
61 | - } |
|
58 | + $alt_image = ''; |
|
59 | + if ( isset( $group['exercise_alt_thumbnail'] ) && '' !== $group['exercise_alt_thumbnail'] ) { |
|
60 | + $alt_image = $group['exercise_alt_thumbnail']; |
|
61 | + } |
|
62 | 62 | |
63 | - $reps = ''; |
|
64 | - if ( isset( $group['reps'] ) && '' !== $group['reps'] ) { |
|
65 | - $reps = '<span class="reps">' . esc_html( $group['reps'] ) . '</span>'; |
|
66 | - } |
|
67 | - // Setup our link and content. |
|
68 | - switch ( $link_setting ) { |
|
69 | - case 'single': |
|
70 | - $link_html = ''; |
|
71 | - $link_close = ''; |
|
72 | - if ( $connected_exercise ) { |
|
73 | - $link_html = '<a href="' . get_permalink( $group['connected_exercises'] ) . '">'; |
|
74 | - $link_close = '</a>'; |
|
75 | - } |
|
76 | - break; |
|
63 | + $reps = ''; |
|
64 | + if ( isset( $group['reps'] ) && '' !== $group['reps'] ) { |
|
65 | + $reps = '<span class="reps">' . esc_html( $group['reps'] ) . '</span>'; |
|
66 | + } |
|
67 | + // Setup our link and content. |
|
68 | + switch ( $link_setting ) { |
|
69 | + case 'single': |
|
70 | + $link_html = ''; |
|
71 | + $link_close = ''; |
|
72 | + if ( $connected_exercise ) { |
|
73 | + $link_html = '<a href="' . get_permalink( $group['connected_exercises'] ) . '">'; |
|
74 | + $link_close = '</a>'; |
|
75 | + } |
|
76 | + break; |
|
77 | 77 | |
78 | - case 'modal': |
|
79 | - $link_html = ''; |
|
80 | - $link_close = ''; |
|
81 | - if ( $connected_exercise ) { |
|
82 | - if ( ( '' !== $alt_title ) || ( '' !== $alt_description ) || ( '' !== $alt_image ) ) { |
|
83 | - $link_html = '<a class="alt-modal" data-toggle="modal" href="#workout-alt-exercise-modal-' . $group['connected_exercises'] . '">'; |
|
84 | - $link_close = '</a>'; |
|
85 | - // We call the button to register the alt modal, but we do not output it. |
|
86 | - lsx_health_plan_workout_exercise_alt_button( $group['connected_exercises'], $group, false, $modal_args, $alt_title, $alt_description, $alt_image ); |
|
87 | - } else { |
|
88 | - $link_html = '<a data-toggle="modal" href="#workout-exercise-modal-' . $group['connected_exercises'] . '">'; |
|
89 | - $link_close = '</a>'; |
|
90 | - // We call the button to register the modal, but we do not output it. |
|
91 | - lsx_health_plan_workout_exercise_button( $group['connected_exercises'], $group, false, $modal_args ); |
|
92 | - } |
|
93 | - } |
|
94 | - break; |
|
78 | + case 'modal': |
|
79 | + $link_html = ''; |
|
80 | + $link_close = ''; |
|
81 | + if ( $connected_exercise ) { |
|
82 | + if ( ( '' !== $alt_title ) || ( '' !== $alt_description ) || ( '' !== $alt_image ) ) { |
|
83 | + $link_html = '<a class="alt-modal" data-toggle="modal" href="#workout-alt-exercise-modal-' . $group['connected_exercises'] . '">'; |
|
84 | + $link_close = '</a>'; |
|
85 | + // We call the button to register the alt modal, but we do not output it. |
|
86 | + lsx_health_plan_workout_exercise_alt_button( $group['connected_exercises'], $group, false, $modal_args, $alt_title, $alt_description, $alt_image ); |
|
87 | + } else { |
|
88 | + $link_html = '<a data-toggle="modal" href="#workout-exercise-modal-' . $group['connected_exercises'] . '">'; |
|
89 | + $link_close = '</a>'; |
|
90 | + // We call the button to register the modal, but we do not output it. |
|
91 | + lsx_health_plan_workout_exercise_button( $group['connected_exercises'], $group, false, $modal_args ); |
|
92 | + } |
|
93 | + } |
|
94 | + break; |
|
95 | 95 | |
96 | - case 'none': |
|
97 | - default: |
|
98 | - $link_html = ''; |
|
99 | - $link_close = ''; |
|
100 | - break; |
|
101 | - } |
|
102 | - ?> |
|
96 | + case 'none': |
|
97 | + default: |
|
98 | + $link_html = ''; |
|
99 | + $link_close = ''; |
|
100 | + break; |
|
101 | + } |
|
102 | + ?> |
|
103 | 103 | <article class="lsx-slot box-shadow"> |
104 | 104 | <div class="row"> |
105 | 105 | <div class="col-sm-6 col-md-2"> |
106 | 106 | <div class="exercise-feature-img"> |
107 | 107 | <?php echo wp_kses_post( $link_html ); ?> |
108 | 108 | <?php |
109 | - // We call the button to register the modal, but we do not output it. |
|
110 | - lsx_health_plan_workout_exercise_button( $group['connected_exercises'], $group, false, $modal_args ); |
|
111 | - $thumbnail_args = array( |
|
112 | - 'class' => 'aligncenter', |
|
113 | - ); |
|
114 | - $featured_image = get_the_post_thumbnail( $group['connected_exercises'], 'medium', $thumbnail_args ); |
|
115 | - if ( $alt_image ) { |
|
116 | - $featured_image = '<img alt="thumbnail" loading="lazy" class="aligncenter wp-post-image" src="' . $alt_image . '">'; |
|
117 | - } |
|
118 | - if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
119 | - echo wp_kses_post( $featured_image ); |
|
120 | - } else { |
|
121 | - ?> |
|
109 | + // We call the button to register the modal, but we do not output it. |
|
110 | + lsx_health_plan_workout_exercise_button( $group['connected_exercises'], $group, false, $modal_args ); |
|
111 | + $thumbnail_args = array( |
|
112 | + 'class' => 'aligncenter', |
|
113 | + ); |
|
114 | + $featured_image = get_the_post_thumbnail( $group['connected_exercises'], 'medium', $thumbnail_args ); |
|
115 | + if ( $alt_image ) { |
|
116 | + $featured_image = '<img alt="thumbnail" loading="lazy" class="aligncenter wp-post-image" src="' . $alt_image . '">'; |
|
117 | + } |
|
118 | + if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
119 | + echo wp_kses_post( $featured_image ); |
|
120 | + } else { |
|
121 | + ?> |
|
122 | 122 | <img loading="lazy" src="<?php echo esc_attr( plugin_dir_url( __DIR__ ) . '../assets/images/placeholder.jpg' ); ?>"> |
123 | 123 | <?php |
124 | - } |
|
125 | - ?> |
|
124 | + } |
|
125 | + ?> |
|
126 | 126 | <?php echo wp_kses_post( $link_close ); ?> |
127 | 127 | </div> |
128 | 128 | </div> |
@@ -131,15 +131,15 @@ discard block |
||
131 | 131 | <h3> |
132 | 132 | <?php echo wp_kses_post( $link_html ); ?> |
133 | 133 | <?php |
134 | - $exercise_title = lsx_health_plan_exercise_title( '', '', false, $group['connected_exercises'] ); |
|
135 | - if ( '' !== $alt_title ) { |
|
136 | - $exercise_title = $alt_title; |
|
137 | - } |
|
138 | - if ( '' !== $reps ) { |
|
139 | - $exercise_title .= $reps; |
|
140 | - } |
|
141 | - echo wp_kses_post( $exercise_title ); |
|
142 | - ?> |
|
134 | + $exercise_title = lsx_health_plan_exercise_title( '', '', false, $group['connected_exercises'] ); |
|
135 | + if ( '' !== $alt_title ) { |
|
136 | + $exercise_title = $alt_title; |
|
137 | + } |
|
138 | + if ( '' !== $reps ) { |
|
139 | + $exercise_title .= $reps; |
|
140 | + } |
|
141 | + echo wp_kses_post( $exercise_title ); |
|
142 | + ?> |
|
143 | 143 | <?php echo wp_kses_post( $link_close ); ?> |
144 | 144 | </h3> |
145 | 145 | </div> |
@@ -152,9 +152,9 @@ discard block |
||
152 | 152 | </div> |
153 | 153 | </article> |
154 | 154 | <?php |
155 | - } |
|
156 | - } |
|
157 | - ?> |
|
155 | + } |
|
156 | + } |
|
157 | + ?> |
|
158 | 158 | </div> |
159 | 159 | </div> |
160 | 160 | <?php |
@@ -8,56 +8,56 @@ discard block |
||
8 | 8 | |
9 | 9 | // Check for any shortcode overrides. |
10 | 10 | if ( null !== $shortcode_args && isset( $shortcode_args['include'] ) ) { |
11 | - $connected_workouts = array( get_the_ID() ); |
|
11 | + $connected_workouts = array( get_the_ID() ); |
|
12 | 12 | } |
13 | 13 | ?> |
14 | 14 | <div class="sets"> |
15 | 15 | <?php |
16 | - if ( empty( $connected_workouts ) || null === $connected_workouts ) { |
|
17 | - $connected_workouts = get_post_meta( get_the_ID(), 'connected_workouts', true ); |
|
18 | - if ( empty( $connected_workouts ) ) { |
|
19 | - $options = \lsx_health_plan\functions\get_option( 'all' ); |
|
20 | - if ( isset( $options['connected_workouts'] ) && '' !== $options['connected_workouts'] && ! empty( $options['connected_workouts'] ) ) { |
|
21 | - $connected_workouts = $options['connected_workouts']; |
|
22 | - if ( ! array( $connected_workouts ) ) { |
|
23 | - $connected_workouts = array( $connected_workouts ); |
|
24 | - } |
|
25 | - } |
|
26 | - } |
|
27 | - } |
|
28 | - $args = array( |
|
29 | - 'orderby' => 'date', |
|
30 | - 'order' => 'DESC', |
|
31 | - 'post_type' => 'workout', |
|
32 | - 'post__in' => $connected_workouts, |
|
33 | - ); |
|
34 | - $workouts = new WP_Query( $args ); |
|
16 | + if ( empty( $connected_workouts ) || null === $connected_workouts ) { |
|
17 | + $connected_workouts = get_post_meta( get_the_ID(), 'connected_workouts', true ); |
|
18 | + if ( empty( $connected_workouts ) ) { |
|
19 | + $options = \lsx_health_plan\functions\get_option( 'all' ); |
|
20 | + if ( isset( $options['connected_workouts'] ) && '' !== $options['connected_workouts'] && ! empty( $options['connected_workouts'] ) ) { |
|
21 | + $connected_workouts = $options['connected_workouts']; |
|
22 | + if ( ! array( $connected_workouts ) ) { |
|
23 | + $connected_workouts = array( $connected_workouts ); |
|
24 | + } |
|
25 | + } |
|
26 | + } |
|
27 | + } |
|
28 | + $args = array( |
|
29 | + 'orderby' => 'date', |
|
30 | + 'order' => 'DESC', |
|
31 | + 'post_type' => 'workout', |
|
32 | + 'post__in' => $connected_workouts, |
|
33 | + ); |
|
34 | + $workouts = new WP_Query( $args ); |
|
35 | 35 | |
36 | - if ( $workouts->have_posts() ) { |
|
37 | - while ( $workouts->have_posts() ) { |
|
38 | - $workouts->the_post(); |
|
39 | - // Brings the workout post content first. |
|
40 | - echo wp_kses_post( lsx_health_plan_workout_main_content() ); |
|
36 | + if ( $workouts->have_posts() ) { |
|
37 | + while ( $workouts->have_posts() ) { |
|
38 | + $workouts->the_post(); |
|
39 | + // Brings the workout post content first. |
|
40 | + echo wp_kses_post( lsx_health_plan_workout_main_content() ); |
|
41 | 41 | |
42 | - $i = 1; |
|
43 | - $section_counter = 6; |
|
44 | - while ( $i <= $section_counter ) { |
|
42 | + $i = 1; |
|
43 | + $section_counter = 6; |
|
44 | + while ( $i <= $section_counter ) { |
|
45 | 45 | |
46 | - $workout_section = 'workout_section_' . ( $i ) . '_title'; |
|
47 | - $workout_desc = 'workout_section_' . ( $i ) . '_description'; |
|
46 | + $workout_section = 'workout_section_' . ( $i ) . '_title'; |
|
47 | + $workout_desc = 'workout_section_' . ( $i ) . '_description'; |
|
48 | 48 | |
49 | - $section_title = get_post_meta( get_the_ID(), $workout_section, true ); |
|
50 | - $description = get_post_meta( get_the_ID(), $workout_desc, true ); |
|
51 | - if ( is_singular( 'workout' ) ) { |
|
52 | - $section_title = get_post_meta( get_queried_object_id(), $workout_section, true ); |
|
53 | - $description = get_post_meta( get_queried_object_id(), $workout_desc, true ); |
|
54 | - } |
|
49 | + $section_title = get_post_meta( get_the_ID(), $workout_section, true ); |
|
50 | + $description = get_post_meta( get_the_ID(), $workout_desc, true ); |
|
51 | + if ( is_singular( 'workout' ) ) { |
|
52 | + $section_title = get_post_meta( get_queried_object_id(), $workout_section, true ); |
|
53 | + $description = get_post_meta( get_queried_object_id(), $workout_desc, true ); |
|
54 | + } |
|
55 | 55 | |
56 | - if ( '' === $section_title ) { |
|
57 | - $i++; |
|
58 | - continue; |
|
59 | - } |
|
60 | - ?> |
|
56 | + if ( '' === $section_title ) { |
|
57 | + $i++; |
|
58 | + continue; |
|
59 | + } |
|
60 | + ?> |
|
61 | 61 | <div class="set-box set content-box"> |
62 | 62 | <h3 class="set-title"><?php echo esc_html( $section_title ); ?></h3> |
63 | 63 | <div class="set-content"> |
@@ -66,10 +66,10 @@ discard block |
||
66 | 66 | <?php lsx_health_plan_workout_tab_content( $i ); ?> |
67 | 67 | </div> |
68 | 68 | <?php |
69 | - $i++; |
|
70 | - } |
|
71 | - } |
|
72 | - ?> |
|
69 | + $i++; |
|
70 | + } |
|
71 | + } |
|
72 | + ?> |
|
73 | 73 | <?php } ?> |
74 | 74 | <?php wp_reset_postdata(); ?> |
75 | 75 | </div> |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | global $group_name,$shortcode_args; |
9 | 9 | $groups = get_post_meta( get_the_ID(), $group_name, true ); |
10 | 10 | if ( is_singular( 'workout' ) ) { |
11 | - $groups = get_post_meta( get_queried_object_id(), $group_name, true ); |
|
11 | + $groups = get_post_meta( get_queried_object_id(), $group_name, true ); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | $link_setting = \lsx_health_plan\functions\get_option( 'workout_tab_link', 'single' ); |
@@ -18,161 +18,161 @@ discard block |
||
18 | 18 | |
19 | 19 | // Check for shortcode overrides. |
20 | 20 | if ( null !== $shortcode_args ) { |
21 | - if ( isset( $shortcode_args['link'] ) ) { |
|
22 | - $link_setting = $shortcode_args['link']; |
|
23 | - } |
|
24 | - if ( isset( $shortcode_args['description'] ) ) { |
|
25 | - $content_setting = $shortcode_args['description']; |
|
26 | - } |
|
27 | - if ( isset( $shortcode_args['columns'] ) ) { |
|
28 | - $column_setting = $shortcode_args['columns']; |
|
29 | - $column_setting = \lsx_health_plan\functions\column_class( $column_setting ); |
|
30 | - } |
|
31 | - if ( isset( $shortcode_args['modal_content'] ) ) { |
|
32 | - $modal_content_setting = $shortcode_args['modal_content']; |
|
33 | - } |
|
21 | + if ( isset( $shortcode_args['link'] ) ) { |
|
22 | + $link_setting = $shortcode_args['link']; |
|
23 | + } |
|
24 | + if ( isset( $shortcode_args['description'] ) ) { |
|
25 | + $content_setting = $shortcode_args['description']; |
|
26 | + } |
|
27 | + if ( isset( $shortcode_args['columns'] ) ) { |
|
28 | + $column_setting = $shortcode_args['columns']; |
|
29 | + $column_setting = \lsx_health_plan\functions\column_class( $column_setting ); |
|
30 | + } |
|
31 | + if ( isset( $shortcode_args['modal_content'] ) ) { |
|
32 | + $modal_content_setting = $shortcode_args['modal_content']; |
|
33 | + } |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | $modal_args = array( |
37 | - 'modal_content' => $modal_content_setting, |
|
37 | + 'modal_content' => $modal_content_setting, |
|
38 | 38 | ); |
39 | 39 | |
40 | 40 | $counter = 1; |
41 | 41 | |
42 | 42 | if ( ! empty( $groups ) ) { |
43 | - ?> |
|
43 | + ?> |
|
44 | 44 | <div class="set-grid"> |
45 | 45 | <div class="workout-grid row"> |
46 | 46 | <?php |
47 | - foreach ( $groups as $group ) { |
|
48 | - $connected_exercise = false; |
|
49 | - if ( isset( $group['connected_exercises'] ) && '' !== $group['connected_exercises'] ) { |
|
50 | - $connected_exercise = true; |
|
51 | - } |
|
52 | - |
|
53 | - if ( ! $connected_exercise ) { |
|
54 | - $group['connected_exercises'] = ''; |
|
55 | - } |
|
56 | - |
|
57 | - if ( ( $connected_exercise ) || ( ( ! $connected_exercise ) && '' !== $group['alt_title'] && isset( $group['alt_title'] ) ) ) { |
|
58 | - |
|
59 | - $alt_title = ''; |
|
60 | - if ( isset( $group['alt_title'] ) && '' !== $group['alt_title'] ) { |
|
61 | - $alt_title = '<span class="alt-title">' . esc_html( $group['alt_title'] ) . '</span>'; |
|
62 | - } |
|
63 | - |
|
64 | - $alt_description = ''; |
|
65 | - if ( isset( $group['alt_description'] ) && '' !== $group['alt_description'] ) { |
|
66 | - $alt_description = '<span class="alt-description">' . esc_html( $group['alt_description'] ) . '</span>'; |
|
67 | - } |
|
68 | - |
|
69 | - $alt_image = ''; |
|
70 | - if ( isset( $group['exercise_alt_thumbnail'] ) && '' !== $group['exercise_alt_thumbnail'] ) { |
|
71 | - $alt_image = $group['exercise_alt_thumbnail']; |
|
72 | - } |
|
73 | - |
|
74 | - $reps = ''; |
|
75 | - if ( isset( $group['reps'] ) && '' !== $group['reps'] ) { |
|
76 | - $reps = '<span class="reps">' . esc_html( $group['reps'] ) . '</span>'; |
|
77 | - } |
|
78 | - $class_excerpt = 'no-excerpt'; |
|
79 | - if ( 'excerpt' === $content_setting ) { |
|
80 | - $class_excerpt = 'has-excerpt'; |
|
81 | - } |
|
82 | - // Setup our link and content. |
|
83 | - switch ( $link_setting ) { |
|
84 | - case 'single': |
|
85 | - $link_html = '<a href="' . get_permalink( $group['connected_exercises'] ) . '">'; |
|
86 | - $link_close = '</a>'; |
|
87 | - break; |
|
88 | - |
|
89 | - case 'modal': |
|
90 | - if ( ( '' !== $alt_title ) || ( '' !== $alt_description ) || ( '' !== $alt_image ) ) { |
|
91 | - $link_html = '<a class="alt-modal" data-toggle="modal" href="#workout-alt-exercise-modal-' . $group['connected_exercises'] . '">'; |
|
92 | - $link_close = '</a>'; |
|
93 | - // We call the button to register the alt modal, but we do not output it. |
|
94 | - lsx_health_plan_workout_exercise_alt_button( $group['connected_exercises'], $group, false, $modal_args, $alt_title, $alt_description, $alt_image ); |
|
95 | - } else { |
|
96 | - $link_html = '<a data-toggle="modal" href="#workout-exercise-modal-' . $group['connected_exercises'] . '">'; |
|
97 | - $link_close = '</a>'; |
|
98 | - // We call the button to register the modal, but we do not output it. |
|
99 | - lsx_health_plan_workout_exercise_button( $group['connected_exercises'], $group, false, $modal_args ); |
|
100 | - } |
|
101 | - |
|
102 | - break; |
|
103 | - |
|
104 | - case 'none': |
|
105 | - default: |
|
106 | - $link_html = ''; |
|
107 | - $link_close = ''; |
|
108 | - break; |
|
109 | - } |
|
110 | - ?> |
|
47 | + foreach ( $groups as $group ) { |
|
48 | + $connected_exercise = false; |
|
49 | + if ( isset( $group['connected_exercises'] ) && '' !== $group['connected_exercises'] ) { |
|
50 | + $connected_exercise = true; |
|
51 | + } |
|
52 | + |
|
53 | + if ( ! $connected_exercise ) { |
|
54 | + $group['connected_exercises'] = ''; |
|
55 | + } |
|
56 | + |
|
57 | + if ( ( $connected_exercise ) || ( ( ! $connected_exercise ) && '' !== $group['alt_title'] && isset( $group['alt_title'] ) ) ) { |
|
58 | + |
|
59 | + $alt_title = ''; |
|
60 | + if ( isset( $group['alt_title'] ) && '' !== $group['alt_title'] ) { |
|
61 | + $alt_title = '<span class="alt-title">' . esc_html( $group['alt_title'] ) . '</span>'; |
|
62 | + } |
|
63 | + |
|
64 | + $alt_description = ''; |
|
65 | + if ( isset( $group['alt_description'] ) && '' !== $group['alt_description'] ) { |
|
66 | + $alt_description = '<span class="alt-description">' . esc_html( $group['alt_description'] ) . '</span>'; |
|
67 | + } |
|
68 | + |
|
69 | + $alt_image = ''; |
|
70 | + if ( isset( $group['exercise_alt_thumbnail'] ) && '' !== $group['exercise_alt_thumbnail'] ) { |
|
71 | + $alt_image = $group['exercise_alt_thumbnail']; |
|
72 | + } |
|
73 | + |
|
74 | + $reps = ''; |
|
75 | + if ( isset( $group['reps'] ) && '' !== $group['reps'] ) { |
|
76 | + $reps = '<span class="reps">' . esc_html( $group['reps'] ) . '</span>'; |
|
77 | + } |
|
78 | + $class_excerpt = 'no-excerpt'; |
|
79 | + if ( 'excerpt' === $content_setting ) { |
|
80 | + $class_excerpt = 'has-excerpt'; |
|
81 | + } |
|
82 | + // Setup our link and content. |
|
83 | + switch ( $link_setting ) { |
|
84 | + case 'single': |
|
85 | + $link_html = '<a href="' . get_permalink( $group['connected_exercises'] ) . '">'; |
|
86 | + $link_close = '</a>'; |
|
87 | + break; |
|
88 | + |
|
89 | + case 'modal': |
|
90 | + if ( ( '' !== $alt_title ) || ( '' !== $alt_description ) || ( '' !== $alt_image ) ) { |
|
91 | + $link_html = '<a class="alt-modal" data-toggle="modal" href="#workout-alt-exercise-modal-' . $group['connected_exercises'] . '">'; |
|
92 | + $link_close = '</a>'; |
|
93 | + // We call the button to register the alt modal, but we do not output it. |
|
94 | + lsx_health_plan_workout_exercise_alt_button( $group['connected_exercises'], $group, false, $modal_args, $alt_title, $alt_description, $alt_image ); |
|
95 | + } else { |
|
96 | + $link_html = '<a data-toggle="modal" href="#workout-exercise-modal-' . $group['connected_exercises'] . '">'; |
|
97 | + $link_close = '</a>'; |
|
98 | + // We call the button to register the modal, but we do not output it. |
|
99 | + lsx_health_plan_workout_exercise_button( $group['connected_exercises'], $group, false, $modal_args ); |
|
100 | + } |
|
101 | + |
|
102 | + break; |
|
103 | + |
|
104 | + case 'none': |
|
105 | + default: |
|
106 | + $link_html = ''; |
|
107 | + $link_close = ''; |
|
108 | + break; |
|
109 | + } |
|
110 | + ?> |
|
111 | 111 | <div class="col-xs-12 col-sm-6 col-md-<?php echo esc_attr( $column_setting ); ?>"> |
112 | 112 | <article class="lsx-slot box-shadow"> |
113 | 113 | <div class="exercise-feature-img"> |
114 | 114 | <span class="exercise-counter"><?php echo esc_html( $counter ); ?>.</span> |
115 | 115 | <?php echo wp_kses_post( $link_html ); ?> |
116 | 116 | <?php |
117 | - $thumbnail_args = array( |
|
118 | - 'class' => 'aligncenter', |
|
119 | - ); |
|
120 | - $featured_image = get_the_post_thumbnail( $group['connected_exercises'], 'medium', $thumbnail_args ); |
|
121 | - if ( $alt_image ) { |
|
122 | - $featured_image = '<img alt="thumbnail" loading="lazy" class="aligncenter wp-post-image" src="' . $alt_image . '">'; |
|
123 | - } |
|
124 | - if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
125 | - echo wp_kses_post( $featured_image ); |
|
126 | - } else { |
|
127 | - ?> |
|
117 | + $thumbnail_args = array( |
|
118 | + 'class' => 'aligncenter', |
|
119 | + ); |
|
120 | + $featured_image = get_the_post_thumbnail( $group['connected_exercises'], 'medium', $thumbnail_args ); |
|
121 | + if ( $alt_image ) { |
|
122 | + $featured_image = '<img alt="thumbnail" loading="lazy" class="aligncenter wp-post-image" src="' . $alt_image . '">'; |
|
123 | + } |
|
124 | + if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
125 | + echo wp_kses_post( $featured_image ); |
|
126 | + } else { |
|
127 | + ?> |
|
128 | 128 | <img loading="lazy" src="<?php echo esc_attr( plugin_dir_url( __DIR__ ) . '../assets/images/placeholder.jpg' ); ?>"> |
129 | 129 | <?php |
130 | - } |
|
131 | - ?> |
|
130 | + } |
|
131 | + ?> |
|
132 | 132 | <?php echo wp_kses_post( $link_close ); ?> |
133 | 133 | </div> |
134 | 134 | <div class="content-box exercise-content-box white-bg"> |
135 | 135 | <h3 class="content-box-title <?php echo esc_html( $class_excerpt ); ?>"> |
136 | 136 | <?php echo wp_kses_post( $link_html ); ?> |
137 | 137 | <?php |
138 | - $exercise_title = lsx_health_plan_exercise_title( '', '', false, $group['connected_exercises'] ); |
|
139 | - if ( '' !== $alt_title ) { |
|
140 | - $exercise_title = $alt_title; |
|
141 | - } |
|
142 | - echo wp_kses_post( $exercise_title ); |
|
143 | - ?> |
|
138 | + $exercise_title = lsx_health_plan_exercise_title( '', '', false, $group['connected_exercises'] ); |
|
139 | + if ( '' !== $alt_title ) { |
|
140 | + $exercise_title = $alt_title; |
|
141 | + } |
|
142 | + echo wp_kses_post( $exercise_title ); |
|
143 | + ?> |
|
144 | 144 | </a> |
145 | 145 | <?php echo wp_kses_post( $link_close ); ?> |
146 | 146 | </h3> |
147 | 147 | <?php |
148 | - if ( '' !== $content_setting ) { |
|
149 | - ?> |
|
148 | + if ( '' !== $content_setting ) { |
|
149 | + ?> |
|
150 | 150 | <p class="lsx-exercises-excerpt"> |
151 | 151 | <?php |
152 | - if ( 'excerpt' === $content_setting ) { |
|
153 | - $excerpt = \lsx_health_plan\functions\hp_excerpt( $group['connected_exercises'] ); |
|
154 | - |
|
155 | - if ( '' !== $alt_description ) { |
|
156 | - $excerpt = $alt_description; |
|
157 | - } |
|
158 | - echo wp_kses_post( $excerpt ); |
|
159 | - } |
|
160 | - if ( 'full' === $content_setting ) { |
|
161 | - echo wp_kses_post( get_the_content( null, null, $group['connected_exercises'] ) ); |
|
162 | - } |
|
163 | - ?> |
|
152 | + if ( 'excerpt' === $content_setting ) { |
|
153 | + $excerpt = \lsx_health_plan\functions\hp_excerpt( $group['connected_exercises'] ); |
|
154 | + |
|
155 | + if ( '' !== $alt_description ) { |
|
156 | + $excerpt = $alt_description; |
|
157 | + } |
|
158 | + echo wp_kses_post( $excerpt ); |
|
159 | + } |
|
160 | + if ( 'full' === $content_setting ) { |
|
161 | + echo wp_kses_post( get_the_content( null, null, $group['connected_exercises'] ) ); |
|
162 | + } |
|
163 | + ?> |
|
164 | 164 | </p> |
165 | 165 | <?php |
166 | - } |
|
167 | - ?> |
|
166 | + } |
|
167 | + ?> |
|
168 | 168 | <div class="reps-container"> |
169 | 169 | <?php |
170 | - if ( '' !== $reps ) { |
|
171 | - ?> |
|
170 | + if ( '' !== $reps ) { |
|
171 | + ?> |
|
172 | 172 | <?php echo wp_kses_post( $reps ); ?> |
173 | 173 | <?php |
174 | - } |
|
175 | - ?> |
|
174 | + } |
|
175 | + ?> |
|
176 | 176 | <?php if ( ( '' !== $link_html ) && ( $connected_exercise ) ) { ?> |
177 | 177 | <?php echo wp_kses_post( str_replace( '<a', '<a class="btn-simple" ', $link_html ) ); ?> |
178 | 178 | <?php echo wp_kses_post( $link_close ); ?> |
@@ -182,10 +182,10 @@ discard block |
||
182 | 182 | </article> |
183 | 183 | </div> |
184 | 184 | <?php |
185 | - $counter ++; |
|
186 | - } |
|
187 | - } |
|
188 | - ?> |
|
185 | + $counter ++; |
|
186 | + } |
|
187 | + } |
|
188 | + ?> |
|
189 | 189 | </div> |
190 | 190 | </div> |
191 | 191 | <?php |
@@ -7,18 +7,18 @@ discard block |
||
7 | 7 | global $connected_meals, $shortcode_args; |
8 | 8 | |
9 | 9 | if ( is_singular( 'plan' ) ) { |
10 | - $section_key = get_query_var( 'section' ); |
|
11 | - if ( '' !== $section_key && \lsx_health_plan\functions\plan\has_sections() ) { |
|
12 | - $section_info = \lsx_health_plan\functions\plan\get_section_info( $section_key ); |
|
13 | - if ( isset( $section_info['connected_meals'] ) && '' !== $section_info['connected_meals'] ) { |
|
14 | - $connected_meals = \lsx_health_plan\functions\prep_array( $section_info['connected_meals'] ); |
|
15 | - } |
|
16 | - } |
|
10 | + $section_key = get_query_var( 'section' ); |
|
11 | + if ( '' !== $section_key && \lsx_health_plan\functions\plan\has_sections() ) { |
|
12 | + $section_info = \lsx_health_plan\functions\plan\get_section_info( $section_key ); |
|
13 | + if ( isset( $section_info['connected_meals'] ) && '' !== $section_info['connected_meals'] ) { |
|
14 | + $connected_meals = \lsx_health_plan\functions\prep_array( $section_info['connected_meals'] ); |
|
15 | + } |
|
16 | + } |
|
17 | 17 | } |
18 | 18 | |
19 | 19 | // Check for any shortcode overrides. |
20 | 20 | if ( null !== $shortcode_args && isset( $shortcode_args['include'] ) ) { |
21 | - $connected_meals = array( get_the_ID() ); |
|
21 | + $connected_meals = array( get_the_ID() ); |
|
22 | 22 | } |
23 | 23 | ?> |
24 | 24 | |
@@ -26,152 +26,152 @@ discard block |
||
26 | 26 | |
27 | 27 | <?php |
28 | 28 | |
29 | - // Looking for meals. |
|
30 | - if ( empty( $connected_meals ) ) { |
|
31 | - $connected_meals = get_post_meta( get_the_ID(), 'connected_meals', true ); |
|
32 | - |
|
33 | - if ( empty( $connected_meals ) ) { |
|
34 | - $options = \lsx_health_plan\functions\get_option( 'all' ); |
|
35 | - if ( isset( $options['connected_meals'] ) && '' !== $options['connected_meals'] && ! empty( $options['connected_meals'] ) ) { |
|
36 | - $connected_meals = $options['connected_meals']; |
|
37 | - if ( ! array( $connected_meals ) ) { |
|
38 | - $connected_meals = array( $connected_meals ); |
|
39 | - } |
|
40 | - } |
|
41 | - } |
|
42 | - } |
|
43 | - |
|
44 | - // This is for the meal single template. |
|
45 | - if ( is_single() && is_singular( 'meal' ) ) { |
|
46 | - $connected_meals = array( get_the_ID() ); |
|
47 | - } |
|
48 | - |
|
49 | - // Shoping list |
|
50 | - $shopping_list = get_post_meta( get_the_ID(), 'meal_shopping_list', true ); |
|
51 | - if ( ! empty( $shopping_list ) ) { |
|
52 | - ?> |
|
29 | + // Looking for meals. |
|
30 | + if ( empty( $connected_meals ) ) { |
|
31 | + $connected_meals = get_post_meta( get_the_ID(), 'connected_meals', true ); |
|
32 | + |
|
33 | + if ( empty( $connected_meals ) ) { |
|
34 | + $options = \lsx_health_plan\functions\get_option( 'all' ); |
|
35 | + if ( isset( $options['connected_meals'] ) && '' !== $options['connected_meals'] && ! empty( $options['connected_meals'] ) ) { |
|
36 | + $connected_meals = $options['connected_meals']; |
|
37 | + if ( ! array( $connected_meals ) ) { |
|
38 | + $connected_meals = array( $connected_meals ); |
|
39 | + } |
|
40 | + } |
|
41 | + } |
|
42 | + } |
|
43 | + |
|
44 | + // This is for the meal single template. |
|
45 | + if ( is_single() && is_singular( 'meal' ) ) { |
|
46 | + $connected_meals = array( get_the_ID() ); |
|
47 | + } |
|
48 | + |
|
49 | + // Shoping list |
|
50 | + $shopping_list = get_post_meta( get_the_ID(), 'meal_shopping_list', true ); |
|
51 | + if ( ! empty( $shopping_list ) ) { |
|
52 | + ?> |
|
53 | 53 | <a class="btn border-btn btn-shopping" href="<?php echo esc_url( get_page_link( $shopping_list ) ); ?>" target="_blank"><?php esc_html_e( 'Download Shopping List', 'lsx-health-plan' ); ?><i class="fa fa-download" aria-hidden="true"></i></a> |
54 | 54 | <?php |
55 | - } |
|
56 | - |
|
57 | - // The top part |
|
58 | - echo wp_kses_post( wp_kses_post( lsx_health_plan_meal_main_content() ) ); |
|
59 | - |
|
60 | - if ( false !== $connected_meals && '' !== $connected_meals && ! empty( $connected_meals ) ) { |
|
61 | - |
|
62 | - $args = array( |
|
63 | - 'orderby' => 'date', |
|
64 | - 'order' => 'DESC', |
|
65 | - 'post_type' => 'meal', |
|
66 | - 'post__in' => $connected_meals, |
|
67 | - ); |
|
68 | - $meals = new WP_Query( $args ); |
|
69 | - if ( $meals->have_posts() ) { |
|
70 | - while ( $meals->have_posts() ) { |
|
71 | - $meals->the_post(); |
|
72 | - $meal_id = get_the_ID(); |
|
55 | + } |
|
56 | + |
|
57 | + // The top part |
|
58 | + echo wp_kses_post( wp_kses_post( lsx_health_plan_meal_main_content() ) ); |
|
59 | + |
|
60 | + if ( false !== $connected_meals && '' !== $connected_meals && ! empty( $connected_meals ) ) { |
|
61 | + |
|
62 | + $args = array( |
|
63 | + 'orderby' => 'date', |
|
64 | + 'order' => 'DESC', |
|
65 | + 'post_type' => 'meal', |
|
66 | + 'post__in' => $connected_meals, |
|
67 | + ); |
|
68 | + $meals = new WP_Query( $args ); |
|
69 | + if ( $meals->have_posts() ) { |
|
70 | + while ( $meals->have_posts() ) { |
|
71 | + $meals->the_post(); |
|
72 | + $meal_id = get_the_ID(); |
|
73 | 73 | |
74 | 74 | |
75 | - // Breakfast. |
|
76 | - $pre_breakfast_snack = get_post_meta( get_the_ID(), 'meal_pre_breakfast_snack', true ); |
|
77 | - $breakfast = get_post_meta( get_the_ID(), 'meal_breakfast', true ); |
|
78 | - $post_breakfast_snack = get_post_meta( get_the_ID(), 'meal_breakfast_snack', true ); |
|
75 | + // Breakfast. |
|
76 | + $pre_breakfast_snack = get_post_meta( get_the_ID(), 'meal_pre_breakfast_snack', true ); |
|
77 | + $breakfast = get_post_meta( get_the_ID(), 'meal_breakfast', true ); |
|
78 | + $post_breakfast_snack = get_post_meta( get_the_ID(), 'meal_breakfast_snack', true ); |
|
79 | 79 | |
80 | - // Lunch. |
|
81 | - $pre_lunch_snack = get_post_meta( get_the_ID(), 'meal_pre_lunch_snack', true ); |
|
82 | - $lunch = get_post_meta( get_the_ID(), 'meal_lunch', true ); |
|
83 | - $post_lunch_snack = get_post_meta( get_the_ID(), 'meal_lunch_snack', true ); |
|
80 | + // Lunch. |
|
81 | + $pre_lunch_snack = get_post_meta( get_the_ID(), 'meal_pre_lunch_snack', true ); |
|
82 | + $lunch = get_post_meta( get_the_ID(), 'meal_lunch', true ); |
|
83 | + $post_lunch_snack = get_post_meta( get_the_ID(), 'meal_lunch_snack', true ); |
|
84 | 84 | |
85 | - // Dinner. |
|
86 | - $pre_dinner_snack = get_post_meta( get_the_ID(), 'meal_pre_dinner_snack', true ); |
|
87 | - $dinner = get_post_meta( get_the_ID(), 'meal_dinner', true ); |
|
88 | - $post_dinner_snack = get_post_meta( get_the_ID(), 'meal_dinner_snack', true ); |
|
85 | + // Dinner. |
|
86 | + $pre_dinner_snack = get_post_meta( get_the_ID(), 'meal_pre_dinner_snack', true ); |
|
87 | + $dinner = get_post_meta( get_the_ID(), 'meal_dinner', true ); |
|
88 | + $post_dinner_snack = get_post_meta( get_the_ID(), 'meal_dinner_snack', true ); |
|
89 | 89 | |
90 | - //Main Meals Title |
|
91 | - //echo '<h3 class="meals-section-title">' . esc_html__( 'Meal Plan', 'lsx-health-plan' ) . '</h3>'; |
|
92 | - ?> |
|
90 | + //Main Meals Title |
|
91 | + //echo '<h3 class="meals-section-title">' . esc_html__( 'Meal Plan', 'lsx-health-plan' ) . '</h3>'; |
|
92 | + ?> |
|
93 | 93 | <div class="row eating-row"> |
94 | 94 | <div class="col-md-4 eating-column"> |
95 | 95 | <?php |
96 | - if ( ! empty( $pre_breakfast_snack ) ) { |
|
97 | - echo '<div class="content-box"><h3 class="eating-title snack-title">' . esc_html__( 'Snack', 'lsx-health-plan' ) . '</h3>'; |
|
98 | - echo wp_kses_post( apply_filters( 'the_content', $pre_breakfast_snack ) ); |
|
99 | - echo '</div>'; |
|
100 | - } |
|
101 | - if ( ! empty( $breakfast ) ) { |
|
102 | - echo '<div class="content-box"><h3 class="eating-title">' . esc_html__( 'Breakfast', 'lsx-health-plan' ) . '</h3>'; |
|
103 | - echo wp_kses_post( apply_filters( 'the_content', $breakfast ) ); |
|
104 | - echo '</div>'; |
|
105 | - } |
|
106 | - if ( ! empty( $post_breakfast_snack ) ) { |
|
107 | - echo '<div class="content-box"><h3 class="eating-title snack-title">' . esc_html__( 'Snack', 'lsx-health-plan' ) . '</h3>'; |
|
108 | - echo wp_kses_post( apply_filters( 'the_content', $post_breakfast_snack ) ); |
|
109 | - echo '</div>'; |
|
110 | - } |
|
111 | - |
|
112 | - $args = array( |
|
113 | - 'meal_id' => $meal_id, |
|
114 | - 'meal_time' => 'breakfast', |
|
115 | - ); |
|
116 | - lsx_hp_meal_plan_recipes( $args ); |
|
117 | - ?> |
|
96 | + if ( ! empty( $pre_breakfast_snack ) ) { |
|
97 | + echo '<div class="content-box"><h3 class="eating-title snack-title">' . esc_html__( 'Snack', 'lsx-health-plan' ) . '</h3>'; |
|
98 | + echo wp_kses_post( apply_filters( 'the_content', $pre_breakfast_snack ) ); |
|
99 | + echo '</div>'; |
|
100 | + } |
|
101 | + if ( ! empty( $breakfast ) ) { |
|
102 | + echo '<div class="content-box"><h3 class="eating-title">' . esc_html__( 'Breakfast', 'lsx-health-plan' ) . '</h3>'; |
|
103 | + echo wp_kses_post( apply_filters( 'the_content', $breakfast ) ); |
|
104 | + echo '</div>'; |
|
105 | + } |
|
106 | + if ( ! empty( $post_breakfast_snack ) ) { |
|
107 | + echo '<div class="content-box"><h3 class="eating-title snack-title">' . esc_html__( 'Snack', 'lsx-health-plan' ) . '</h3>'; |
|
108 | + echo wp_kses_post( apply_filters( 'the_content', $post_breakfast_snack ) ); |
|
109 | + echo '</div>'; |
|
110 | + } |
|
111 | + |
|
112 | + $args = array( |
|
113 | + 'meal_id' => $meal_id, |
|
114 | + 'meal_time' => 'breakfast', |
|
115 | + ); |
|
116 | + lsx_hp_meal_plan_recipes( $args ); |
|
117 | + ?> |
|
118 | 118 | </div> |
119 | 119 | <div class="col-md-4 eating-column"> |
120 | 120 | <?php |
121 | - if ( ! empty( $pre_lunch_snack ) ) { |
|
122 | - echo '<div class="content-box"><h3 class="eating-title snack-title">' . esc_html__( 'Snack', 'lsx-health-plan' ) . '</h3>'; |
|
123 | - echo wp_kses_post( apply_filters( 'the_content', $pre_lunch_snack ) ); |
|
124 | - echo '</div>'; |
|
125 | - } |
|
126 | - if ( ! empty( $lunch ) ) { |
|
127 | - echo '<div class="content-box"><h3 class="eating-title">' . esc_html__( 'Lunch', 'lsx-health-plan' ) . '</h3>'; |
|
128 | - echo wp_kses_post( apply_filters( 'the_content', $lunch ) ); |
|
129 | - echo '</div>'; |
|
130 | - } |
|
131 | - if ( ! empty( $post_lunch_snack ) ) { |
|
132 | - echo '<div class="content-box"><h3 class="eating-title snack-title">' . esc_html__( 'Snack', 'lsx-health-plan' ) . '</h3>'; |
|
133 | - echo wp_kses_post( apply_filters( 'the_content', $post_lunch_snack ) ); |
|
134 | - echo '</div>'; |
|
135 | - } |
|
136 | - |
|
137 | - $args = array( |
|
138 | - 'meal_id' => $meal_id, |
|
139 | - 'meal_time' => 'lunch', |
|
140 | - ); |
|
141 | - lsx_hp_meal_plan_recipes( $args ); |
|
142 | - ?> |
|
121 | + if ( ! empty( $pre_lunch_snack ) ) { |
|
122 | + echo '<div class="content-box"><h3 class="eating-title snack-title">' . esc_html__( 'Snack', 'lsx-health-plan' ) . '</h3>'; |
|
123 | + echo wp_kses_post( apply_filters( 'the_content', $pre_lunch_snack ) ); |
|
124 | + echo '</div>'; |
|
125 | + } |
|
126 | + if ( ! empty( $lunch ) ) { |
|
127 | + echo '<div class="content-box"><h3 class="eating-title">' . esc_html__( 'Lunch', 'lsx-health-plan' ) . '</h3>'; |
|
128 | + echo wp_kses_post( apply_filters( 'the_content', $lunch ) ); |
|
129 | + echo '</div>'; |
|
130 | + } |
|
131 | + if ( ! empty( $post_lunch_snack ) ) { |
|
132 | + echo '<div class="content-box"><h3 class="eating-title snack-title">' . esc_html__( 'Snack', 'lsx-health-plan' ) . '</h3>'; |
|
133 | + echo wp_kses_post( apply_filters( 'the_content', $post_lunch_snack ) ); |
|
134 | + echo '</div>'; |
|
135 | + } |
|
136 | + |
|
137 | + $args = array( |
|
138 | + 'meal_id' => $meal_id, |
|
139 | + 'meal_time' => 'lunch', |
|
140 | + ); |
|
141 | + lsx_hp_meal_plan_recipes( $args ); |
|
142 | + ?> |
|
143 | 143 | </div> |
144 | 144 | <div class="col-md-4 eating-column"> |
145 | 145 | <?php |
146 | - if ( ! empty( $pre_dinner_snack ) ) { |
|
147 | - echo '<div class="content-box"><h3 class="eating-title snack-title">' . esc_html__( 'Snack', 'lsx-health-plan' ) . '</h3>'; |
|
148 | - echo wp_kses_post( apply_filters( 'the_content', $pre_dinner_snack ) ); |
|
149 | - echo '</div>'; |
|
150 | - } |
|
151 | - if ( ! empty( $dinner ) ) { |
|
152 | - echo '<div class="content-box"><h3 class="eating-title">' . esc_html__( 'Dinner', 'lsx-health-plan' ) . '</h3>'; |
|
153 | - echo wp_kses_post( apply_filters( 'the_content', $dinner ) ); |
|
154 | - echo '</div>'; |
|
155 | - } |
|
156 | - if ( ! empty( $post_dinner_snack ) ) { |
|
157 | - echo '<div class="content-box"><h3 class="eating-title snack-title">' . esc_html__( 'Snack', 'lsx-health-plan' ) . '</h3>'; |
|
158 | - echo wp_kses_post( apply_filters( 'the_content', $post_dinner_snack ) ); |
|
159 | - echo '</div>'; |
|
160 | - } |
|
161 | - |
|
162 | - $args = array( |
|
163 | - 'meal_id' => $meal_id, |
|
164 | - 'meal_time' => 'dinner', |
|
165 | - ); |
|
166 | - lsx_hp_meal_plan_recipes( $args ); |
|
167 | - ?> |
|
146 | + if ( ! empty( $pre_dinner_snack ) ) { |
|
147 | + echo '<div class="content-box"><h3 class="eating-title snack-title">' . esc_html__( 'Snack', 'lsx-health-plan' ) . '</h3>'; |
|
148 | + echo wp_kses_post( apply_filters( 'the_content', $pre_dinner_snack ) ); |
|
149 | + echo '</div>'; |
|
150 | + } |
|
151 | + if ( ! empty( $dinner ) ) { |
|
152 | + echo '<div class="content-box"><h3 class="eating-title">' . esc_html__( 'Dinner', 'lsx-health-plan' ) . '</h3>'; |
|
153 | + echo wp_kses_post( apply_filters( 'the_content', $dinner ) ); |
|
154 | + echo '</div>'; |
|
155 | + } |
|
156 | + if ( ! empty( $post_dinner_snack ) ) { |
|
157 | + echo '<div class="content-box"><h3 class="eating-title snack-title">' . esc_html__( 'Snack', 'lsx-health-plan' ) . '</h3>'; |
|
158 | + echo wp_kses_post( apply_filters( 'the_content', $post_dinner_snack ) ); |
|
159 | + echo '</div>'; |
|
160 | + } |
|
161 | + |
|
162 | + $args = array( |
|
163 | + 'meal_id' => $meal_id, |
|
164 | + 'meal_time' => 'dinner', |
|
165 | + ); |
|
166 | + lsx_hp_meal_plan_recipes( $args ); |
|
167 | + ?> |
|
168 | 168 | </div> |
169 | 169 | </div> |
170 | 170 | <?php |
171 | - } |
|
172 | - } |
|
173 | - } |
|
174 | - ?> |
|
171 | + } |
|
172 | + } |
|
173 | + } |
|
174 | + ?> |
|
175 | 175 | <?php wp_reset_postdata(); ?> |
176 | 176 | </div> |
177 | 177 | <?php |
@@ -11,8 +11,8 @@ discard block |
||
11 | 11 | |
12 | 12 | <?php |
13 | 13 | $args = array( |
14 | - 'post_parent' => get_the_ID(), |
|
15 | - 'post_type' => 'plan', |
|
14 | + 'post_parent' => get_the_ID(), |
|
15 | + 'post_type' => 'plan', |
|
16 | 16 | ); |
17 | 17 | |
18 | 18 | $plan_id = get_the_ID(); |
@@ -28,20 +28,20 @@ discard block |
||
28 | 28 | $connected_articles = get_post_meta( get_the_ID(), ( $plan . '_connected_articles' ), true ); |
29 | 29 | |
30 | 30 | if ( ! empty( $has_sections ) ) { |
31 | - $plan_type_class = 'parent-plan'; |
|
32 | - if ( 0 !== $has_parent ) { |
|
33 | - $plan_type_class = 'parent-sub-plan'; |
|
34 | - } |
|
31 | + $plan_type_class = 'parent-plan'; |
|
32 | + if ( 0 !== $has_parent ) { |
|
33 | + $plan_type_class = 'parent-sub-plan'; |
|
34 | + } |
|
35 | 35 | } else { |
36 | - $plan_type_class = 'unique-plan'; |
|
37 | - if ( 0 !== $has_parent ) { |
|
38 | - $plan_type_class = 'child-plan-' . $has_parent; |
|
39 | - } |
|
36 | + $plan_type_class = 'unique-plan'; |
|
37 | + if ( 0 !== $has_parent ) { |
|
38 | + $plan_type_class = 'child-plan-' . $has_parent; |
|
39 | + } |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | // Get the plan restrictions. |
43 | 43 | if ( function_exists( 'wc_memberships_is_post_content_restricted' ) && wc_memberships_is_post_content_restricted( get_the_ID() ) ) { |
44 | - $restricted = ! current_user_can( 'wc_memberships_view_restricted_post_content', get_the_ID() ); |
|
44 | + $restricted = ! current_user_can( 'wc_memberships_view_restricted_post_content', get_the_ID() ); |
|
45 | 45 | } |
46 | 46 | ?> |
47 | 47 | |
@@ -54,8 +54,8 @@ discard block |
||
54 | 54 | <?php lsx_content_top(); ?> |
55 | 55 | |
56 | 56 | <?php |
57 | - if ( ! empty( $has_sections ) && false === $is_section ) { |
|
58 | - ?> |
|
57 | + if ( ! empty( $has_sections ) && false === $is_section ) { |
|
58 | + ?> |
|
59 | 59 | <div class="post-wrapper"> |
60 | 60 | <div class="plan-content"> |
61 | 61 | <?php the_content(); ?> |
@@ -71,30 +71,30 @@ discard block |
||
71 | 71 | <div class="plan"> |
72 | 72 | <?php |
73 | 73 | |
74 | - // The top part |
|
75 | - echo wp_kses_post( wp_kses_post( lsx_health_plan_main_content() ) ); |
|
74 | + // The top part |
|
75 | + echo wp_kses_post( wp_kses_post( lsx_health_plan_main_content() ) ); |
|
76 | 76 | |
77 | - echo wp_kses_post( '<h3 class="my-plan-title">' . __( 'Your Game Plan', 'lsx-health-plan' ) . '</h3>' ); |
|
77 | + echo wp_kses_post( '<h3 class="my-plan-title">' . __( 'Your Game Plan', 'lsx-health-plan' ) . '</h3>' ); |
|
78 | 78 | |
79 | - ?> |
|
79 | + ?> |
|
80 | 80 | <div class="the-plan-content"> |
81 | 81 | <?php |
82 | 82 | |
83 | - if ( false === $restricted ) { |
|
84 | - 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>' . \lsx_health_plan\functions\get_progress( get_the_ID() ) . '%</span></span>' ); |
|
85 | - } |
|
83 | + if ( false === $restricted ) { |
|
84 | + 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>' . \lsx_health_plan\functions\get_progress( get_the_ID() ) . '%</span></span>' ); |
|
85 | + } |
|
86 | 86 | |
87 | - echo do_shortcode( '[lsx_health_plan_day_plan_block week_view="true" show_downloads="true" plan="' . get_the_ID() . '"]' ); |
|
87 | + echo do_shortcode( '[lsx_health_plan_day_plan_block week_view="true" show_downloads="true" plan="' . get_the_ID() . '"]' ); |
|
88 | 88 | |
89 | - ?> |
|
89 | + ?> |
|
90 | 90 | <div class="row status-plan-buttons main-plan-btn"> |
91 | 91 | <?php |
92 | - if ( function_exists( 'wc_get_page_id' ) ) { |
|
93 | - ?> |
|
92 | + if ( function_exists( 'wc_get_page_id' ) ) { |
|
93 | + ?> |
|
94 | 94 | <a class="btn border-btn" href="<?php echo wp_kses_post( get_permalink( wc_get_page_id( 'myaccount' ) ) ); ?>"><?php esc_html_e( 'My Plans', 'lsx-health-plan' ); ?></a> |
95 | 95 | <?php |
96 | - } |
|
97 | - ?> |
|
96 | + } |
|
97 | + ?> |
|
98 | 98 | </div> |
99 | 99 | </div> |
100 | 100 | </div> |
@@ -106,25 +106,25 @@ discard block |
||
106 | 106 | |
107 | 107 | <?php |
108 | 108 | |
109 | - } else { |
|
109 | + } else { |
|
110 | 110 | |
111 | - lsx_health_plan_single_nav(); |
|
112 | - lsx_health_plan_single_tabs(); |
|
113 | - ?> |
|
111 | + lsx_health_plan_single_nav(); |
|
112 | + lsx_health_plan_single_tabs(); |
|
113 | + ?> |
|
114 | 114 | <div class="row status-plan-buttons"> |
115 | 115 | <?php lsx_health_plan_day_button(); ?> |
116 | 116 | </div> |
117 | 117 | <?php |
118 | - } |
|
119 | - ?> |
|
118 | + } |
|
119 | + ?> |
|
120 | 120 | |
121 | 121 | <?php lsx_content_bottom(); ?> |
122 | 122 | |
123 | 123 | <?php |
124 | - if ( ! empty( $connected_articles ) ) { |
|
125 | - lsx_hp_single_related( $connected_articles, __( 'Latest articles', 'lsx-health-plan' ) ); |
|
126 | - } |
|
127 | - ?> |
|
124 | + if ( ! empty( $connected_articles ) ) { |
|
125 | + lsx_hp_single_related( $connected_articles, __( 'Latest articles', 'lsx-health-plan' ) ); |
|
126 | + } |
|
127 | + ?> |
|
128 | 128 | |
129 | 129 | |
130 | 130 | </main><!-- #main --> |