@@ -38,9 +38,12 @@ |
||
38 | 38 | |
39 | 39 | <?php endwhile; ?> |
40 | 40 | |
41 | - <?php else : ?> |
|
41 | + <?php else { |
|
42 | + : ?> |
|
42 | 43 | |
43 | - <?php get_template_part( 'partials/content', 'none' ); ?> |
|
44 | + <?php get_template_part( 'partials/content', 'none' ); |
|
45 | +} |
|
46 | +?> |
|
44 | 47 | |
45 | 48 | <?php endif; ?> |
46 | 49 | </div> |
@@ -10,9 +10,9 @@ discard block |
||
10 | 10 | <?php lsx_content_wrap_before(); ?> |
11 | 11 | |
12 | 12 | <?php |
13 | - $restricted = false; |
|
14 | - $page_id = get_the_ID(); |
|
15 | - $redirect = '/content-restricted/?r=' . $page_id . '&wcm_redirect_to=archive&wcm_redirect_id=' . $page_id; |
|
13 | + $restricted = false; |
|
14 | + $page_id = get_the_ID(); |
|
15 | + $redirect = '/content-restricted/?r=' . $page_id . '&wcm_redirect_to=archive&wcm_redirect_id=' . $page_id; |
|
16 | 16 | ?> |
17 | 17 | |
18 | 18 | <div id="primary" class="content-area <?php echo esc_attr( lsx_main_class() ); ?>"> |
@@ -21,8 +21,8 @@ discard block |
||
21 | 21 | |
22 | 22 | <!-- Begining restricted content --> |
23 | 23 | <?php |
24 | - if ( ! function_exists( 'wc_memberships_view_restricted_post_content' ) || ( current_user_can( 'wc_memberships_view_restricted_post_content', $post_id ) ) ) { |
|
25 | - ?> |
|
24 | + if ( ! function_exists( 'wc_memberships_view_restricted_post_content' ) || ( current_user_can( 'wc_memberships_view_restricted_post_content', $post_id ) ) ) { |
|
25 | + ?> |
|
26 | 26 | <main id="main" role="main"> |
27 | 27 | |
28 | 28 | <?php lsx_content_top(); ?> |
@@ -31,9 +31,9 @@ discard block |
||
31 | 31 | <div class="row"> |
32 | 32 | <?php if ( have_posts() ) : ?> |
33 | 33 | <?php |
34 | - while ( have_posts() ) : |
|
35 | - the_post(); |
|
36 | - ?> |
|
34 | + while ( have_posts() ) : |
|
35 | + the_post(); |
|
36 | + ?> |
|
37 | 37 | |
38 | 38 | <?php include LSX_HEALTH_PLAN_PATH . '/templates/content-archive-plan.php'; ?> |
39 | 39 | |
@@ -52,11 +52,11 @@ discard block |
||
52 | 52 | </main><!-- #main --> |
53 | 53 | |
54 | 54 | <?php |
55 | - } else { |
|
56 | - wp_redirect( $redirect ); |
|
57 | - exit; |
|
58 | - } |
|
59 | - ?> |
|
55 | + } else { |
|
56 | + wp_redirect( $redirect ); |
|
57 | + exit; |
|
58 | + } |
|
59 | + ?> |
|
60 | 60 | |
61 | 61 | <?php lsx_content_after(); ?> |
62 | 62 |
@@ -15,13 +15,13 @@ discard block |
||
15 | 15 | $redirect = '/content-restricted/?r=' . $page_id . '&wcm_redirect_to=archive&wcm_redirect_id=' . $page_id; |
16 | 16 | ?> |
17 | 17 | |
18 | - <div id="primary" class="content-area <?php echo esc_attr( lsx_main_class() ); ?>"> |
|
18 | + <div id="primary" class="content-area <?php echo esc_attr(lsx_main_class()); ?>"> |
|
19 | 19 | |
20 | 20 | <?php lsx_content_before(); ?> |
21 | 21 | |
22 | 22 | <!-- Begining restricted content --> |
23 | 23 | <?php |
24 | - if ( ! function_exists( 'wc_memberships_view_restricted_post_content' ) || ( current_user_can( 'wc_memberships_view_restricted_post_content', $post_id ) ) ) { |
|
24 | + if ( ! function_exists('wc_memberships_view_restricted_post_content') || (current_user_can('wc_memberships_view_restricted_post_content', $post_id))) { |
|
25 | 25 | ?> |
26 | 26 | <main id="main" role="main"> |
27 | 27 | |
@@ -29,9 +29,9 @@ discard block |
||
29 | 29 | |
30 | 30 | <div class="post-wrapper archive-plan"> |
31 | 31 | <div class="row"> |
32 | - <?php if ( have_posts() ) : ?> |
|
32 | + <?php if (have_posts()) : ?> |
|
33 | 33 | <?php |
34 | - while ( have_posts() ) : |
|
34 | + while (have_posts()) : |
|
35 | 35 | the_post(); |
36 | 36 | ?> |
37 | 37 | |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | |
42 | 42 | <?php else : ?> |
43 | 43 | |
44 | - <?php get_template_part( 'partials/content', 'none' ); ?> |
|
44 | + <?php get_template_part('partials/content', 'none'); ?> |
|
45 | 45 | |
46 | 46 | <?php endif; ?> |
47 | 47 | </div> |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | |
54 | 54 | <?php |
55 | 55 | } else { |
56 | - wp_redirect( $redirect ); |
|
56 | + wp_redirect($redirect); |
|
57 | 57 | exit; |
58 | 58 | } |
59 | 59 | ?> |
@@ -16,40 +16,40 @@ discard block |
||
16 | 16 | $image_size = $args['image_size']; |
17 | 17 | |
18 | 18 | $query_array = array( |
19 | - 'orderby' => $args['orderby'], |
|
20 | - 'order' => $args['order'], |
|
21 | - 'post_type' => $args['post_type'], |
|
22 | - 'posts_per_page' => $limit, |
|
19 | + 'orderby' => $args['orderby'], |
|
20 | + 'order' => $args['order'], |
|
21 | + 'post_type' => $args['post_type'], |
|
22 | + 'posts_per_page' => $limit, |
|
23 | 23 | ); |
24 | 24 | |
25 | 25 | // If we are calling the exercises with the parent workout. |
26 | 26 | if ( false !== 'parent' && 'exercise' === $args['post_type'] ) { |
27 | - $items = \lsx_health_plan\functions\get_exercises_by_workout( $args['parent'] ); |
|
28 | - if ( ! empty( $items ) ) { |
|
29 | - $args['include'] = $items; |
|
30 | - } |
|
27 | + $items = \lsx_health_plan\functions\get_exercises_by_workout( $args['parent'] ); |
|
28 | + if ( ! empty( $items ) ) { |
|
29 | + $args['include'] = $items; |
|
30 | + } |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | if ( isset( $args['include'] ) && ( '' !== $args['include'] ) ) { |
34 | - if ( is_array( $args['include'] ) ) { |
|
35 | - $include = $args['include']; |
|
36 | - } else { |
|
37 | - $include = explode( ',', $args['include'] ); |
|
38 | - } |
|
39 | - $include_filter = $include; |
|
40 | - $query_array['post__in'] = $include_filter; |
|
41 | - $query_array['orderby'] = 'post__in'; |
|
34 | + if ( is_array( $args['include'] ) ) { |
|
35 | + $include = $args['include']; |
|
36 | + } else { |
|
37 | + $include = explode( ',', $args['include'] ); |
|
38 | + } |
|
39 | + $include_filter = $include; |
|
40 | + $query_array['post__in'] = $include_filter; |
|
41 | + $query_array['orderby'] = 'post__in'; |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | if ( isset( $taxonomy ) && ( '' !== $taxonomy ) && isset( $term ) && ( '' !== $term ) ) { |
45 | - $taxonomy_filter = array( |
|
46 | - array( |
|
47 | - 'taxonomy' => $taxonomy, |
|
48 | - 'field' => 'slug', |
|
49 | - 'terms' => $term, |
|
50 | - ), |
|
51 | - ); |
|
52 | - $query_array['tax_query'] = $taxonomy_filter; |
|
45 | + $taxonomy_filter = array( |
|
46 | + array( |
|
47 | + 'taxonomy' => $taxonomy, |
|
48 | + 'field' => 'slug', |
|
49 | + 'terms' => $term, |
|
50 | + ), |
|
51 | + ); |
|
52 | + $query_array['tax_query'] = $taxonomy_filter; |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | $exercises = new WP_Query( $query_array ); |
@@ -58,46 +58,46 @@ discard block |
||
58 | 58 | <div id="lsx-exercises-shortcode" class="daily-plan-block layout-<?php echo esc_html( $args['layout'] ); ?> columns-<?php echo esc_html( $args['columns'] ); ?> shortcode-type-<?php echo esc_html( $args['post_type'] ); ?>"> |
59 | 59 | <div class="lsx-exercises-shortcode" > |
60 | 60 | <?php |
61 | - if ( $exercises->have_posts() ) { |
|
62 | - while ( $exercises->have_posts() ) { |
|
63 | - $exercises->the_post(); |
|
64 | - switch ( $args['post_type'] ) { |
|
65 | - case 'workout': |
|
66 | - include LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-sets.php'; |
|
67 | - break; |
|
61 | + if ( $exercises->have_posts() ) { |
|
62 | + while ( $exercises->have_posts() ) { |
|
63 | + $exercises->the_post(); |
|
64 | + switch ( $args['post_type'] ) { |
|
65 | + case 'workout': |
|
66 | + include LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-sets.php'; |
|
67 | + break; |
|
68 | 68 | |
69 | - case 'meal': |
|
70 | - include LSX_HEALTH_PLAN_PATH . 'templates/partials/meal-plans.php'; |
|
71 | - break; |
|
69 | + case 'meal': |
|
70 | + include LSX_HEALTH_PLAN_PATH . 'templates/partials/meal-plans.php'; |
|
71 | + break; |
|
72 | 72 | |
73 | - /*case 'exercise': |
|
73 | + /*case 'exercise': |
|
74 | 74 | include LSX_HEALTH_PLAN_PATH . 'templates/partials/content-shortcode-exercise.php'; |
75 | 75 | break;*/ |
76 | 76 | |
77 | - case 'exercise': |
|
78 | - case 'recipe': |
|
79 | - case 'tip': |
|
80 | - include LSX_HEALTH_PLAN_PATH . 'templates/content-archive-' . $args['post_type'] . '.php'; |
|
81 | - break; |
|
77 | + case 'exercise': |
|
78 | + case 'recipe': |
|
79 | + case 'tip': |
|
80 | + include LSX_HEALTH_PLAN_PATH . 'templates/content-archive-' . $args['post_type'] . '.php'; |
|
81 | + break; |
|
82 | 82 | |
83 | - default: |
|
84 | - include LSX_HEALTH_PLAN_PATH . 'templates/partials/content-default.php'; |
|
85 | - break; |
|
86 | - } |
|
87 | - } |
|
88 | - } |
|
89 | - wp_reset_postdata(); |
|
90 | - ?> |
|
83 | + default: |
|
84 | + include LSX_HEALTH_PLAN_PATH . 'templates/partials/content-default.php'; |
|
85 | + break; |
|
86 | + } |
|
87 | + } |
|
88 | + } |
|
89 | + wp_reset_postdata(); |
|
90 | + ?> |
|
91 | 91 | </div> |
92 | 92 | <?php |
93 | - if ( isset( $args['view_more'] ) && false !== $args['view_more'] ) { |
|
94 | - ?> |
|
93 | + if ( isset( $args['view_more'] ) && false !== $args['view_more'] ) { |
|
94 | + ?> |
|
95 | 95 | <div class="col-md-12"> |
96 | 96 | <a class="<?php echo esc_html( $link_class ); ?>" href="<?php echo esc_url( get_post_type_archive_link( $args['post_type'] ) ); ?>"><?php echo esc_html_e( 'Show More', 'lsx-health-plan' ); ?></a> |
97 | 97 | </div> |
98 | 98 | <?php |
99 | - } |
|
100 | - ?> |
|
99 | + } |
|
100 | + ?> |
|
101 | 101 | </div> |
102 | 102 | <?php |
103 | 103 | $shortcode_args = null; |
@@ -23,26 +23,26 @@ discard block |
||
23 | 23 | ); |
24 | 24 | |
25 | 25 | // If we are calling the exercises with the parent workout. |
26 | -if ( false !== 'parent' && 'exercise' === $args['post_type'] ) { |
|
27 | - $items = \lsx_health_plan\functions\get_exercises_by_workout( $args['parent'] ); |
|
28 | - if ( ! empty( $items ) ) { |
|
26 | +if (false !== 'parent' && 'exercise' === $args['post_type']) { |
|
27 | + $items = \lsx_health_plan\functions\get_exercises_by_workout($args['parent']); |
|
28 | + if ( ! empty($items)) { |
|
29 | 29 | $args['include'] = $items; |
30 | 30 | } |
31 | 31 | } |
32 | 32 | |
33 | -if ( isset( $args['include'] ) && ( '' !== $args['include'] ) ) { |
|
34 | - if ( is_array( $args['include'] ) ) { |
|
33 | +if (isset($args['include']) && ('' !== $args['include'])) { |
|
34 | + if (is_array($args['include'])) { |
|
35 | 35 | $include = $args['include']; |
36 | 36 | } else { |
37 | - $include = explode( ',', $args['include'] ); |
|
37 | + $include = explode(',', $args['include']); |
|
38 | 38 | } |
39 | 39 | $include_filter = $include; |
40 | 40 | $query_array['post__in'] = $include_filter; |
41 | 41 | $query_array['orderby'] = 'post__in'; |
42 | 42 | } |
43 | 43 | |
44 | -if ( isset( $taxonomy ) && ( '' !== $taxonomy ) && isset( $term ) && ( '' !== $term ) ) { |
|
45 | - $taxonomy_filter = array( |
|
44 | +if (isset($taxonomy) && ('' !== $taxonomy) && isset($term) && ('' !== $term)) { |
|
45 | + $taxonomy_filter = array( |
|
46 | 46 | array( |
47 | 47 | 'taxonomy' => $taxonomy, |
48 | 48 | 'field' => 'slug', |
@@ -52,16 +52,16 @@ discard block |
||
52 | 52 | $query_array['tax_query'] = $taxonomy_filter; |
53 | 53 | } |
54 | 54 | |
55 | -$exercises = new WP_Query( $query_array ); |
|
55 | +$exercises = new WP_Query($query_array); |
|
56 | 56 | ?> |
57 | 57 | |
58 | -<div id="lsx-exercises-shortcode" class="daily-plan-block layout-<?php echo esc_html( $args['layout'] ); ?> columns-<?php echo esc_html( $args['columns'] ); ?> shortcode-type-<?php echo esc_html( $args['post_type'] ); ?>"> |
|
58 | +<div id="lsx-exercises-shortcode" class="daily-plan-block layout-<?php echo esc_html($args['layout']); ?> columns-<?php echo esc_html($args['columns']); ?> shortcode-type-<?php echo esc_html($args['post_type']); ?>"> |
|
59 | 59 | <div class="lsx-exercises-shortcode" > |
60 | 60 | <?php |
61 | - if ( $exercises->have_posts() ) { |
|
62 | - while ( $exercises->have_posts() ) { |
|
61 | + if ($exercises->have_posts()) { |
|
62 | + while ($exercises->have_posts()) { |
|
63 | 63 | $exercises->the_post(); |
64 | - switch ( $args['post_type'] ) { |
|
64 | + switch ($args['post_type']) { |
|
65 | 65 | case 'workout': |
66 | 66 | include LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-sets.php'; |
67 | 67 | break; |
@@ -90,10 +90,10 @@ discard block |
||
90 | 90 | ?> |
91 | 91 | </div> |
92 | 92 | <?php |
93 | - if ( isset( $args['view_more'] ) && false !== $args['view_more'] ) { |
|
93 | + if (isset($args['view_more']) && false !== $args['view_more']) { |
|
94 | 94 | ?> |
95 | 95 | <div class="col-md-12"> |
96 | - <a class="<?php echo esc_html( $link_class ); ?>" href="<?php echo esc_url( get_post_type_archive_link( $args['post_type'] ) ); ?>"><?php echo esc_html_e( 'Show More', 'lsx-health-plan' ); ?></a> |
|
96 | + <a class="<?php echo esc_html($link_class); ?>" href="<?php echo esc_url(get_post_type_archive_link($args['post_type'])); ?>"><?php echo esc_html_e('Show More', 'lsx-health-plan'); ?></a> |
|
97 | 97 | </div> |
98 | 98 | <?php |
99 | 99 | } |
@@ -20,63 +20,63 @@ discard block |
||
20 | 20 | <?php } ?> |
21 | 21 | <tbody> |
22 | 22 | <?php |
23 | - if ( 1 >= (int) $serves ) { |
|
24 | - $serves = '1'; |
|
25 | - $serves_label = __( 'Person', 'lsx-health-plan' ); |
|
26 | - } else { |
|
27 | - $serves_label = __( 'People', 'lsx-health-plan' ); |
|
28 | - } |
|
29 | - ?> |
|
23 | + if ( 1 >= (int) $serves ) { |
|
24 | + $serves = '1'; |
|
25 | + $serves_label = __( 'Person', 'lsx-health-plan' ); |
|
26 | + } else { |
|
27 | + $serves_label = __( 'People', 'lsx-health-plan' ); |
|
28 | + } |
|
29 | + ?> |
|
30 | 30 | <tr class="serves"> |
31 | 31 | <td><?php esc_html_e( 'Serves:', 'lsx-health-plan' ); ?> </td> |
32 | 32 | <td> |
33 | 33 | <?php |
34 | - echo wp_kses_post( $serves ) . ' ' . esc_html( $serves_label ); |
|
35 | - ?> |
|
34 | + echo wp_kses_post( $serves ) . ' ' . esc_html( $serves_label ); |
|
35 | + ?> |
|
36 | 36 | </td> |
37 | 37 | </tr> |
38 | 38 | <?php |
39 | - if ( ! empty( $prep_time ) ) { |
|
40 | - ?> |
|
39 | + if ( ! empty( $prep_time ) ) { |
|
40 | + ?> |
|
41 | 41 | <tr class="prep-time"> |
42 | 42 | <td><?php esc_html_e( 'Prep time: ', 'lsx-health-plan' ); ?> </td> |
43 | 43 | <td> |
44 | 44 | <?php |
45 | - echo wp_kses_post( $prep_time ); |
|
46 | - ?> |
|
45 | + echo wp_kses_post( $prep_time ); |
|
46 | + ?> |
|
47 | 47 | </td> |
48 | 48 | </tr> |
49 | 49 | <?php |
50 | - } |
|
51 | - ?> |
|
50 | + } |
|
51 | + ?> |
|
52 | 52 | <?php |
53 | - if ( ! empty( $cooking_time ) ) { |
|
54 | - ?> |
|
53 | + if ( ! empty( $cooking_time ) ) { |
|
54 | + ?> |
|
55 | 55 | <tr class="cooking-time"> |
56 | 56 | <td><?php esc_html_e( 'Cooking time: ', 'lsx-health-plan' ); ?> </td> |
57 | 57 | <td> |
58 | 58 | <?php |
59 | - echo wp_kses_post( $cooking_time ); |
|
60 | - ?> |
|
59 | + echo wp_kses_post( $cooking_time ); |
|
60 | + ?> |
|
61 | 61 | </td> |
62 | 62 | </tr> |
63 | 63 | <?php |
64 | - } |
|
65 | - ?> |
|
64 | + } |
|
65 | + ?> |
|
66 | 66 | <?php |
67 | - if ( ! empty( $portion ) ) { |
|
68 | - ?> |
|
67 | + if ( ! empty( $portion ) ) { |
|
68 | + ?> |
|
69 | 69 | <tr class="portion-size"> |
70 | 70 | <td><?php esc_html_e( 'Portion size: ', 'lsx-health-plan' ); ?> </td> |
71 | 71 | <td> |
72 | 72 | <?php |
73 | - echo wp_kses_post( $portion ); |
|
74 | - ?> |
|
73 | + echo wp_kses_post( $portion ); |
|
74 | + ?> |
|
75 | 75 | </td> |
76 | 76 | </tr> |
77 | 77 | <?php |
78 | - } |
|
79 | - ?> |
|
78 | + } |
|
79 | + ?> |
|
80 | 80 | </tbody> |
81 | 81 | </table> |
82 | 82 | <?php } ?> |
@@ -89,75 +89,75 @@ discard block |
||
89 | 89 | </thead> |
90 | 90 | <tbody> |
91 | 91 | <?php |
92 | - if ( ! empty( $energy ) ) { |
|
93 | - ?> |
|
92 | + if ( ! empty( $energy ) ) { |
|
93 | + ?> |
|
94 | 94 | <tr class="energy"> |
95 | 95 | <td><?php esc_html_e( 'Energy: ', 'lsx-health-plan' ); ?> </td> |
96 | 96 | <td> |
97 | 97 | <?php |
98 | - echo wp_kses_post( $energy ); |
|
99 | - ?> |
|
98 | + echo wp_kses_post( $energy ); |
|
99 | + ?> |
|
100 | 100 | </td> |
101 | 101 | </tr> |
102 | 102 | <?php |
103 | - } |
|
104 | - ?> |
|
103 | + } |
|
104 | + ?> |
|
105 | 105 | <?php |
106 | - if ( ! empty( $protein ) ) { |
|
107 | - ?> |
|
106 | + if ( ! empty( $protein ) ) { |
|
107 | + ?> |
|
108 | 108 | <tr class="protein"> |
109 | 109 | <td><?php esc_html_e( 'Protein: ', 'lsx-health-plan' ); ?> </td> |
110 | 110 | <td> |
111 | 111 | <?php |
112 | - echo wp_kses_post( $protein ); |
|
113 | - ?> |
|
112 | + echo wp_kses_post( $protein ); |
|
113 | + ?> |
|
114 | 114 | </td> |
115 | 115 | </tr> |
116 | 116 | <?php |
117 | - } |
|
118 | - ?> |
|
117 | + } |
|
118 | + ?> |
|
119 | 119 | <?php |
120 | - if ( ! empty( $carbohydrates ) ) { |
|
121 | - ?> |
|
120 | + if ( ! empty( $carbohydrates ) ) { |
|
121 | + ?> |
|
122 | 122 | <tr class="carbohydrates"> |
123 | 123 | <td><?php esc_html_e( 'Carbohydrates: ', 'lsx-health-plan' ); ?> </td> |
124 | 124 | <td> |
125 | 125 | <?php |
126 | - echo wp_kses_post( $carbohydrates ); |
|
127 | - ?> |
|
126 | + echo wp_kses_post( $carbohydrates ); |
|
127 | + ?> |
|
128 | 128 | </td> |
129 | 129 | </tr> |
130 | 130 | <?php |
131 | - } |
|
132 | - ?> |
|
131 | + } |
|
132 | + ?> |
|
133 | 133 | <?php |
134 | - if ( ! empty( $fibre ) ) { |
|
135 | - ?> |
|
134 | + if ( ! empty( $fibre ) ) { |
|
135 | + ?> |
|
136 | 136 | <tr class="fibre"> |
137 | 137 | <td><?php esc_html_e( 'Fibre: ', 'lsx-health-plan' ); ?> </td> |
138 | 138 | <td> |
139 | 139 | <?php |
140 | - echo wp_kses_post( $fibre ); |
|
141 | - ?> |
|
140 | + echo wp_kses_post( $fibre ); |
|
141 | + ?> |
|
142 | 142 | </td> |
143 | 143 | </tr> |
144 | 144 | <?php |
145 | - } |
|
146 | - ?> |
|
145 | + } |
|
146 | + ?> |
|
147 | 147 | <?php |
148 | - if ( ! empty( $fat ) ) { |
|
149 | - ?> |
|
148 | + if ( ! empty( $fat ) ) { |
|
149 | + ?> |
|
150 | 150 | <tr class="fat"> |
151 | 151 | <td><?php esc_html_e( 'Fat: ', 'lsx-health-plan' ); ?> </td> |
152 | 152 | <td> |
153 | 153 | <?php |
154 | - echo wp_kses_post( $fat ); |
|
155 | - ?> |
|
154 | + echo wp_kses_post( $fat ); |
|
155 | + ?> |
|
156 | 156 | </td> |
157 | 157 | </tr> |
158 | 158 | <?php |
159 | - } |
|
160 | - ?> |
|
159 | + } |
|
160 | + ?> |
|
161 | 161 | </tbody> |
162 | 162 | </table> |
163 | 163 | <?php } ?> |
@@ -1,17 +1,17 @@ discard block |
||
1 | 1 | <?php |
2 | -$prep_time = get_post_meta( get_the_ID(), 'recipe_prep_time', true ); |
|
3 | -$cooking_time = get_post_meta( get_the_ID(), 'recipe_cooking_time', true ); |
|
4 | -$serves = get_post_meta( get_the_ID(), 'recipe_serves', true ); |
|
5 | -$portion = get_post_meta( get_the_ID(), 'recipe_portion', true ); |
|
6 | -$energy = get_post_meta( get_the_ID(), 'recipe_energy', true ); |
|
7 | -$protein = get_post_meta( get_the_ID(), 'recipe_protein', true ); |
|
8 | -$carbohydrates = get_post_meta( get_the_ID(), 'recipe_carbohydrates', true ); |
|
9 | -$fibre = get_post_meta( get_the_ID(), 'recipe_fibre', true ); |
|
10 | -$fat = get_post_meta( get_the_ID(), 'recipe_fat', true ); |
|
2 | +$prep_time = get_post_meta(get_the_ID(), 'recipe_prep_time', true); |
|
3 | +$cooking_time = get_post_meta(get_the_ID(), 'recipe_cooking_time', true); |
|
4 | +$serves = get_post_meta(get_the_ID(), 'recipe_serves', true); |
|
5 | +$portion = get_post_meta(get_the_ID(), 'recipe_portion', true); |
|
6 | +$energy = get_post_meta(get_the_ID(), 'recipe_energy', true); |
|
7 | +$protein = get_post_meta(get_the_ID(), 'recipe_protein', true); |
|
8 | +$carbohydrates = get_post_meta(get_the_ID(), 'recipe_carbohydrates', true); |
|
9 | +$fibre = get_post_meta(get_the_ID(), 'recipe_fibre', true); |
|
10 | +$fat = get_post_meta(get_the_ID(), 'recipe_fat', true); |
|
11 | 11 | ?> |
12 | -<?php if ( ( ! empty( $prep_time ) ) || ( ! empty( $cooking_time ) ) || ( ! empty( $serves ) ) || ( ! empty( $portion ) ) ) { ?> |
|
12 | +<?php if (( ! empty($prep_time)) || ( ! empty($cooking_time)) || ( ! empty($serves)) || ( ! empty($portion))) { ?> |
|
13 | 13 | <table class="recipe-table cooking-info-table"> |
14 | - <?php if ( is_single() && is_singular( 'recipe' ) ) { ?> |
|
14 | + <?php if (is_single() && is_singular('recipe')) { ?> |
|
15 | 15 | <thead> |
16 | 16 | <tr> |
17 | 17 | <th>Cooking Info</th> |
@@ -20,29 +20,29 @@ discard block |
||
20 | 20 | <?php } ?> |
21 | 21 | <tbody> |
22 | 22 | <?php |
23 | - if ( 1 >= (int) $serves ) { |
|
23 | + if (1 >= (int) $serves) { |
|
24 | 24 | $serves = '1'; |
25 | - $serves_label = __( 'Person', 'lsx-health-plan' ); |
|
25 | + $serves_label = __('Person', 'lsx-health-plan'); |
|
26 | 26 | } else { |
27 | - $serves_label = __( 'People', 'lsx-health-plan' ); |
|
27 | + $serves_label = __('People', 'lsx-health-plan'); |
|
28 | 28 | } |
29 | 29 | ?> |
30 | 30 | <tr class="serves"> |
31 | - <td><?php esc_html_e( 'Serves:', 'lsx-health-plan' ); ?> </td> |
|
31 | + <td><?php esc_html_e('Serves:', 'lsx-health-plan'); ?> </td> |
|
32 | 32 | <td> |
33 | 33 | <?php |
34 | - echo wp_kses_post( $serves ) . ' ' . esc_html( $serves_label ); |
|
34 | + echo wp_kses_post($serves) . ' ' . esc_html($serves_label); |
|
35 | 35 | ?> |
36 | 36 | </td> |
37 | 37 | </tr> |
38 | 38 | <?php |
39 | - if ( ! empty( $prep_time ) ) { |
|
39 | + if ( ! empty($prep_time)) { |
|
40 | 40 | ?> |
41 | 41 | <tr class="prep-time"> |
42 | - <td><?php esc_html_e( 'Prep time: ', 'lsx-health-plan' ); ?> </td> |
|
42 | + <td><?php esc_html_e('Prep time: ', 'lsx-health-plan'); ?> </td> |
|
43 | 43 | <td> |
44 | 44 | <?php |
45 | - echo wp_kses_post( $prep_time ); |
|
45 | + echo wp_kses_post($prep_time); |
|
46 | 46 | ?> |
47 | 47 | </td> |
48 | 48 | </tr> |
@@ -50,13 +50,13 @@ discard block |
||
50 | 50 | } |
51 | 51 | ?> |
52 | 52 | <?php |
53 | - if ( ! empty( $cooking_time ) ) { |
|
53 | + if ( ! empty($cooking_time)) { |
|
54 | 54 | ?> |
55 | 55 | <tr class="cooking-time"> |
56 | - <td><?php esc_html_e( 'Cooking time: ', 'lsx-health-plan' ); ?> </td> |
|
56 | + <td><?php esc_html_e('Cooking time: ', 'lsx-health-plan'); ?> </td> |
|
57 | 57 | <td> |
58 | 58 | <?php |
59 | - echo wp_kses_post( $cooking_time ); |
|
59 | + echo wp_kses_post($cooking_time); |
|
60 | 60 | ?> |
61 | 61 | </td> |
62 | 62 | </tr> |
@@ -64,13 +64,13 @@ discard block |
||
64 | 64 | } |
65 | 65 | ?> |
66 | 66 | <?php |
67 | - if ( ! empty( $portion ) ) { |
|
67 | + if ( ! empty($portion)) { |
|
68 | 68 | ?> |
69 | 69 | <tr class="portion-size"> |
70 | - <td><?php esc_html_e( 'Portion size: ', 'lsx-health-plan' ); ?> </td> |
|
70 | + <td><?php esc_html_e('Portion size: ', 'lsx-health-plan'); ?> </td> |
|
71 | 71 | <td> |
72 | 72 | <?php |
73 | - echo wp_kses_post( $portion ); |
|
73 | + echo wp_kses_post($portion); |
|
74 | 74 | ?> |
75 | 75 | </td> |
76 | 76 | </tr> |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | </tbody> |
81 | 81 | </table> |
82 | 82 | <?php } ?> |
83 | -<?php if ( is_single() && is_singular( 'recipe' ) && ( ( ! empty( $energy ) ) || ( ! empty( $protein ) ) || ( ! empty( $carbohydrates ) ) || ( ! empty( $fibre ) ) || ( ! empty( $fat ) ) ) ) { ?> |
|
83 | +<?php if (is_single() && is_singular('recipe') && (( ! empty($energy)) || ( ! empty($protein)) || ( ! empty($carbohydrates)) || ( ! empty($fibre)) || ( ! empty($fat)))) { ?> |
|
84 | 84 | <table class="recipe-table nutritional-info-table"> |
85 | 85 | <thead> |
86 | 86 | <tr> |
@@ -89,13 +89,13 @@ discard block |
||
89 | 89 | </thead> |
90 | 90 | <tbody> |
91 | 91 | <?php |
92 | - if ( ! empty( $energy ) ) { |
|
92 | + if ( ! empty($energy)) { |
|
93 | 93 | ?> |
94 | 94 | <tr class="energy"> |
95 | - <td><?php esc_html_e( 'Energy: ', 'lsx-health-plan' ); ?> </td> |
|
95 | + <td><?php esc_html_e('Energy: ', 'lsx-health-plan'); ?> </td> |
|
96 | 96 | <td> |
97 | 97 | <?php |
98 | - echo wp_kses_post( $energy ); |
|
98 | + echo wp_kses_post($energy); |
|
99 | 99 | ?> |
100 | 100 | </td> |
101 | 101 | </tr> |
@@ -103,13 +103,13 @@ discard block |
||
103 | 103 | } |
104 | 104 | ?> |
105 | 105 | <?php |
106 | - if ( ! empty( $protein ) ) { |
|
106 | + if ( ! empty($protein)) { |
|
107 | 107 | ?> |
108 | 108 | <tr class="protein"> |
109 | - <td><?php esc_html_e( 'Protein: ', 'lsx-health-plan' ); ?> </td> |
|
109 | + <td><?php esc_html_e('Protein: ', 'lsx-health-plan'); ?> </td> |
|
110 | 110 | <td> |
111 | 111 | <?php |
112 | - echo wp_kses_post( $protein ); |
|
112 | + echo wp_kses_post($protein); |
|
113 | 113 | ?> |
114 | 114 | </td> |
115 | 115 | </tr> |
@@ -117,13 +117,13 @@ discard block |
||
117 | 117 | } |
118 | 118 | ?> |
119 | 119 | <?php |
120 | - if ( ! empty( $carbohydrates ) ) { |
|
120 | + if ( ! empty($carbohydrates)) { |
|
121 | 121 | ?> |
122 | 122 | <tr class="carbohydrates"> |
123 | - <td><?php esc_html_e( 'Carbohydrates: ', 'lsx-health-plan' ); ?> </td> |
|
123 | + <td><?php esc_html_e('Carbohydrates: ', 'lsx-health-plan'); ?> </td> |
|
124 | 124 | <td> |
125 | 125 | <?php |
126 | - echo wp_kses_post( $carbohydrates ); |
|
126 | + echo wp_kses_post($carbohydrates); |
|
127 | 127 | ?> |
128 | 128 | </td> |
129 | 129 | </tr> |
@@ -131,13 +131,13 @@ discard block |
||
131 | 131 | } |
132 | 132 | ?> |
133 | 133 | <?php |
134 | - if ( ! empty( $fibre ) ) { |
|
134 | + if ( ! empty($fibre)) { |
|
135 | 135 | ?> |
136 | 136 | <tr class="fibre"> |
137 | - <td><?php esc_html_e( 'Fibre: ', 'lsx-health-plan' ); ?> </td> |
|
137 | + <td><?php esc_html_e('Fibre: ', 'lsx-health-plan'); ?> </td> |
|
138 | 138 | <td> |
139 | 139 | <?php |
140 | - echo wp_kses_post( $fibre ); |
|
140 | + echo wp_kses_post($fibre); |
|
141 | 141 | ?> |
142 | 142 | </td> |
143 | 143 | </tr> |
@@ -145,13 +145,13 @@ discard block |
||
145 | 145 | } |
146 | 146 | ?> |
147 | 147 | <?php |
148 | - if ( ! empty( $fat ) ) { |
|
148 | + if ( ! empty($fat)) { |
|
149 | 149 | ?> |
150 | 150 | <tr class="fat"> |
151 | - <td><?php esc_html_e( 'Fat: ', 'lsx-health-plan' ); ?> </td> |
|
151 | + <td><?php esc_html_e('Fat: ', 'lsx-health-plan'); ?> </td> |
|
152 | 152 | <td> |
153 | 153 | <?php |
154 | - echo wp_kses_post( $fat ); |
|
154 | + echo wp_kses_post($fat); |
|
155 | 155 | ?> |
156 | 156 | </td> |
157 | 157 | </tr> |
@@ -26,13 +26,13 @@ discard block |
||
26 | 26 | <div class="entry-content"> |
27 | 27 | <div class="single-plan-inner meal-content"> |
28 | 28 | <?php |
29 | - if ( is_singular( 'meal' ) ) { ?> |
|
29 | + if ( is_singular( 'meal' ) ) { ?> |
|
30 | 30 | <div class="single-plan-section-title meal-plan title-lined"> |
31 | 31 | <?php lsx_get_svg_icon( 'meal.svg' ); ?> |
32 | 32 | <h2><?php the_title(); ?></h2> |
33 | 33 | <?php if ( class_exists( 'LSX_Sharing' ) ) { |
34 | - lsx_content_sharing(); |
|
35 | - } ?> |
|
34 | + lsx_content_sharing(); |
|
35 | + } ?> |
|
36 | 36 | </div> |
37 | 37 | <?php } else { ?> |
38 | 38 | <div class="single-plan-section-title meal-plan title-lined"> |
@@ -55,18 +55,18 @@ discard block |
||
55 | 55 | <?php } ?> |
56 | 56 | |
57 | 57 | <?php |
58 | - // Shoping list |
|
59 | - $shopping_list = get_post_meta( get_the_ID(), 'meal_shopping_list', true ); |
|
60 | - if ( ! empty( $shopping_list ) ) { |
|
61 | - ?> |
|
58 | + // Shoping list |
|
59 | + $shopping_list = get_post_meta( get_the_ID(), 'meal_shopping_list', true ); |
|
60 | + if ( ! empty( $shopping_list ) ) { |
|
61 | + ?> |
|
62 | 62 | <a class="btn border-btn btn-shopping" href="<?php echo esc_url( get_page_link( $shopping_list ) ); ?>" target="_blank"><?php esc_html_e( 'Download Shopping List', 'lsx-health-plan' ); ?><i class="fa fa-download" aria-hidden="true"></i></a> |
63 | 63 | <?php |
64 | - } |
|
64 | + } |
|
65 | 65 | |
66 | - ?> |
|
66 | + ?> |
|
67 | 67 | </div> |
68 | 68 | |
69 | 69 | <?php |
70 | 70 | if ( ! empty( $connected_articles ) ) { |
71 | - lsx_hp_single_related( $connected_articles, __( 'Related articles', 'lsx-health-plan' ) ); |
|
71 | + lsx_hp_single_related( $connected_articles, __( 'Related articles', 'lsx-health-plan' ) ); |
|
72 | 72 | } |
@@ -7,11 +7,11 @@ discard block |
||
7 | 7 | |
8 | 8 | // Getting translated endpoint. |
9 | 9 | |
10 | -$archive_meals = \lsx_health_plan\functions\get_option( 'endpoint_meal_archive', 'meals' ); |
|
11 | -$meal = \lsx_health_plan\functions\get_option( 'endpoint_meal', 'meal' ); |
|
10 | +$archive_meals = \lsx_health_plan\functions\get_option('endpoint_meal_archive', 'meals'); |
|
11 | +$meal = \lsx_health_plan\functions\get_option('endpoint_meal', 'meal'); |
|
12 | 12 | |
13 | -$connected_members = get_post_meta( get_the_ID(), ( $meal . '_connected_team_member' ), true ); |
|
14 | -$connected_articles = get_post_meta( get_the_ID(), ( $meal . '_connected_articles' ), true ); |
|
13 | +$connected_members = get_post_meta(get_the_ID(), ($meal . '_connected_team_member'), true); |
|
14 | +$connected_articles = get_post_meta(get_the_ID(), ($meal . '_connected_articles'), true); |
|
15 | 15 | |
16 | 16 | ?> |
17 | 17 | |
@@ -26,18 +26,18 @@ discard block |
||
26 | 26 | <div class="entry-content"> |
27 | 27 | <div class="single-plan-inner meal-content"> |
28 | 28 | <?php |
29 | - if ( is_singular( 'meal' ) ) { ?> |
|
29 | + if (is_singular('meal')) { ?> |
|
30 | 30 | <div class="single-plan-section-title meal-plan title-lined"> |
31 | - <?php lsx_get_svg_icon( 'meal.svg' ); ?> |
|
31 | + <?php lsx_get_svg_icon('meal.svg'); ?> |
|
32 | 32 | <h2><?php the_title(); ?></h2> |
33 | - <?php if ( class_exists( 'LSX_Sharing' ) ) { |
|
33 | + <?php if (class_exists('LSX_Sharing')) { |
|
34 | 34 | lsx_content_sharing(); |
35 | 35 | } ?> |
36 | 36 | </div> |
37 | 37 | <?php } else { ?> |
38 | 38 | <div class="single-plan-section-title meal-plan title-lined"> |
39 | - <?php lsx_get_svg_icon( 'meal.svg' ); ?> |
|
40 | - <h2><?php esc_html_e( 'My Meal Plan', 'lsx-health-plan' ); ?> <?php the_title(); ?></h2> |
|
39 | + <?php lsx_get_svg_icon('meal.svg'); ?> |
|
40 | + <h2><?php esc_html_e('My Meal Plan', 'lsx-health-plan'); ?> <?php the_title(); ?></h2> |
|
41 | 41 | </div> |
42 | 42 | <?php } ?> |
43 | 43 | |
@@ -50,16 +50,16 @@ discard block |
||
50 | 50 | </article><!-- #post-## --> |
51 | 51 | |
52 | 52 | <div class="back-plan-btn"> |
53 | - <?php if ( is_single() && is_singular( 'meal' ) ) { ?> |
|
54 | - <a class="btn border-btn" href="/<?php echo $archive_meals; ?>"><?php esc_html_e( 'Back to meals', 'lsx-health-plan' ); ?></a> |
|
53 | + <?php if (is_single() && is_singular('meal')) { ?> |
|
54 | + <a class="btn border-btn" href="/<?php echo $archive_meals; ?>"><?php esc_html_e('Back to meals', 'lsx-health-plan'); ?></a> |
|
55 | 55 | <?php } ?> |
56 | 56 | |
57 | 57 | <?php |
58 | 58 | // Shoping list |
59 | - $shopping_list = get_post_meta( get_the_ID(), 'meal_shopping_list', true ); |
|
60 | - if ( ! empty( $shopping_list ) ) { |
|
59 | + $shopping_list = get_post_meta(get_the_ID(), 'meal_shopping_list', true); |
|
60 | + if ( ! empty($shopping_list)) { |
|
61 | 61 | ?> |
62 | - <a class="btn border-btn btn-shopping" href="<?php echo esc_url( get_page_link( $shopping_list ) ); ?>" target="_blank"><?php esc_html_e( 'Download Shopping List', 'lsx-health-plan' ); ?><i class="fa fa-download" aria-hidden="true"></i></a> |
|
62 | + <a class="btn border-btn btn-shopping" href="<?php echo esc_url(get_page_link($shopping_list)); ?>" target="_blank"><?php esc_html_e('Download Shopping List', 'lsx-health-plan'); ?><i class="fa fa-download" aria-hidden="true"></i></a> |
|
63 | 63 | <?php |
64 | 64 | } |
65 | 65 | |
@@ -67,6 +67,6 @@ discard block |
||
67 | 67 | </div> |
68 | 68 | |
69 | 69 | <?php |
70 | -if ( ! empty( $connected_articles ) ) { |
|
71 | - lsx_hp_single_related( $connected_articles, __( 'Related articles', 'lsx-health-plan' ) ); |
|
70 | +if ( ! empty($connected_articles)) { |
|
71 | + lsx_hp_single_related($connected_articles, __('Related articles', 'lsx-health-plan')); |
|
72 | 72 | } |
@@ -11,8 +11,8 @@ discard block |
||
11 | 11 | |
12 | 12 | <?php |
13 | 13 | $args = array( |
14 | - 'post_parent' => get_the_ID(), |
|
15 | - 'post_type' => 'plan', |
|
14 | + 'post_parent' => get_the_ID(), |
|
15 | + 'post_type' => 'plan', |
|
16 | 16 | ); |
17 | 17 | |
18 | 18 | $plan_id = get_the_ID(); |
@@ -28,18 +28,18 @@ discard block |
||
28 | 28 | $small_description = get_post_meta( get_the_ID(), ( $plan . '_short_description' ), true ); |
29 | 29 | |
30 | 30 | if ( ! empty( $has_sections ) && empty( $is_section ) ) { |
31 | - $plan_type_class = 'parent-plan'; |
|
31 | + $plan_type_class = 'parent-plan'; |
|
32 | 32 | } |
33 | 33 | if ( ! empty( $has_sections ) && ! empty( $is_section ) ) { |
34 | - $plan_type_class = 'child-plan'; |
|
34 | + $plan_type_class = 'child-plan'; |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | // Get the plan restrictions. |
38 | 38 | if ( function_exists( 'wc_memberships_is_post_content_restricted' ) && wc_memberships_is_post_content_restricted( get_the_ID() ) ) { |
39 | - $restricted = ! current_user_can( 'wc_memberships_view_restricted_post_content', get_the_ID() ); |
|
39 | + $restricted = ! current_user_can( 'wc_memberships_view_restricted_post_content', get_the_ID() ); |
|
40 | 40 | } |
41 | 41 | if ( false === $restricted ) { |
42 | - $round_progress = round( \lsx_health_plan\functions\get_progress( get_the_ID() ), 0 ); |
|
42 | + $round_progress = round( \lsx_health_plan\functions\get_progress( get_the_ID() ), 0 ); |
|
43 | 43 | } |
44 | 44 | ?> |
45 | 45 | |
@@ -59,9 +59,9 @@ discard block |
||
59 | 59 | <?php } ?> |
60 | 60 | |
61 | 61 | <?php |
62 | - if ( ! empty( $has_sections ) ) { |
|
63 | - if ( false === $is_section ) { |
|
64 | - ?> |
|
62 | + if ( ! empty( $has_sections ) ) { |
|
63 | + if ( false === $is_section ) { |
|
64 | + ?> |
|
65 | 65 | <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> |
66 | 66 | <div class="entry-content"> |
67 | 67 | <div class="single-plan-inner main-plan-content"> |
@@ -69,47 +69,47 @@ discard block |
||
69 | 69 | <?php lsx_get_svg_icon( 'my-plan.svg' ); ?> |
70 | 70 | <h2><?php echo esc_html_e( 'Your Plan', 'lsx-health-plan' ); ?></h2> |
71 | 71 | <?php if ( class_exists( 'LSX_Sharing' ) ) { |
72 | - lsx_content_sharing(); |
|
73 | - } ?> |
|
72 | + lsx_content_sharing(); |
|
73 | + } ?> |
|
74 | 74 | </div> |
75 | 75 | <div class="plan"> |
76 | 76 | <div class="set-box set content-box entry-content"> |
77 | 77 | <div class="plan-top-content"> |
78 | 78 | <?php |
79 | - if ( $connected_members ) { |
|
80 | - echo wp_kses_post( lsx_hp_member_connected( $connected_members, $plan ) ); |
|
81 | - } |
|
82 | - if ( false === $restricted ) { |
|
83 | - echo wp_kses_post( '<span class="progress"><progress class="bar" value="' . $round_progress . '" max="100"> ' . $round_progress . '% </progress><span>' . $round_progress . '%</span></span>' ); |
|
84 | - } |
|
85 | - if ( $small_description ) { |
|
86 | - ?> |
|
79 | + if ( $connected_members ) { |
|
80 | + echo wp_kses_post( lsx_hp_member_connected( $connected_members, $plan ) ); |
|
81 | + } |
|
82 | + if ( false === $restricted ) { |
|
83 | + echo wp_kses_post( '<span class="progress"><progress class="bar" value="' . $round_progress . '" max="100"> ' . $round_progress . '% </progress><span>' . $round_progress . '%</span></span>' ); |
|
84 | + } |
|
85 | + if ( $small_description ) { |
|
86 | + ?> |
|
87 | 87 | <div class="the-content"> |
88 | 88 | <span><?php echo esc_html( $small_description ); ?></span> |
89 | 89 | </div> |
90 | 90 | <?php |
91 | 91 | |
92 | - } |
|
93 | - ?> |
|
92 | + } |
|
93 | + ?> |
|
94 | 94 | </div> |
95 | 95 | <?php |
96 | - if ( lsx_health_plan_has_tips() ) { |
|
97 | - echo wp_kses_post( do_shortcode( '[lsx_health_plan_featured_tips_block]' ) ); |
|
98 | - } ?> |
|
96 | + if ( lsx_health_plan_has_tips() ) { |
|
97 | + echo wp_kses_post( do_shortcode( '[lsx_health_plan_featured_tips_block]' ) ); |
|
98 | + } ?> |
|
99 | 99 | </div> |
100 | 100 | <div class="the-plan-content"> |
101 | 101 | <?php |
102 | - echo do_shortcode( '[lsx_health_plan_day_plan_block week_view="true" show_downloads="true" plan="' . get_the_ID() . '"]' ); |
|
102 | + echo do_shortcode( '[lsx_health_plan_day_plan_block week_view="true" show_downloads="true" plan="' . get_the_ID() . '"]' ); |
|
103 | 103 | |
104 | - ?> |
|
104 | + ?> |
|
105 | 105 | <div class="row status-plan-buttons main-plan-btn"> |
106 | 106 | <?php |
107 | - if ( function_exists( 'wc_get_page_id' ) ) { |
|
108 | - ?> |
|
107 | + if ( function_exists( 'wc_get_page_id' ) ) { |
|
108 | + ?> |
|
109 | 109 | <a class="btn border-btn" href="<?php echo wp_kses_post( get_permalink( wc_get_page_id( 'myaccount' ) ) ); ?>"><?php esc_html_e( 'My Plans', 'lsx-health-plan' ); ?></a> |
110 | 110 | <?php |
111 | - } |
|
112 | - ?> |
|
111 | + } |
|
112 | + ?> |
|
113 | 113 | </div> |
114 | 114 | </div> |
115 | 115 | </div> |
@@ -118,32 +118,32 @@ discard block |
||
118 | 118 | </div><!-- .entry-content --> |
119 | 119 | </article> |
120 | 120 | <?php |
121 | - } else { |
|
122 | - lsx_health_plan_single_nav(); |
|
123 | - lsx_health_plan_single_tabs(); |
|
124 | - } |
|
125 | - } |
|
126 | - ?> |
|
121 | + } else { |
|
122 | + lsx_health_plan_single_nav(); |
|
123 | + lsx_health_plan_single_tabs(); |
|
124 | + } |
|
125 | + } |
|
126 | + ?> |
|
127 | 127 | </div> |
128 | 128 | |
129 | 129 | <?php |
130 | - // Show the buttons on the single plan tabs. |
|
131 | - if ( ! empty( $has_sections ) && false !== $is_section ) { |
|
132 | - ?> |
|
130 | + // Show the buttons on the single plan tabs. |
|
131 | + if ( ! empty( $has_sections ) && false !== $is_section ) { |
|
132 | + ?> |
|
133 | 133 | <div class="row status-plan-buttons"> |
134 | 134 | <?php lsx_health_plan_day_button(); ?> |
135 | 135 | </div> |
136 | 136 | <?php |
137 | - } |
|
138 | - ?> |
|
137 | + } |
|
138 | + ?> |
|
139 | 139 | |
140 | 140 | <?php lsx_content_bottom(); ?> |
141 | 141 | |
142 | 142 | <?php |
143 | - if ( ! empty( $connected_articles ) ) { |
|
144 | - lsx_hp_single_related( $connected_articles, __( 'Latest articles', 'lsx-health-plan' ) ); |
|
145 | - } |
|
146 | - ?> |
|
143 | + if ( ! empty( $connected_articles ) ) { |
|
144 | + lsx_hp_single_related( $connected_articles, __( 'Latest articles', 'lsx-health-plan' ) ); |
|
145 | + } |
|
146 | + ?> |
|
147 | 147 | |
148 | 148 | |
149 | 149 | </main><!-- #main --> |
@@ -16,59 +16,59 @@ discard block |
||
16 | 16 | ); |
17 | 17 | |
18 | 18 | $plan_id = get_the_ID(); |
19 | -$has_sections = \lsx_health_plan\functions\plan\has_sections( $plan_id ); |
|
19 | +$has_sections = \lsx_health_plan\functions\plan\has_sections($plan_id); |
|
20 | 20 | $restricted = false; |
21 | -$is_section = get_query_var( 'section', false ); |
|
21 | +$is_section = get_query_var('section', false); |
|
22 | 22 | |
23 | 23 | // Getting translated endpoint. |
24 | -$plan = \lsx_health_plan\functions\get_option( 'endpoint_plan', 'plan' ); |
|
24 | +$plan = \lsx_health_plan\functions\get_option('endpoint_plan', 'plan'); |
|
25 | 25 | |
26 | -$connected_members = get_post_meta( get_the_ID(), ( $plan . '_connected_team_member' ), true ); |
|
27 | -$connected_articles = get_post_meta( get_the_ID(), ( $plan . '_connected_articles' ), true ); |
|
28 | -$small_description = get_post_meta( get_the_ID(), ( $plan . '_short_description' ), true ); |
|
26 | +$connected_members = get_post_meta(get_the_ID(), ($plan . '_connected_team_member'), true); |
|
27 | +$connected_articles = get_post_meta(get_the_ID(), ($plan . '_connected_articles'), true); |
|
28 | +$small_description = get_post_meta(get_the_ID(), ($plan . '_short_description'), true); |
|
29 | 29 | |
30 | -if ( ! empty( $has_sections ) && empty( $is_section ) ) { |
|
30 | +if ( ! empty($has_sections) && empty($is_section)) { |
|
31 | 31 | $plan_type_class = 'parent-plan'; |
32 | 32 | } |
33 | -if ( ! empty( $has_sections ) && ! empty( $is_section ) ) { |
|
33 | +if ( ! empty($has_sections) && ! empty($is_section)) { |
|
34 | 34 | $plan_type_class = 'child-plan'; |
35 | 35 | } |
36 | 36 | |
37 | 37 | // Get the plan restrictions. |
38 | -if ( function_exists( 'wc_memberships_is_post_content_restricted' ) && wc_memberships_is_post_content_restricted( get_the_ID() ) ) { |
|
39 | - $restricted = ! current_user_can( 'wc_memberships_view_restricted_post_content', get_the_ID() ); |
|
38 | +if (function_exists('wc_memberships_is_post_content_restricted') && wc_memberships_is_post_content_restricted(get_the_ID())) { |
|
39 | + $restricted = ! current_user_can('wc_memberships_view_restricted_post_content', get_the_ID()); |
|
40 | 40 | } |
41 | -if ( false === $restricted ) { |
|
42 | - $round_progress = round( \lsx_health_plan\functions\get_progress( get_the_ID() ), 0 ); |
|
41 | +if (false === $restricted) { |
|
42 | + $round_progress = round(\lsx_health_plan\functions\get_progress(get_the_ID()), 0); |
|
43 | 43 | } |
44 | 44 | ?> |
45 | 45 | |
46 | -<div id="primary" class="content-area <?php echo esc_attr( lsx_main_class() ); ?>"> |
|
46 | +<div id="primary" class="content-area <?php echo esc_attr(lsx_main_class()); ?>"> |
|
47 | 47 | |
48 | 48 | <?php lsx_content_before(); ?> |
49 | 49 | |
50 | - <main id="main" class="site-main <?php echo esc_html( $plan_type_class ); ?>" role="main"> |
|
50 | + <main id="main" class="site-main <?php echo esc_html($plan_type_class); ?>" role="main"> |
|
51 | 51 | |
52 | 52 | <?php lsx_content_top(); ?> |
53 | 53 | |
54 | 54 | <div class="post-wrapper"> |
55 | - <?php if ( ! empty( $has_sections ) && empty( $is_section ) ) { ?> |
|
55 | + <?php if ( ! empty($has_sections) && empty($is_section)) { ?> |
|
56 | 56 | <div class="plan-content"> |
57 | 57 | <?php the_content(); ?> |
58 | 58 | </div> |
59 | 59 | <?php } ?> |
60 | 60 | |
61 | 61 | <?php |
62 | - if ( ! empty( $has_sections ) ) { |
|
63 | - if ( false === $is_section ) { |
|
62 | + if ( ! empty($has_sections)) { |
|
63 | + if (false === $is_section) { |
|
64 | 64 | ?> |
65 | 65 | <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> |
66 | 66 | <div class="entry-content"> |
67 | 67 | <div class="single-plan-inner main-plan-content"> |
68 | 68 | <div class="single-plan-section-title title-lined"> |
69 | - <?php lsx_get_svg_icon( 'my-plan.svg' ); ?> |
|
70 | - <h2><?php echo esc_html_e( 'Your Plan', 'lsx-health-plan' ); ?></h2> |
|
71 | - <?php if ( class_exists( 'LSX_Sharing' ) ) { |
|
69 | + <?php lsx_get_svg_icon('my-plan.svg'); ?> |
|
70 | + <h2><?php echo esc_html_e('Your Plan', 'lsx-health-plan'); ?></h2> |
|
71 | + <?php if (class_exists('LSX_Sharing')) { |
|
72 | 72 | lsx_content_sharing(); |
73 | 73 | } ?> |
74 | 74 | </div> |
@@ -76,36 +76,36 @@ discard block |
||
76 | 76 | <div class="set-box set content-box entry-content"> |
77 | 77 | <div class="plan-top-content"> |
78 | 78 | <?php |
79 | - if ( $connected_members ) { |
|
80 | - echo wp_kses_post( lsx_hp_member_connected( $connected_members, $plan ) ); |
|
79 | + if ($connected_members) { |
|
80 | + echo wp_kses_post(lsx_hp_member_connected($connected_members, $plan)); |
|
81 | 81 | } |
82 | - if ( false === $restricted ) { |
|
83 | - echo wp_kses_post( '<span class="progress"><progress class="bar" value="' . $round_progress . '" max="100"> ' . $round_progress . '% </progress><span>' . $round_progress . '%</span></span>' ); |
|
82 | + if (false === $restricted) { |
|
83 | + echo wp_kses_post('<span class="progress"><progress class="bar" value="' . $round_progress . '" max="100"> ' . $round_progress . '% </progress><span>' . $round_progress . '%</span></span>'); |
|
84 | 84 | } |
85 | - if ( $small_description ) { |
|
85 | + if ($small_description) { |
|
86 | 86 | ?> |
87 | 87 | <div class="the-content"> |
88 | - <span><?php echo esc_html( $small_description ); ?></span> |
|
88 | + <span><?php echo esc_html($small_description); ?></span> |
|
89 | 89 | </div> |
90 | 90 | <?php |
91 | 91 | } |
92 | 92 | ?> |
93 | 93 | </div> |
94 | 94 | <?php |
95 | - if ( lsx_health_plan_has_tips() ) { |
|
96 | - echo wp_kses_post( do_shortcode( '[lsx_health_plan_featured_tips_block]' ) ); |
|
95 | + if (lsx_health_plan_has_tips()) { |
|
96 | + echo wp_kses_post(do_shortcode('[lsx_health_plan_featured_tips_block]')); |
|
97 | 97 | } ?> |
98 | 98 | </div> |
99 | 99 | <div class="the-plan-content"> |
100 | 100 | <?php |
101 | - echo do_shortcode( '[lsx_health_plan_day_plan_block week_view="true" show_downloads="true" plan="' . get_the_ID() . '"]' ); |
|
101 | + echo do_shortcode('[lsx_health_plan_day_plan_block week_view="true" show_downloads="true" plan="' . get_the_ID() . '"]'); |
|
102 | 102 | |
103 | 103 | ?> |
104 | 104 | <div class="row status-plan-buttons main-plan-btn"> |
105 | 105 | <?php |
106 | - if ( function_exists( 'wc_get_page_id' ) ) { |
|
106 | + if (function_exists('wc_get_page_id')) { |
|
107 | 107 | ?> |
108 | - <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> |
|
108 | + <a class="btn border-btn" href="<?php echo wp_kses_post(get_permalink(wc_get_page_id('myaccount'))); ?>"><?php esc_html_e('My Plans', 'lsx-health-plan'); ?></a> |
|
109 | 109 | <?php |
110 | 110 | } |
111 | 111 | ?> |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | |
128 | 128 | <?php |
129 | 129 | // Show the buttons on the single plan tabs. |
130 | - if ( ! empty( $has_sections ) && false !== $is_section ) { |
|
130 | + if ( ! empty($has_sections) && false !== $is_section) { |
|
131 | 131 | ?> |
132 | 132 | <div class="row status-plan-buttons"> |
133 | 133 | <?php lsx_health_plan_day_button(); ?> |
@@ -139,8 +139,8 @@ discard block |
||
139 | 139 | <?php lsx_content_bottom(); ?> |
140 | 140 | |
141 | 141 | <?php |
142 | - if ( ! empty( $connected_articles ) ) { |
|
143 | - lsx_hp_single_related( $connected_articles, __( 'Latest articles', 'lsx-health-plan' ) ); |
|
142 | + if ( ! empty($connected_articles)) { |
|
143 | + lsx_hp_single_related($connected_articles, __('Latest articles', 'lsx-health-plan')); |
|
144 | 144 | } |
145 | 145 | ?> |
146 | 146 |
@@ -13,10 +13,10 @@ discard block |
||
13 | 13 | $column_class = '4'; |
14 | 14 | // Check for shortcode overrides. |
15 | 15 | if ( null !== $shortcode_args ) { |
16 | - if ( isset( $shortcode_args['columns'] ) ) { |
|
17 | - $column_class = $shortcode_args['columns']; |
|
18 | - $column_class = \lsx_health_plan\functions\column_class( $column_class ); |
|
19 | - } |
|
16 | + if ( isset( $shortcode_args['columns'] ) ) { |
|
17 | + $column_class = $shortcode_args['columns']; |
|
18 | + $column_class = \lsx_health_plan\functions\column_class( $column_class ); |
|
19 | + } |
|
20 | 20 | } |
21 | 21 | ?> |
22 | 22 | |
@@ -29,17 +29,17 @@ discard block |
||
29 | 29 | <div class="recipe-feature-img"> |
30 | 30 | <a href="<?php echo esc_url( get_permalink() ); ?>"> |
31 | 31 | <?php |
32 | - $featured_image = get_the_post_thumbnail(); |
|
33 | - if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
34 | - the_post_thumbnail( 'lsx-thumbnail-square', array( |
|
35 | - 'class' => 'aligncenter', |
|
36 | - ) ); |
|
37 | - } else { |
|
38 | - ?> |
|
32 | + $featured_image = get_the_post_thumbnail(); |
|
33 | + if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
34 | + the_post_thumbnail( 'lsx-thumbnail-square', array( |
|
35 | + 'class' => 'aligncenter', |
|
36 | + ) ); |
|
37 | + } else { |
|
38 | + ?> |
|
39 | 39 | <img loading="lazy" class="placeholder" src="<?php echo esc_attr( plugin_dir_url( __FILE__ ) . '../assets/images/placeholder.jpg' ); ?>"> |
40 | 40 | <?php |
41 | - } |
|
42 | - ?> |
|
41 | + } |
|
42 | + ?> |
|
43 | 43 | </a> |
44 | 44 | </div> |
45 | 45 | <div class="content-box white-bg"> |
@@ -12,31 +12,31 @@ discard block |
||
12 | 12 | <?php |
13 | 13 | $column_class = '4'; |
14 | 14 | // Check for shortcode overrides. |
15 | -if ( null !== $shortcode_args ) { |
|
16 | - if ( isset( $shortcode_args['columns'] ) ) { |
|
15 | +if (null !== $shortcode_args) { |
|
16 | + if (isset($shortcode_args['columns'])) { |
|
17 | 17 | $column_class = $shortcode_args['columns']; |
18 | - $column_class = \lsx_health_plan\functions\column_class( $column_class ); |
|
18 | + $column_class = \lsx_health_plan\functions\column_class($column_class); |
|
19 | 19 | } |
20 | 20 | } |
21 | 21 | ?> |
22 | 22 | |
23 | -<div class="col-xs-12 col-sm-6 col-md-<?php echo esc_attr( $column_class ); ?>"> |
|
23 | +<div class="col-xs-12 col-sm-6 col-md-<?php echo esc_attr($column_class); ?>"> |
|
24 | 24 | <article class="lsx-slot box-shadow"> |
25 | 25 | <?php lsx_entry_top(); ?> |
26 | 26 | |
27 | 27 | <?php lsx_hp_recipe_plan_meta(); ?> |
28 | 28 | |
29 | 29 | <div class="recipe-feature-img"> |
30 | - <a href="<?php echo esc_url( get_permalink() ); ?>"> |
|
30 | + <a href="<?php echo esc_url(get_permalink()); ?>"> |
|
31 | 31 | <?php |
32 | 32 | $featured_image = get_the_post_thumbnail(); |
33 | - if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
34 | - the_post_thumbnail( 'lsx-thumbnail-square', array( |
|
33 | + if ( ! empty($featured_image) && '' !== $featured_image) { |
|
34 | + the_post_thumbnail('lsx-thumbnail-square', array( |
|
35 | 35 | 'class' => 'aligncenter', |
36 | - ) ); |
|
36 | + )); |
|
37 | 37 | } else { |
38 | 38 | ?> |
39 | - <img loading="lazy" class="placeholder" src="<?php echo esc_attr( plugin_dir_url( __FILE__ ) . '../assets/images/placeholder.jpg' ); ?>"> |
|
39 | + <img loading="lazy" class="placeholder" src="<?php echo esc_attr(plugin_dir_url(__FILE__) . '../assets/images/placeholder.jpg'); ?>"> |
|
40 | 40 | <?php |
41 | 41 | } |
42 | 42 | ?> |
@@ -44,10 +44,10 @@ discard block |
||
44 | 44 | </div> |
45 | 45 | <div class="content-box white-bg"> |
46 | 46 | <?php lsx_health_plan_recipe_data(); ?> |
47 | - <a class="recipe-title-link" href="<?php echo esc_url( get_permalink() ); ?>"> |
|
48 | - <?php the_title( '<h3 class="recipe-title">', '</h3>' ); ?> |
|
47 | + <a class="recipe-title-link" href="<?php echo esc_url(get_permalink()); ?>"> |
|
48 | + <?php the_title('<h3 class="recipe-title">', '</h3>'); ?> |
|
49 | 49 | </a> |
50 | - <a href="<?php echo esc_url( get_permalink() ); ?>" class="btn border-btn"><?php esc_html_e( 'See Recipe', 'lsx-health-plan' ); ?></a> |
|
50 | + <a href="<?php echo esc_url(get_permalink()); ?>" class="btn border-btn"><?php esc_html_e('See Recipe', 'lsx-health-plan'); ?></a> |
|
51 | 51 | </div> |
52 | 52 | <?php lsx_entry_bottom(); ?> |
53 | 53 | </article> |
@@ -1143,7 +1143,9 @@ |
||
1143 | 1143 | </article> |
1144 | 1144 | |
1145 | 1145 | <?php |
1146 | - if (++$i === 3) break; |
|
1146 | + if (++$i === 3) { |
|
1147 | + break; |
|
1148 | + } |
|
1147 | 1149 | } ?> |
1148 | 1150 | </div> |
1149 | 1151 | </div> |
@@ -11,29 +11,29 @@ discard block |
||
11 | 11 | * @return void |
12 | 12 | */ |
13 | 13 | function lsx_health_plan_workout_box() { |
14 | - if ( ! post_type_exists( 'workout' ) ) { |
|
15 | - return; |
|
16 | - } |
|
17 | - $intro_text = \lsx_health_plan\functions\get_option( 'workout_intro', false ); |
|
18 | - ?> |
|
14 | + if ( ! post_type_exists( 'workout' ) ) { |
|
15 | + return; |
|
16 | + } |
|
17 | + $intro_text = \lsx_health_plan\functions\get_option( 'workout_intro', false ); |
|
18 | + ?> |
|
19 | 19 | <div class="workout-instructions"> |
20 | 20 | <div class="row"> |
21 | 21 | <div class="col-md-12"> |
22 | 22 | <?php |
23 | - if ( false !== $intro_text ) { |
|
24 | - ?> |
|
23 | + if ( false !== $intro_text ) { |
|
24 | + ?> |
|
25 | 25 | <div class="excerpt"> |
26 | 26 | <p><?php echo wp_kses_post( wpautop( $intro_text ) ); ?></p> |
27 | 27 | </div> |
28 | 28 | <?php |
29 | - } else { |
|
30 | - ?> |
|
29 | + } else { |
|
30 | + ?> |
|
31 | 31 | <div class="content-intro"> |
32 | 32 | <h3><?php esc_html_e( "Don't forget your warm up!", 'lsx-health-plan' ); ?></h3> |
33 | 33 | <p><?php esc_html_e( 'Be sure to do the warm-up before every workout session.', 'lsx-health-plan' ); ?></p> |
34 | 34 | </div> |
35 | 35 | <?php |
36 | - } ?> |
|
36 | + } ?> |
|
37 | 37 | </div> |
38 | 38 | </div> |
39 | 39 | </div> |
@@ -46,28 +46,28 @@ discard block |
||
46 | 46 | * @return void |
47 | 47 | */ |
48 | 48 | function lsx_health_plan_meal_box() { |
49 | - if ( ! post_type_exists( 'meal' ) ) { |
|
50 | - return; |
|
51 | - } |
|
52 | - ?> |
|
49 | + if ( ! post_type_exists( 'meal' ) ) { |
|
50 | + return; |
|
51 | + } |
|
52 | + ?> |
|
53 | 53 | <div class="col-md-4" > |
54 | 54 | <div class="lsx-health-plan-box"> |
55 | 55 | <h3 class="title meal-plan-title title-lined"><?php esc_html_e( 'Your Meal Plan', 'lsx-health-plan' ); ?><?php lsx_get_svg_icon( 'meal.svg' ); ?></h3> |
56 | 56 | <div class="spacer"></div> |
57 | 57 | <?php |
58 | - $intro_text = \lsx_health_plan\functions\get_option( 'meal_plan_intro', false ); |
|
59 | - if ( false !== $intro_text ) { |
|
60 | - ?> |
|
58 | + $intro_text = \lsx_health_plan\functions\get_option( 'meal_plan_intro', false ); |
|
59 | + if ( false !== $intro_text ) { |
|
60 | + ?> |
|
61 | 61 | <div class="excerpt"> |
62 | 62 | <p><?php echo wp_kses_post( $intro_text ); ?></p> |
63 | 63 | </div> |
64 | 64 | <?php |
65 | - } |
|
66 | - $meal = \lsx_health_plan\functions\get_option( 'endpoint_meal', false ); |
|
67 | - if ( false === $meal ) { |
|
68 | - $meal = 'meal'; |
|
69 | - } |
|
70 | - ?> |
|
65 | + } |
|
66 | + $meal = \lsx_health_plan\functions\get_option( 'endpoint_meal', false ); |
|
67 | + if ( false === $meal ) { |
|
68 | + $meal = 'meal'; |
|
69 | + } |
|
70 | + ?> |
|
71 | 71 | <a href="<?php the_permalink(); ?><?php echo esc_attr( $meal ); ?>/" class="btn"><?php esc_html_e( 'View your meal plan', 'lsx-health-plan' ); ?></a> |
72 | 72 | </div> |
73 | 73 | </div> |
@@ -80,28 +80,28 @@ discard block |
||
80 | 80 | * @return void |
81 | 81 | */ |
82 | 82 | function lsx_health_plan_recipe_box() { |
83 | - if ( ! post_type_exists( 'recipe' ) ) { |
|
84 | - return; |
|
85 | - } |
|
86 | - ?> |
|
83 | + if ( ! post_type_exists( 'recipe' ) ) { |
|
84 | + return; |
|
85 | + } |
|
86 | + ?> |
|
87 | 87 | <div class="col-md-4" > |
88 | 88 | <div class="lsx-health-plan-box"> |
89 | 89 | <h3 class="title recipes-title title-lined"><?php esc_html_e( 'Recipes', 'lsx-health-plan' ); ?><?php lsx_get_svg_icon( 'recipes.svg' ); ?></h3> |
90 | 90 | <div class="spacer"></div> |
91 | 91 | <?php |
92 | - $intro_text = \lsx_health_plan\functions\get_option( 'recipes_intro', false ); |
|
93 | - if ( false !== $intro_text ) { |
|
94 | - ?> |
|
92 | + $intro_text = \lsx_health_plan\functions\get_option( 'recipes_intro', false ); |
|
93 | + if ( false !== $intro_text ) { |
|
94 | + ?> |
|
95 | 95 | <div class="excerpt"> |
96 | 96 | <p><?php echo wp_kses_post( $intro_text ); ?></p> |
97 | 97 | </div> |
98 | 98 | <?php |
99 | - } |
|
100 | - $recipes = \lsx_health_plan\functions\get_option( 'endpoint_recipe', false ); |
|
101 | - if ( false === $recipes ) { |
|
102 | - $recipes = 'recipes'; |
|
103 | - } |
|
104 | - ?> |
|
99 | + } |
|
100 | + $recipes = \lsx_health_plan\functions\get_option( 'endpoint_recipe', false ); |
|
101 | + if ( false === $recipes ) { |
|
102 | + $recipes = 'recipes'; |
|
103 | + } |
|
104 | + ?> |
|
105 | 105 | <a href="<?php the_permalink(); ?><?php echo esc_attr( $recipes ); ?>/" class="btn"><?php esc_html_e( 'View all recipes', 'lsx-health-plan' ); ?></a> |
106 | 106 | </div> |
107 | 107 | </div> |
@@ -114,8 +114,8 @@ discard block |
||
114 | 114 | * @return void |
115 | 115 | */ |
116 | 116 | function lsx_health_plan_downloads_box() { |
117 | - global $current_user; |
|
118 | - ?> |
|
117 | + global $current_user; |
|
118 | + ?> |
|
119 | 119 | <div class="col-md-4 day-download-box" > |
120 | 120 | <div class="lsx-health-plan-box"> |
121 | 121 | <h3 class="title downloads-title title-lined"><?php esc_html_e( 'Downloads', 'lsx-health-plan' ); ?><?php lsx_get_svg_icon( 'download.svg' ); ?></h3> |
@@ -123,13 +123,13 @@ discard block |
||
123 | 123 | <div class="download-list"> |
124 | 124 | <ul> |
125 | 125 | <?php |
126 | - $downloads = \lsx_health_plan\functions\get_downloads(); |
|
127 | - if ( ! empty( $downloads ) ) { |
|
128 | - foreach ( $downloads as $download ) { |
|
129 | - echo wp_kses_post( '<li><a href=""><i class="fa fa-file-pdf"></i>' . do_shortcode( '[download id="' . $download . '"]' ) . '</a></li>' ); |
|
130 | - } |
|
131 | - } |
|
132 | - ?> |
|
126 | + $downloads = \lsx_health_plan\functions\get_downloads(); |
|
127 | + if ( ! empty( $downloads ) ) { |
|
128 | + foreach ( $downloads as $download ) { |
|
129 | + echo wp_kses_post( '<li><a href=""><i class="fa fa-file-pdf"></i>' . do_shortcode( '[download id="' . $download . '"]' ) . '</a></li>' ); |
|
130 | + } |
|
131 | + } |
|
132 | + ?> |
|
133 | 133 | </ul> |
134 | 134 | </div> |
135 | 135 | </div> |
@@ -144,15 +144,15 @@ discard block |
||
144 | 144 | * @return void |
145 | 145 | */ |
146 | 146 | function lsx_health_plan_nav_class( $tab = '' ) { |
147 | - $nav_classes = array(); |
|
148 | - if ( function_exists( 'is_wc_endpoint_url' ) && 'edit-account' === $tab && is_wc_endpoint_url( 'edit-account' ) ) { |
|
149 | - $nav_classes[] = 'active'; |
|
150 | - } elseif ( lsx_health_plan_is_current_tab( $tab ) ) { |
|
151 | - $nav_classes[] = 'active'; |
|
152 | - } |
|
153 | - if ( ! empty( $nav_classes ) ) { |
|
154 | - echo wp_kses_post( implode( ' ', $nav_classes ) ); |
|
155 | - } |
|
147 | + $nav_classes = array(); |
|
148 | + if ( function_exists( 'is_wc_endpoint_url' ) && 'edit-account' === $tab && is_wc_endpoint_url( 'edit-account' ) ) { |
|
149 | + $nav_classes[] = 'active'; |
|
150 | + } elseif ( lsx_health_plan_is_current_tab( $tab ) ) { |
|
151 | + $nav_classes[] = 'active'; |
|
152 | + } |
|
153 | + if ( ! empty( $nav_classes ) ) { |
|
154 | + echo wp_kses_post( implode( ' ', $nav_classes ) ); |
|
155 | + } |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | /** |
@@ -161,29 +161,29 @@ discard block |
||
161 | 161 | * @return void |
162 | 162 | */ |
163 | 163 | function lsx_health_plan_my_profile_tabs() { |
164 | - ?> |
|
164 | + ?> |
|
165 | 165 | <div id="account-nav"> |
166 | 166 | <ul class="nav nav-pills"> |
167 | 167 | <li class=" |
168 | 168 | <?php |
169 | - if ( ( function_exists( 'is_wc_endpoint_url' ) && ! is_wc_endpoint_url( 'edit-account' ) ) || ! function_exists( 'is_wc_endpoint_url' ) ) { |
|
170 | - echo esc_attr( 'active' ); |
|
171 | - } |
|
172 | - ?> |
|
169 | + if ( ( function_exists( 'is_wc_endpoint_url' ) && ! is_wc_endpoint_url( 'edit-account' ) ) || ! function_exists( 'is_wc_endpoint_url' ) ) { |
|
170 | + echo esc_attr( 'active' ); |
|
171 | + } |
|
172 | + ?> |
|
173 | 173 | "><a class="my-plan-tab" href="<?php the_permalink(); ?>"><?php esc_html_e( 'My Plans', 'lsx-health-plan' ); ?></a></li> |
174 | 174 | <?php |
175 | - if ( function_exists( 'WC' ) ) { |
|
176 | - ?> |
|
175 | + if ( function_exists( 'WC' ) ) { |
|
176 | + ?> |
|
177 | 177 | <li class=" |
178 | 178 | <?php |
179 | - if ( function_exists( 'is_wc_endpoint_url' ) && is_wc_endpoint_url( 'edit-account' ) ) { |
|
180 | - echo esc_attr( 'active' ); |
|
181 | - } |
|
182 | - ?> |
|
179 | + if ( function_exists( 'is_wc_endpoint_url' ) && is_wc_endpoint_url( 'edit-account' ) ) { |
|
180 | + echo esc_attr( 'active' ); |
|
181 | + } |
|
182 | + ?> |
|
183 | 183 | "><a class="account-details-tab" href="<?php the_permalink(); ?>edit-account/"><?php esc_html_e( 'Account Details', 'lsx-health-plan' ); ?></a></li> |
184 | 184 | <?php |
185 | - } |
|
186 | - ?> |
|
185 | + } |
|
186 | + ?> |
|
187 | 187 | <li class=""><a class="logout-tab" href="<?php echo esc_url( wp_logout_url( get_permalink() ) ); ?>"><?php esc_html_e( 'Logout', 'lsx-health-plan' ); ?></a></li> |
188 | 188 | </ul> |
189 | 189 | </div> |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | * @return void |
197 | 197 | */ |
198 | 198 | function lsx_health_plan_my_profile_box() { |
199 | - ?> |
|
199 | + ?> |
|
200 | 200 | <div class="lsx-health-plan my-profile-block wp-block-cover alignfull"> |
201 | 201 | <div class="wp-block-cover__inner-container"> |
202 | 202 | <h2><?php esc_html_e( 'My Dashboard', 'lsx-health-plan' ); ?></h2> |
@@ -206,14 +206,14 @@ discard block |
||
206 | 206 | <div class="profile-navigation"> |
207 | 207 | <div class="profile-photo"> |
208 | 208 | <?php |
209 | - global $current_user; |
|
210 | - if ( function_exists( 'WC' ) ) { |
|
211 | - get_current_user(); |
|
212 | - } |
|
213 | - if ( class_exists( 'WP_User_Avatar_Setup' ) ) { |
|
214 | - echo get_avatar( $current_user->ID, 240 ); |
|
215 | - } |
|
216 | - ?> |
|
209 | + global $current_user; |
|
210 | + if ( function_exists( 'WC' ) ) { |
|
211 | + get_current_user(); |
|
212 | + } |
|
213 | + if ( class_exists( 'WP_User_Avatar_Setup' ) ) { |
|
214 | + echo get_avatar( $current_user->ID, 240 ); |
|
215 | + } |
|
216 | + ?> |
|
217 | 217 | </div> |
218 | 218 | </div> |
219 | 219 | <?php } ?> |
@@ -221,88 +221,88 @@ discard block |
||
221 | 221 | <div class="profile-details"> |
222 | 222 | <h1 class="title-lined has-text-color"><?php echo esc_html( $current_user->display_name ); ?></h1> |
223 | 223 | <?php |
224 | - $disable_stats = \lsx_health_plan\functions\get_option( 'disable_all_stats', false ); |
|
225 | - if ( 'on' !== $disable_stats && function_exists( 'WC' ) ) { |
|
224 | + $disable_stats = \lsx_health_plan\functions\get_option( 'disable_all_stats', false ); |
|
225 | + if ( 'on' !== $disable_stats && function_exists( 'WC' ) ) { |
|
226 | 226 | |
227 | - $is_weight_disabled = \lsx_health_plan\functions\get_option( 'disable_weight_checkbox', false ); |
|
228 | - $is_height_disabled = \lsx_health_plan\functions\get_option( 'disable_height_checkbox', false ); |
|
229 | - $is_waist_disabled = \lsx_health_plan\functions\get_option( 'disable_waist_checkbox', false ); |
|
230 | - $is_bmi_disabled = \lsx_health_plan\functions\get_option( 'disable_bmi_checkbox', false ); |
|
227 | + $is_weight_disabled = \lsx_health_plan\functions\get_option( 'disable_weight_checkbox', false ); |
|
228 | + $is_height_disabled = \lsx_health_plan\functions\get_option( 'disable_height_checkbox', false ); |
|
229 | + $is_waist_disabled = \lsx_health_plan\functions\get_option( 'disable_waist_checkbox', false ); |
|
230 | + $is_bmi_disabled = \lsx_health_plan\functions\get_option( 'disable_bmi_checkbox', false ); |
|
231 | 231 | |
232 | - $weight = get_user_meta( get_current_user_id(), 'weight', true ); |
|
233 | - $waist = get_user_meta( get_current_user_id(), 'waist', true ); |
|
234 | - $height = get_user_meta( get_current_user_id(), 'height', true ); |
|
232 | + $weight = get_user_meta( get_current_user_id(), 'weight', true ); |
|
233 | + $waist = get_user_meta( get_current_user_id(), 'waist', true ); |
|
234 | + $height = get_user_meta( get_current_user_id(), 'height', true ); |
|
235 | 235 | |
236 | - $height_m = 0; |
|
237 | - if ( is_numeric( $height ) ) { |
|
238 | - $height_m = $height / 100; |
|
239 | - } |
|
236 | + $height_m = 0; |
|
237 | + if ( is_numeric( $height ) ) { |
|
238 | + $height_m = $height / 100; |
|
239 | + } |
|
240 | 240 | |
241 | - if ( 1 < $weight && 1 < $height_m ) { |
|
242 | - $bmi = $weight / ( $height_m * $height_m ); |
|
243 | - $bmi = number_format( $bmi, 1 ); |
|
244 | - } else { |
|
245 | - $bmi = __( 'Add more data', 'lsx-health-plan' ); |
|
246 | - } |
|
241 | + if ( 1 < $weight && 1 < $height_m ) { |
|
242 | + $bmi = $weight / ( $height_m * $height_m ); |
|
243 | + $bmi = number_format( $bmi, 1 ); |
|
244 | + } else { |
|
245 | + $bmi = __( 'Add more data', 'lsx-health-plan' ); |
|
246 | + } |
|
247 | 247 | |
248 | - ?> |
|
248 | + ?> |
|
249 | 249 | |
250 | 250 | <div> |
251 | 251 | <?php if ( 'on' !== $is_weight_disabled ) { ?> |
252 | 252 | <span><strong><?php esc_html_e( 'Weight:', 'lsx-health-plan' ); ?></strong> |
253 | 253 | <?php |
254 | - if ( '' !== $weight ) { |
|
255 | - echo wp_kses_post( $weight . ' kg' ); |
|
256 | - } else { |
|
257 | - echo '/'; |
|
258 | - } |
|
259 | - ?> |
|
254 | + if ( '' !== $weight ) { |
|
255 | + echo wp_kses_post( $weight . ' kg' ); |
|
256 | + } else { |
|
257 | + echo '/'; |
|
258 | + } |
|
259 | + ?> |
|
260 | 260 | </span> |
261 | 261 | <?php } |
262 | - if ( 'on' !== $is_waist_disabled ) { |
|
263 | - ?> |
|
262 | + if ( 'on' !== $is_waist_disabled ) { |
|
263 | + ?> |
|
264 | 264 | <span><strong><?php esc_html_e( 'Waist:', 'lsx-health-plan' ); ?></strong> |
265 | 265 | <?php |
266 | - if ( '' !== $waist ) { |
|
267 | - echo wp_kses_post( $waist . ' cm' ); |
|
268 | - } else { |
|
269 | - echo '/'; |
|
270 | - } |
|
271 | - ?> |
|
266 | + if ( '' !== $waist ) { |
|
267 | + echo wp_kses_post( $waist . ' cm' ); |
|
268 | + } else { |
|
269 | + echo '/'; |
|
270 | + } |
|
271 | + ?> |
|
272 | 272 | </span> |
273 | 273 | <?php } |
274 | - if ( 'on' !== $is_bmi_disabled ) { |
|
275 | - ?> |
|
274 | + if ( 'on' !== $is_bmi_disabled ) { |
|
275 | + ?> |
|
276 | 276 | <span><strong><?php esc_html_e( 'BMI:', 'lsx-health-plan' ); ?></strong> |
277 | 277 | <?php |
278 | - if ( '' !== $bmi ) { |
|
279 | - echo wp_kses_post( $bmi ); |
|
280 | - } else { |
|
281 | - echo '/'; |
|
282 | - } |
|
283 | - ?> |
|
278 | + if ( '' !== $bmi ) { |
|
279 | + echo wp_kses_post( $bmi ); |
|
280 | + } else { |
|
281 | + echo '/'; |
|
282 | + } |
|
283 | + ?> |
|
284 | 284 | </span> |
285 | 285 | <?php } ?> |
286 | 286 | </div> |
287 | 287 | <?php |
288 | - } |
|
288 | + } |
|
289 | 289 | |
290 | - // Only display the edit account link if woocommerce is active. |
|
291 | - if ( function_exists( 'WC' ) ) { |
|
292 | - ?> |
|
290 | + // Only display the edit account link if woocommerce is active. |
|
291 | + if ( function_exists( 'WC' ) ) { |
|
292 | + ?> |
|
293 | 293 | <div class="edit-profile"> |
294 | 294 | <?php |
295 | - if ( function_exists( 'wc_get_page_id' ) ) { |
|
296 | - $url_id = wc_get_page_id( 'myaccount' ); |
|
297 | - } else { |
|
298 | - $url_id = ''; |
|
299 | - } |
|
300 | - ?> |
|
295 | + if ( function_exists( 'wc_get_page_id' ) ) { |
|
296 | + $url_id = wc_get_page_id( 'myaccount' ); |
|
297 | + } else { |
|
298 | + $url_id = ''; |
|
299 | + } |
|
300 | + ?> |
|
301 | 301 | <a href="<?php echo esc_url( get_permalink( $url_id ) ); ?>edit-account/"><?php esc_html_e( 'Edit', 'lsx-health-plan' ); ?></a> |
302 | 302 | </div> |
303 | 303 | <?php |
304 | - } |
|
305 | - ?> |
|
304 | + } |
|
305 | + ?> |
|
306 | 306 | </div> |
307 | 307 | <?php } ?> |
308 | 308 | </section> |
@@ -318,65 +318,65 @@ discard block |
||
318 | 318 | * @return void |
319 | 319 | */ |
320 | 320 | function lsx_health_plan_all_plans_block() { |
321 | - global $post, $product; |
|
322 | - |
|
323 | - $args = array( |
|
324 | - 'orderby' => 'menu_order', |
|
325 | - 'order' => 'ASC', |
|
326 | - 'post_type' => 'plan', |
|
327 | - 'nopagin' => true, |
|
328 | - 'post_parent' => 0, |
|
329 | - ); |
|
330 | - |
|
331 | - if ( function_exists( '\lsx_health_plan\functions\woocommerce\get_membership_products' ) ) { |
|
332 | - $product_ids = \lsx_health_plan\functions\woocommerce\get_membership_products(); |
|
333 | - if ( ! empty( $product_ids ) ) { |
|
334 | - $args['meta_query'] = array( |
|
335 | - 'relation' => 'OR', |
|
336 | - array( |
|
337 | - 'key' => '_plan_product_id', |
|
338 | - 'value' => $product_ids, |
|
339 | - 'compare' => 'IN', |
|
340 | - ), |
|
341 | - array( |
|
342 | - 'key' => '_plan_product_id', |
|
343 | - 'compare' => 'NOT EXISTS', |
|
344 | - ), |
|
345 | - ); |
|
346 | - } |
|
347 | - } |
|
348 | - |
|
349 | - $the_query = new WP_Query( $args ); |
|
350 | - ?> |
|
321 | + global $post, $product; |
|
322 | + |
|
323 | + $args = array( |
|
324 | + 'orderby' => 'menu_order', |
|
325 | + 'order' => 'ASC', |
|
326 | + 'post_type' => 'plan', |
|
327 | + 'nopagin' => true, |
|
328 | + 'post_parent' => 0, |
|
329 | + ); |
|
330 | + |
|
331 | + if ( function_exists( '\lsx_health_plan\functions\woocommerce\get_membership_products' ) ) { |
|
332 | + $product_ids = \lsx_health_plan\functions\woocommerce\get_membership_products(); |
|
333 | + if ( ! empty( $product_ids ) ) { |
|
334 | + $args['meta_query'] = array( |
|
335 | + 'relation' => 'OR', |
|
336 | + array( |
|
337 | + 'key' => '_plan_product_id', |
|
338 | + 'value' => $product_ids, |
|
339 | + 'compare' => 'IN', |
|
340 | + ), |
|
341 | + array( |
|
342 | + 'key' => '_plan_product_id', |
|
343 | + 'compare' => 'NOT EXISTS', |
|
344 | + ), |
|
345 | + ); |
|
346 | + } |
|
347 | + } |
|
348 | + |
|
349 | + $the_query = new WP_Query( $args ); |
|
350 | + ?> |
|
351 | 351 | <div class="all-plans-block plan-grid block-all-plans-block"> |
352 | 352 | <div class="row"> |
353 | 353 | <?php |
354 | - if ( $the_query->have_posts() ) : |
|
355 | - while ( $the_query->have_posts() ) : |
|
356 | - $the_query->the_post(); |
|
357 | - lsx_entry_before(); |
|
358 | - $completed_class = ''; |
|
359 | - $linked_product = false; |
|
360 | - $restricted = false; |
|
361 | - $product = null; |
|
362 | - if ( function_exists( 'lsx_health_plan\functions\woocommerce\plan_has_products' ) && \lsx_health_plan\functions\woocommerce\plan_has_products() ) { |
|
363 | - $products = \lsx_health_plan\functions\woocommerce\get_plan_products(); |
|
364 | - $linked_product = wc_get_product( $products[0] ); |
|
365 | - $product = $linked_product; |
|
366 | - } |
|
367 | - if ( function_exists( 'wc_memberships_is_post_content_restricted' ) ) { |
|
368 | - $restricted = wc_memberships_is_post_content_restricted( get_the_ID() ) && ! current_user_can( 'wc_memberships_view_restricted_post_content', get_the_ID() ); |
|
369 | - } |
|
370 | - |
|
371 | - if ( lsx_health_plan_is_plan_complete() ) { |
|
372 | - $completed_class = 'completed'; |
|
373 | - } |
|
374 | - $round_progress = ''; |
|
375 | - $completed_progress = '100'; |
|
376 | - if ( false === $restricted ) { |
|
377 | - $round_progress = round( \lsx_health_plan\functions\get_progress( get_the_ID() ), 0 ); |
|
378 | - } |
|
379 | - ?> |
|
354 | + if ( $the_query->have_posts() ) : |
|
355 | + while ( $the_query->have_posts() ) : |
|
356 | + $the_query->the_post(); |
|
357 | + lsx_entry_before(); |
|
358 | + $completed_class = ''; |
|
359 | + $linked_product = false; |
|
360 | + $restricted = false; |
|
361 | + $product = null; |
|
362 | + if ( function_exists( 'lsx_health_plan\functions\woocommerce\plan_has_products' ) && \lsx_health_plan\functions\woocommerce\plan_has_products() ) { |
|
363 | + $products = \lsx_health_plan\functions\woocommerce\get_plan_products(); |
|
364 | + $linked_product = wc_get_product( $products[0] ); |
|
365 | + $product = $linked_product; |
|
366 | + } |
|
367 | + if ( function_exists( 'wc_memberships_is_post_content_restricted' ) ) { |
|
368 | + $restricted = wc_memberships_is_post_content_restricted( get_the_ID() ) && ! current_user_can( 'wc_memberships_view_restricted_post_content', get_the_ID() ); |
|
369 | + } |
|
370 | + |
|
371 | + if ( lsx_health_plan_is_plan_complete() ) { |
|
372 | + $completed_class = 'completed'; |
|
373 | + } |
|
374 | + $round_progress = ''; |
|
375 | + $completed_progress = '100'; |
|
376 | + if ( false === $restricted ) { |
|
377 | + $round_progress = round( \lsx_health_plan\functions\get_progress( get_the_ID() ), 0 ); |
|
378 | + } |
|
379 | + ?> |
|
380 | 380 | <div class="col-xs-12 col-sm-6 col-md-4"> |
381 | 381 | <article class="lsx-slot lsx-hp-shadow <?php echo esc_html( 'progress-') . $round_progress; ?>"> |
382 | 382 | <div class="plan-feature-img"> |
@@ -385,45 +385,45 @@ discard block |
||
385 | 385 | <?php } ?> |
386 | 386 | <a href="<?php echo esc_url( get_permalink() ); ?>"> |
387 | 387 | <?php |
388 | - $featured_image = get_the_post_thumbnail(); |
|
389 | - if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
390 | - the_post_thumbnail( 'lsx-thumbnail', array( |
|
391 | - 'class' => 'aligncenter', |
|
392 | - ) ); |
|
393 | - } else { |
|
394 | - ?> |
|
388 | + $featured_image = get_the_post_thumbnail(); |
|
389 | + if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
390 | + the_post_thumbnail( 'lsx-thumbnail', array( |
|
391 | + 'class' => 'aligncenter', |
|
392 | + ) ); |
|
393 | + } else { |
|
394 | + ?> |
|
395 | 395 | <img loading="lazy" class="placeholder" src="<?php echo esc_attr( plugin_dir_url( __FILE__ ) . '../assets/images/placeholder.jpg' ); ?>"> |
396 | 396 | <?php |
397 | - } |
|
398 | - ?> |
|
397 | + } |
|
398 | + ?> |
|
399 | 399 | </a> |
400 | 400 | </div> |
401 | 401 | <div class="content-box plan-content-box"> |
402 | 402 | <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> |
403 | 403 | <?php |
404 | - echo wp_kses_post( \lsx_health_plan\functions\hp_get_plan_type_meta( $post ) ); |
|
405 | - ?> |
|
404 | + echo wp_kses_post( \lsx_health_plan\functions\hp_get_plan_type_meta( $post ) ); |
|
405 | + ?> |
|
406 | 406 | <?php |
407 | - if ( false !== $linked_product && false !== $restricted ) { |
|
408 | - echo wp_kses_post( $linked_product->get_price_html() ); |
|
409 | - } |
|
410 | - ?> |
|
407 | + if ( false !== $linked_product && false !== $restricted ) { |
|
408 | + echo wp_kses_post( $linked_product->get_price_html() ); |
|
409 | + } |
|
410 | + ?> |
|
411 | 411 | <div class="excerpt"> |
412 | 412 | <?php |
413 | - if ( ! has_excerpt() ) { |
|
414 | - $content = wp_trim_words( get_the_content(), 20 ); |
|
415 | - $content = '<p>' . $content . '</pre>'; |
|
416 | - } else { |
|
417 | - $content = apply_filters( 'the_excerpt', get_the_excerpt() ); |
|
418 | - } |
|
419 | - echo wp_kses_post( $content ); |
|
420 | - ?> |
|
413 | + if ( ! has_excerpt() ) { |
|
414 | + $content = wp_trim_words( get_the_content(), 20 ); |
|
415 | + $content = '<p>' . $content . '</pre>'; |
|
416 | + } else { |
|
417 | + $content = apply_filters( 'the_excerpt', get_the_excerpt() ); |
|
418 | + } |
|
419 | + echo wp_kses_post( $content ); |
|
420 | + ?> |
|
421 | 421 | </div> |
422 | 422 | <?php |
423 | - if ( false === $restricted ) { |
|
424 | - 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>' ); |
|
425 | - } |
|
426 | - ?> |
|
423 | + if ( false === $restricted ) { |
|
424 | + 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>' ); |
|
425 | + } |
|
426 | + ?> |
|
427 | 427 | </div> |
428 | 428 | </article> |
429 | 429 | </div> |
@@ -442,36 +442,36 @@ discard block |
||
442 | 442 | * @return void |
443 | 443 | */ |
444 | 444 | function lsx_health_plan_day_plan_block( $args = array() ) { |
445 | - $defaults = array( |
|
446 | - 'plan' => '', |
|
447 | - ); |
|
448 | - $args = wp_parse_args( $args, $defaults ); |
|
449 | - |
|
450 | - if ( isset( $args['plan'] ) && '' !== $args['plan'] && \lsx_health_plan\functions\plan\has_sections( $args['plan'] ) ) { |
|
451 | - $sections = \lsx_health_plan\functions\plan\get_sections(); |
|
452 | - ?> |
|
445 | + $defaults = array( |
|
446 | + 'plan' => '', |
|
447 | + ); |
|
448 | + $args = wp_parse_args( $args, $defaults ); |
|
449 | + |
|
450 | + if ( isset( $args['plan'] ) && '' !== $args['plan'] && \lsx_health_plan\functions\plan\has_sections( $args['plan'] ) ) { |
|
451 | + $sections = \lsx_health_plan\functions\plan\get_sections(); |
|
452 | + ?> |
|
453 | 453 | <div class="daily-plan-block day-grid"> |
454 | 454 | <?php |
455 | - foreach ( $sections as $section_key => $section_values ) { |
|
456 | - $defaults = array( |
|
457 | - 'title' => __( 'Day', 'lsx-health-plan' ) . ' ' . ( $section_key + 1 ), |
|
458 | - ); |
|
459 | - $section_args = wp_parse_args( $section_values, $defaults ); |
|
460 | - |
|
461 | - $completed_class = ''; |
|
462 | - if ( lsx_health_plan_is_day_complete() ) { |
|
463 | - $completed_class = 'completed'; |
|
464 | - } |
|
465 | - ?> |
|
455 | + foreach ( $sections as $section_key => $section_values ) { |
|
456 | + $defaults = array( |
|
457 | + 'title' => __( 'Day', 'lsx-health-plan' ) . ' ' . ( $section_key + 1 ), |
|
458 | + ); |
|
459 | + $section_args = wp_parse_args( $section_values, $defaults ); |
|
460 | + |
|
461 | + $completed_class = ''; |
|
462 | + if ( lsx_health_plan_is_day_complete() ) { |
|
463 | + $completed_class = 'completed'; |
|
464 | + } |
|
465 | + ?> |
|
466 | 466 | <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 ); ?>"> |
467 | 467 | <div class="plan-content"><?php echo esc_attr( $section_args['title'] ); ?></div> |
468 | 468 | </a> |
469 | 469 | <?php |
470 | - } |
|
471 | - ?> |
|
470 | + } |
|
471 | + ?> |
|
472 | 472 | </div> |
473 | 473 | <?php |
474 | - } |
|
474 | + } |
|
475 | 475 | } |
476 | 476 | |
477 | 477 | /** |
@@ -481,44 +481,44 @@ discard block |
||
481 | 481 | * @return void |
482 | 482 | */ |
483 | 483 | function lsx_health_plan_week_plan_block( $args = array() ) { |
484 | - $defaults = array( |
|
485 | - 'show_downloads' => false, |
|
486 | - 'plan' => '', |
|
487 | - ); |
|
488 | - $args = wp_parse_args( $args, $defaults ); |
|
489 | - |
|
490 | - if ( isset( $args['plan'] ) && '' !== $args['plan'] && \lsx_health_plan\functions\plan\has_sections( $args['plan'] ) ) { |
|
491 | - $groups = \lsx_health_plan\functions\plan\get_sections( true ); |
|
492 | - |
|
493 | - if ( ! empty( $groups ) ) { |
|
494 | - $counter = 1; |
|
495 | - $group_open = false; |
|
496 | - |
|
497 | - foreach ( $groups as $group_key => $sections ) { |
|
498 | - $collapse_class = ''; |
|
499 | - $group_title = \lsx_health_plan\functions\plan\get_group_title( $sections ); |
|
500 | - |
|
501 | - // Determine if the current week is complete. |
|
502 | - $day_ids = wp_list_pluck( $sections, 'title' ); |
|
503 | - if ( false === $group_open ) { |
|
504 | - if ( 1 === $counter && ! \lsx_health_plan\functions\is_week_complete( false, $day_ids, $group_title ) ) { |
|
505 | - $collapse_class = 'in'; |
|
506 | - $group_open = true; |
|
507 | - } elseif ( ! \lsx_health_plan\functions\is_week_complete( false, $day_ids, $group_title ) ) { |
|
508 | - $collapse_class = 'in'; |
|
509 | - $group_open = true; |
|
510 | - } |
|
511 | - } |
|
512 | - |
|
513 | - // Determine if there are any weekly downloads. |
|
514 | - $week_downloads_view = ''; |
|
515 | - if ( isset( $args['show_downloads'] ) && false !== $args['show_downloads'] ) { |
|
516 | - $weekly_downloads = \lsx_health_plan\functions\get_weekly_downloads( $group_key ); |
|
517 | - if ( ! empty( $weekly_downloads ) ) { |
|
518 | - $week_downloads_view = 'week-downloads-view-on'; |
|
519 | - } |
|
520 | - } |
|
521 | - ?> |
|
484 | + $defaults = array( |
|
485 | + 'show_downloads' => false, |
|
486 | + 'plan' => '', |
|
487 | + ); |
|
488 | + $args = wp_parse_args( $args, $defaults ); |
|
489 | + |
|
490 | + if ( isset( $args['plan'] ) && '' !== $args['plan'] && \lsx_health_plan\functions\plan\has_sections( $args['plan'] ) ) { |
|
491 | + $groups = \lsx_health_plan\functions\plan\get_sections( true ); |
|
492 | + |
|
493 | + if ( ! empty( $groups ) ) { |
|
494 | + $counter = 1; |
|
495 | + $group_open = false; |
|
496 | + |
|
497 | + foreach ( $groups as $group_key => $sections ) { |
|
498 | + $collapse_class = ''; |
|
499 | + $group_title = \lsx_health_plan\functions\plan\get_group_title( $sections ); |
|
500 | + |
|
501 | + // Determine if the current week is complete. |
|
502 | + $day_ids = wp_list_pluck( $sections, 'title' ); |
|
503 | + if ( false === $group_open ) { |
|
504 | + if ( 1 === $counter && ! \lsx_health_plan\functions\is_week_complete( false, $day_ids, $group_title ) ) { |
|
505 | + $collapse_class = 'in'; |
|
506 | + $group_open = true; |
|
507 | + } elseif ( ! \lsx_health_plan\functions\is_week_complete( false, $day_ids, $group_title ) ) { |
|
508 | + $collapse_class = 'in'; |
|
509 | + $group_open = true; |
|
510 | + } |
|
511 | + } |
|
512 | + |
|
513 | + // Determine if there are any weekly downloads. |
|
514 | + $week_downloads_view = ''; |
|
515 | + if ( isset( $args['show_downloads'] ) && false !== $args['show_downloads'] ) { |
|
516 | + $weekly_downloads = \lsx_health_plan\functions\get_weekly_downloads( $group_key ); |
|
517 | + if ( ! empty( $weekly_downloads ) ) { |
|
518 | + $week_downloads_view = 'week-downloads-view-on'; |
|
519 | + } |
|
520 | + } |
|
521 | + ?> |
|
522 | 522 | <div class="daily-plan-block week-grid"> |
523 | 523 | <a href="#group-<?php echo esc_attr( $group_key ); ?>" data-toggle="collapse" class="week-title"><?php echo esc_attr( $group_title ); ?></a> |
524 | 524 | <div id="group-<?php echo esc_attr( $group_key ); ?>" class="week-row collapse <?php echo esc_attr( $collapse_class ); ?>"> |
@@ -532,46 +532,46 @@ discard block |
||
532 | 532 | <div class="week-meals-recipes-box-inner"> |
533 | 533 | <?php |
534 | 534 | |
535 | - foreach ( $sections as $section_key => $section_values ) { |
|
535 | + foreach ( $sections as $section_key => $section_values ) { |
|
536 | 536 | |
537 | - $defaults = array( |
|
538 | - 'title' => __( 'Day', 'lsx-health-plan' ) . ' ' . ( $section_key + 1 ), |
|
539 | - ); |
|
540 | - $section_args = wp_parse_args( $section_values, $defaults ); |
|
537 | + $defaults = array( |
|
538 | + 'title' => __( 'Day', 'lsx-health-plan' ) . ' ' . ( $section_key + 1 ), |
|
539 | + ); |
|
540 | + $section_args = wp_parse_args( $section_values, $defaults ); |
|
541 | 541 | |
542 | - $completed_class = ''; |
|
543 | - if ( lsx_health_plan_is_day_complete( $args['plan'], $section_args['title'] ) ) { |
|
544 | - $completed_class = 'completed'; |
|
545 | - } |
|
546 | - if ( $section_args['rest_day_enabled'] && ! $section_args['connected_meals'] ) { |
|
547 | - ?> |
|
542 | + $completed_class = ''; |
|
543 | + if ( lsx_health_plan_is_day_complete( $args['plan'], $section_args['title'] ) ) { |
|
544 | + $completed_class = 'completed'; |
|
545 | + } |
|
546 | + if ( $section_args['rest_day_enabled'] && ! $section_args['connected_meals'] ) { |
|
547 | + ?> |
|
548 | 548 | <span class="day id-<?php echo esc_attr( $section_key + 1 ); ?> <?php echo esc_attr( $completed_class ); ?>"> |
549 | 549 | <div class="plan-content"><?php echo esc_attr( $section_args['title'] ); ?></div> |
550 | 550 | </span> |
551 | 551 | <?php |
552 | - } else { |
|
553 | - ?> |
|
552 | + } else { |
|
553 | + ?> |
|
554 | 554 | <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 ); ?>"> |
555 | 555 | <div class="plan-content"><?php echo esc_attr( $section_args['title'] ); ?></div> |
556 | 556 | </a> |
557 | 557 | <?php |
558 | - } |
|
559 | - } |
|
560 | - ?> |
|
558 | + } |
|
559 | + } |
|
560 | + ?> |
|
561 | 561 | </div> |
562 | 562 | </div> |
563 | 563 | <?php |
564 | - if ( ! empty( $week_downloads_view ) ) { |
|
565 | - lsx_health_plan_weekly_downloads( $weekly_downloads ); |
|
566 | - } |
|
567 | - ?> |
|
564 | + if ( ! empty( $week_downloads_view ) ) { |
|
565 | + lsx_health_plan_weekly_downloads( $weekly_downloads ); |
|
566 | + } |
|
567 | + ?> |
|
568 | 568 | </div> |
569 | 569 | </div> |
570 | 570 | </div> |
571 | 571 | <?php |
572 | - } |
|
573 | - } |
|
574 | - } |
|
572 | + } |
|
573 | + } |
|
574 | + } |
|
575 | 575 | } |
576 | 576 | |
577 | 577 | /** |
@@ -581,22 +581,22 @@ discard block |
||
581 | 581 | * @return void |
582 | 582 | */ |
583 | 583 | function lsx_health_plan_weekly_downloads( $weekly_downloads = array() ) { |
584 | - if ( ! empty( $weekly_downloads ) ) { |
|
585 | - ?> |
|
584 | + if ( ! empty( $weekly_downloads ) ) { |
|
585 | + ?> |
|
586 | 586 | <div class="week-download-box"> |
587 | 587 | <h3 class="title"><?php lsx_get_svg_icon( 'download.svg' ); ?><?php echo esc_html_e( 'Downloads', 'lsx-health-plan' ); ?></h3> |
588 | 588 | <ul class="week-download-box-list"> |
589 | 589 | <?php |
590 | - foreach ( $weekly_downloads as $weekly_download ) { |
|
591 | - ?> |
|
590 | + foreach ( $weekly_downloads as $weekly_download ) { |
|
591 | + ?> |
|
592 | 592 | <li><?php echo wp_kses_post( do_shortcode( '[download id="' . $weekly_download . '"]' ) ); ?></li> |
593 | 593 | <?php |
594 | - } |
|
595 | - ?> |
|
594 | + } |
|
595 | + ?> |
|
596 | 596 | </ul> |
597 | 597 | </div> |
598 | 598 | <?php |
599 | - } |
|
599 | + } |
|
600 | 600 | } |
601 | 601 | |
602 | 602 | /** |
@@ -605,9 +605,9 @@ discard block |
||
605 | 605 | * @return void |
606 | 606 | */ |
607 | 607 | function lsx_health_plan_items( $args = array() ) { |
608 | - global $shortcode_args; |
|
609 | - $shortcode_args = $args; |
|
610 | - include LSX_HEALTH_PLAN_PATH . '/templates/partials/shortcode-loop.php'; |
|
608 | + global $shortcode_args; |
|
609 | + $shortcode_args = $args; |
|
610 | + include LSX_HEALTH_PLAN_PATH . '/templates/partials/shortcode-loop.php'; |
|
611 | 611 | } |
612 | 612 | |
613 | 613 | /** |
@@ -616,10 +616,10 @@ discard block |
||
616 | 616 | * @return void |
617 | 617 | */ |
618 | 618 | function lsx_health_plan_featured_video_block() { |
619 | - if ( ! post_type_exists( 'video' ) ) { |
|
620 | - return; |
|
621 | - } |
|
622 | - include LSX_HEALTH_PLAN_PATH . '/templates/featured-videos.php'; |
|
619 | + if ( ! post_type_exists( 'video' ) ) { |
|
620 | + return; |
|
621 | + } |
|
622 | + include LSX_HEALTH_PLAN_PATH . '/templates/featured-videos.php'; |
|
623 | 623 | } |
624 | 624 | |
625 | 625 | /** |
@@ -628,10 +628,10 @@ discard block |
||
628 | 628 | * @return void |
629 | 629 | */ |
630 | 630 | function lsx_health_plan_featured_recipes_block() { |
631 | - if ( ! post_type_exists( 'recipe' ) ) { |
|
632 | - return; |
|
633 | - } |
|
634 | - include LSX_HEALTH_PLAN_PATH . '/templates/featured-recipes.php'; |
|
631 | + if ( ! post_type_exists( 'recipe' ) ) { |
|
632 | + return; |
|
633 | + } |
|
634 | + include LSX_HEALTH_PLAN_PATH . '/templates/featured-recipes.php'; |
|
635 | 635 | } |
636 | 636 | |
637 | 637 | /** |
@@ -640,7 +640,7 @@ discard block |
||
640 | 640 | * @return void |
641 | 641 | */ |
642 | 642 | function lsx_health_plan_featured_tips_block() { |
643 | - include LSX_HEALTH_PLAN_PATH . '/templates/featured-tips.php'; |
|
643 | + include LSX_HEALTH_PLAN_PATH . '/templates/featured-tips.php'; |
|
644 | 644 | } |
645 | 645 | |
646 | 646 | /** |
@@ -650,11 +650,11 @@ discard block |
||
650 | 650 | * @return void |
651 | 651 | */ |
652 | 652 | function lsx_health_plan_day_button() { |
653 | - if ( lsx_health_plan_is_day_complete() ) { |
|
654 | - lsx_health_plan_unlock_button(); |
|
655 | - } else { |
|
656 | - lsx_health_plan_complete_button(); |
|
657 | - } |
|
653 | + if ( lsx_health_plan_is_day_complete() ) { |
|
654 | + lsx_health_plan_unlock_button(); |
|
655 | + } else { |
|
656 | + lsx_health_plan_complete_button(); |
|
657 | + } |
|
658 | 658 | } |
659 | 659 | |
660 | 660 | /** |
@@ -663,7 +663,7 @@ discard block |
||
663 | 663 | * @return void |
664 | 664 | */ |
665 | 665 | function lsx_health_plan_complete_button() { |
666 | - ?> |
|
666 | + ?> |
|
667 | 667 | <div class="single-plan-inner-buttons"> |
668 | 668 | <form action="<?php the_permalink(); ?>" method="post" class="form-complete-day complete-plan-btn"> |
669 | 669 | <?php wp_nonce_field( 'complete', 'lsx-health-plan-actions' ); ?> |
@@ -681,7 +681,7 @@ discard block |
||
681 | 681 | * @return void |
682 | 682 | */ |
683 | 683 | function lsx_health_plan_unlock_button() { |
684 | - ?> |
|
684 | + ?> |
|
685 | 685 | <div class="single-plan-inner-buttons"> |
686 | 686 | <form action="<?php the_permalink(); ?>" method="post" class="form-complete-day complete-plan-btn"> |
687 | 687 | <?php wp_nonce_field( 'unlock', 'lsx-health-plan-actions' ); ?> |
@@ -700,10 +700,10 @@ discard block |
||
700 | 700 | * @return void |
701 | 701 | */ |
702 | 702 | function lsx_health_plan_single_nav() { |
703 | - $tab_template_path = apply_filters( 'lsx_health_plan_single_nav_path', LSX_HEALTH_PLAN_PATH . '/templates/single-plan-tabs.php' ); |
|
704 | - if ( '' !== $tab_template_path ) { |
|
705 | - require $tab_template_path; |
|
706 | - } |
|
703 | + $tab_template_path = apply_filters( 'lsx_health_plan_single_nav_path', LSX_HEALTH_PLAN_PATH . '/templates/single-plan-tabs.php' ); |
|
704 | + if ( '' !== $tab_template_path ) { |
|
705 | + require $tab_template_path; |
|
706 | + } |
|
707 | 707 | } |
708 | 708 | |
709 | 709 | /** |
@@ -713,32 +713,32 @@ discard block |
||
713 | 713 | * @return void |
714 | 714 | */ |
715 | 715 | function lsx_health_plan_single_tabs() { |
716 | - $endpoint = get_query_var( 'endpoint' ); |
|
717 | - switch ( $endpoint ) { |
|
718 | - case 'meal': |
|
719 | - $tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-meal.php'; |
|
720 | - break; |
|
721 | - |
|
722 | - case 'recipes': |
|
723 | - $tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-recipes.php'; |
|
724 | - break; |
|
725 | - |
|
726 | - case 'workout': |
|
727 | - $tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-workout.php'; |
|
728 | - break; |
|
729 | - |
|
730 | - case 'warm-up': |
|
731 | - $tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-warm-up.php'; |
|
732 | - break; |
|
733 | - |
|
734 | - default: |
|
735 | - $tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-plan.php'; |
|
736 | - break; |
|
737 | - } |
|
738 | - $tab_template_path = apply_filters( 'lsx_health_plan_single_tab_path', $tab_template_path ); |
|
739 | - if ( '' !== $tab_template_path ) { |
|
740 | - include $tab_template_path; |
|
741 | - } |
|
716 | + $endpoint = get_query_var( 'endpoint' ); |
|
717 | + switch ( $endpoint ) { |
|
718 | + case 'meal': |
|
719 | + $tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-meal.php'; |
|
720 | + break; |
|
721 | + |
|
722 | + case 'recipes': |
|
723 | + $tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-recipes.php'; |
|
724 | + break; |
|
725 | + |
|
726 | + case 'workout': |
|
727 | + $tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-workout.php'; |
|
728 | + break; |
|
729 | + |
|
730 | + case 'warm-up': |
|
731 | + $tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-warm-up.php'; |
|
732 | + break; |
|
733 | + |
|
734 | + default: |
|
735 | + $tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-plan.php'; |
|
736 | + break; |
|
737 | + } |
|
738 | + $tab_template_path = apply_filters( 'lsx_health_plan_single_tab_path', $tab_template_path ); |
|
739 | + if ( '' !== $tab_template_path ) { |
|
740 | + include $tab_template_path; |
|
741 | + } |
|
742 | 742 | } |
743 | 743 | |
744 | 744 | /** |
@@ -747,7 +747,7 @@ discard block |
||
747 | 747 | * @return void |
748 | 748 | */ |
749 | 749 | function lsx_health_plan_recipe_data() { |
750 | - include LSX_HEALTH_PLAN_PATH . '/templates/table-recipe-data.php'; |
|
750 | + include LSX_HEALTH_PLAN_PATH . '/templates/table-recipe-data.php'; |
|
751 | 751 | } |
752 | 752 | |
753 | 753 | /** |
@@ -756,11 +756,11 @@ discard block |
||
756 | 756 | * @return recipe_type |
757 | 757 | */ |
758 | 758 | function lsx_health_plan_recipe_type() { |
759 | - $term_obj_list = get_the_terms( get_the_ID(), 'recipe-type' ); |
|
760 | - $recipe_type = $term_obj_list[0]->name; |
|
761 | - if ( ! empty( $recipe_type ) ) { |
|
762 | - return $recipe_type; |
|
763 | - } |
|
759 | + $term_obj_list = get_the_terms( get_the_ID(), 'recipe-type' ); |
|
760 | + $recipe_type = $term_obj_list[0]->name; |
|
761 | + if ( ! empty( $recipe_type ) ) { |
|
762 | + return $recipe_type; |
|
763 | + } |
|
764 | 764 | } |
765 | 765 | |
766 | 766 | /** |
@@ -771,35 +771,35 @@ discard block |
||
771 | 771 | * @return void |
772 | 772 | */ |
773 | 773 | function lsx_health_plan_workout_video_play_button( $m, $group, $echo = true ) { |
774 | - $workout_video = ''; |
|
775 | - $giphy = ''; |
|
776 | - $youtube = ''; |
|
777 | - if ( isset( $group['connected_videos'] ) && '' !== $group['connected_videos'] ) { |
|
778 | - $workout_video = esc_html( $group['connected_videos'] ); |
|
779 | - $giphy = get_post_meta( $workout_video, 'video_giphy_source', true ); |
|
780 | - $youtube = esc_url( get_post_meta( $workout_video, 'video_youtube_source', 1 ) ); |
|
781 | - $content = get_post_field( 'post_content', $workout_video ); |
|
782 | - $play_button = '<button data-toggle="modal" data-target="#workout-video-modal-' . $m . '"><span class="fa fa-play-circle"></span></button>'; |
|
783 | - |
|
784 | - $modal_body = ''; |
|
785 | - if ( ! empty( $giphy ) ) { |
|
786 | - $giphy = \lsx_health_plan\functions\get_video_url( $giphy ); |
|
787 | - $modal_body = $giphy; // WPCS: XSS OK. |
|
788 | - } elseif ( ! empty( $youtube ) ) { |
|
789 | - $modal_body = wp_oembed_get( $youtube, array( // WPCS: XSS OK. |
|
790 | - 'width' => 480, |
|
791 | - ) ); |
|
792 | - } |
|
793 | - $modal_body .= '<h5 class="modal-title title-lined">' . $group['name'] . '</h5>'; |
|
794 | - $modal_body .= $content; |
|
795 | - \lsx_health_plan\functions\register_modal( 'workout-video-modal-' . $m, '', $modal_body ); |
|
796 | - |
|
797 | - if ( true === $echo ) { |
|
798 | - echo wp_kses_post( $play_button ); |
|
799 | - } else { |
|
800 | - return $play_button; |
|
801 | - } |
|
802 | - } |
|
774 | + $workout_video = ''; |
|
775 | + $giphy = ''; |
|
776 | + $youtube = ''; |
|
777 | + if ( isset( $group['connected_videos'] ) && '' !== $group['connected_videos'] ) { |
|
778 | + $workout_video = esc_html( $group['connected_videos'] ); |
|
779 | + $giphy = get_post_meta( $workout_video, 'video_giphy_source', true ); |
|
780 | + $youtube = esc_url( get_post_meta( $workout_video, 'video_youtube_source', 1 ) ); |
|
781 | + $content = get_post_field( 'post_content', $workout_video ); |
|
782 | + $play_button = '<button data-toggle="modal" data-target="#workout-video-modal-' . $m . '"><span class="fa fa-play-circle"></span></button>'; |
|
783 | + |
|
784 | + $modal_body = ''; |
|
785 | + if ( ! empty( $giphy ) ) { |
|
786 | + $giphy = \lsx_health_plan\functions\get_video_url( $giphy ); |
|
787 | + $modal_body = $giphy; // WPCS: XSS OK. |
|
788 | + } elseif ( ! empty( $youtube ) ) { |
|
789 | + $modal_body = wp_oembed_get( $youtube, array( // WPCS: XSS OK. |
|
790 | + 'width' => 480, |
|
791 | + ) ); |
|
792 | + } |
|
793 | + $modal_body .= '<h5 class="modal-title title-lined">' . $group['name'] . '</h5>'; |
|
794 | + $modal_body .= $content; |
|
795 | + \lsx_health_plan\functions\register_modal( 'workout-video-modal-' . $m, '', $modal_body ); |
|
796 | + |
|
797 | + if ( true === $echo ) { |
|
798 | + echo wp_kses_post( $play_button ); |
|
799 | + } else { |
|
800 | + return $play_button; |
|
801 | + } |
|
802 | + } |
|
803 | 803 | } |
804 | 804 | |
805 | 805 | /** |
@@ -808,21 +808,21 @@ discard block |
||
808 | 808 | * @return void |
809 | 809 | */ |
810 | 810 | function lsx_health_plan_recipe_archive_description() { |
811 | - $description = ''; |
|
812 | - if ( is_post_type_archive( 'recipe' ) ) { |
|
813 | - $description = \lsx_health_plan\functions\get_option( 'recipe_archive_description', '' ); |
|
814 | - } elseif ( is_post_type_archive( 'exercise' ) ) { |
|
815 | - $description = \lsx_health_plan\functions\get_option( 'exercise_archive_description', '' ); |
|
816 | - } elseif ( is_tax() ) { |
|
817 | - $description = get_the_archive_description(); |
|
818 | - } |
|
819 | - if ( '' !== $description ) { |
|
820 | - ?> |
|
811 | + $description = ''; |
|
812 | + if ( is_post_type_archive( 'recipe' ) ) { |
|
813 | + $description = \lsx_health_plan\functions\get_option( 'recipe_archive_description', '' ); |
|
814 | + } elseif ( is_post_type_archive( 'exercise' ) ) { |
|
815 | + $description = \lsx_health_plan\functions\get_option( 'exercise_archive_description', '' ); |
|
816 | + } elseif ( is_tax() ) { |
|
817 | + $description = get_the_archive_description(); |
|
818 | + } |
|
819 | + if ( '' !== $description ) { |
|
820 | + ?> |
|
821 | 821 | <div class="lsx-hp-archive-description row"> |
822 | 822 | <div class="col-xs-12 description-wrapper"><?php echo wp_kses_post( wpautop( $description ) ); ?></div> |
823 | 823 | </div> |
824 | 824 | <?php |
825 | - } |
|
825 | + } |
|
826 | 826 | } |
827 | 827 | |
828 | 828 | /** |
@@ -831,23 +831,23 @@ discard block |
||
831 | 831 | * @return void |
832 | 832 | */ |
833 | 833 | function lsx_health_plan_workout_main_content() { |
834 | - // Getting translated endpoint. |
|
835 | - $workout = \lsx_health_plan\functions\get_option( 'endpoint_workout', 'workout' ); |
|
836 | - |
|
837 | - $connected_members = get_post_meta( get_the_ID(), ( $workout . '_connected_team_member' ), true ); |
|
838 | - $small_description = get_post_meta( get_the_ID(), ( $workout . '_short_description' ), true ); |
|
839 | - |
|
840 | - $content = ''; |
|
841 | - if ( $small_description || $connected_members || lsx_health_plan_has_tips() ) { |
|
842 | - $content .= '<div class="short-desc set-box set content-box entry-content">'; |
|
843 | - $content .= '<div class="the-content">'; |
|
844 | - $content .= lsx_hp_member_connected( $connected_members, $workout ); |
|
845 | - $content .= '<span>' . $small_description . '</span>'; |
|
846 | - $content .= '</div>'; |
|
847 | - $content .= do_shortcode( '[lsx_health_plan_featured_tips_block]' ); |
|
848 | - $content .= '</div>'; |
|
849 | - } |
|
850 | - return $content; |
|
834 | + // Getting translated endpoint. |
|
835 | + $workout = \lsx_health_plan\functions\get_option( 'endpoint_workout', 'workout' ); |
|
836 | + |
|
837 | + $connected_members = get_post_meta( get_the_ID(), ( $workout . '_connected_team_member' ), true ); |
|
838 | + $small_description = get_post_meta( get_the_ID(), ( $workout . '_short_description' ), true ); |
|
839 | + |
|
840 | + $content = ''; |
|
841 | + if ( $small_description || $connected_members || lsx_health_plan_has_tips() ) { |
|
842 | + $content .= '<div class="short-desc set-box set content-box entry-content">'; |
|
843 | + $content .= '<div class="the-content">'; |
|
844 | + $content .= lsx_hp_member_connected( $connected_members, $workout ); |
|
845 | + $content .= '<span>' . $small_description . '</span>'; |
|
846 | + $content .= '</div>'; |
|
847 | + $content .= do_shortcode( '[lsx_health_plan_featured_tips_block]' ); |
|
848 | + $content .= '</div>'; |
|
849 | + } |
|
850 | + return $content; |
|
851 | 851 | } |
852 | 852 | |
853 | 853 | /** |
@@ -856,23 +856,23 @@ discard block |
||
856 | 856 | * @return void |
857 | 857 | */ |
858 | 858 | function lsx_health_plan_meal_main_content() { |
859 | - // Getting translated endpoint. |
|
860 | - $meal = \lsx_health_plan\functions\get_option( 'endpoint_meal', 'meal' ); |
|
861 | - |
|
862 | - $connected_members = get_post_meta( get_the_ID(), ( $meal . '_connected_team_member' ), true ); |
|
863 | - $small_description = get_post_meta( get_the_ID(), ( $meal . '_short_description' ), true ); |
|
864 | - |
|
865 | - $content_meal = ''; |
|
866 | - if ( $small_description || $connected_members || lsx_health_plan_has_tips() ) { |
|
867 | - $content_meal .= '<div class="set-box set content-box entry-content">'; |
|
868 | - $content_meal .= '<div class="the-content">'; |
|
869 | - $content_meal .= lsx_hp_member_connected( $connected_members, $meal ); |
|
870 | - $content_meal .= '<span>' . $small_description . '</span>'; |
|
871 | - $content_meal .= '</div>'; |
|
872 | - $content_meal .= do_shortcode( '[lsx_health_plan_featured_tips_block]' ); |
|
873 | - $content_meal .= '</div>'; |
|
874 | - } |
|
875 | - return $content_meal; |
|
859 | + // Getting translated endpoint. |
|
860 | + $meal = \lsx_health_plan\functions\get_option( 'endpoint_meal', 'meal' ); |
|
861 | + |
|
862 | + $connected_members = get_post_meta( get_the_ID(), ( $meal . '_connected_team_member' ), true ); |
|
863 | + $small_description = get_post_meta( get_the_ID(), ( $meal . '_short_description' ), true ); |
|
864 | + |
|
865 | + $content_meal = ''; |
|
866 | + if ( $small_description || $connected_members || lsx_health_plan_has_tips() ) { |
|
867 | + $content_meal .= '<div class="set-box set content-box entry-content">'; |
|
868 | + $content_meal .= '<div class="the-content">'; |
|
869 | + $content_meal .= lsx_hp_member_connected( $connected_members, $meal ); |
|
870 | + $content_meal .= '<span>' . $small_description . '</span>'; |
|
871 | + $content_meal .= '</div>'; |
|
872 | + $content_meal .= do_shortcode( '[lsx_health_plan_featured_tips_block]' ); |
|
873 | + $content_meal .= '</div>'; |
|
874 | + } |
|
875 | + return $content_meal; |
|
876 | 876 | } |
877 | 877 | |
878 | 878 | |
@@ -883,36 +883,36 @@ discard block |
||
883 | 883 | * @return void |
884 | 884 | */ |
885 | 885 | function lsx_health_plan_workout_tab_content( $index = 1 ) { |
886 | - global $group_name,$shortcode_args; |
|
887 | - $group_name = 'workout_section_' . $index; |
|
888 | - if ( false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) { |
|
889 | - $layout = strtolower( \lsx_health_plan\functions\get_option( 'workout_tab_layout', 'table' ) ); |
|
890 | - |
|
891 | - // Check for shortcode overrides. |
|
892 | - if ( null !== $shortcode_args && isset( $shortcode_args['layout'] ) ) { |
|
893 | - $layout = $shortcode_args['layout']; |
|
894 | - } |
|
895 | - } else { |
|
896 | - $layout = 'table'; |
|
897 | - } |
|
898 | - |
|
899 | - switch ( $layout ) { |
|
900 | - case 'list': |
|
901 | - $tab_template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-list.php'; |
|
902 | - break; |
|
903 | - |
|
904 | - case 'grid': |
|
905 | - $tab_template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-grid.php'; |
|
906 | - break; |
|
907 | - |
|
908 | - case 'table': |
|
909 | - $tab_template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-table.php'; |
|
910 | - break; |
|
911 | - } |
|
912 | - $tab_template_path = apply_filters( 'lsx_health_plan_workout_tab_content_path', $tab_template_path ); |
|
913 | - if ( '' !== $tab_template_path ) { |
|
914 | - include $tab_template_path; |
|
915 | - } |
|
886 | + global $group_name,$shortcode_args; |
|
887 | + $group_name = 'workout_section_' . $index; |
|
888 | + if ( false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) { |
|
889 | + $layout = strtolower( \lsx_health_plan\functions\get_option( 'workout_tab_layout', 'table' ) ); |
|
890 | + |
|
891 | + // Check for shortcode overrides. |
|
892 | + if ( null !== $shortcode_args && isset( $shortcode_args['layout'] ) ) { |
|
893 | + $layout = $shortcode_args['layout']; |
|
894 | + } |
|
895 | + } else { |
|
896 | + $layout = 'table'; |
|
897 | + } |
|
898 | + |
|
899 | + switch ( $layout ) { |
|
900 | + case 'list': |
|
901 | + $tab_template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-list.php'; |
|
902 | + break; |
|
903 | + |
|
904 | + case 'grid': |
|
905 | + $tab_template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-grid.php'; |
|
906 | + break; |
|
907 | + |
|
908 | + case 'table': |
|
909 | + $tab_template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-table.php'; |
|
910 | + break; |
|
911 | + } |
|
912 | + $tab_template_path = apply_filters( 'lsx_health_plan_workout_tab_content_path', $tab_template_path ); |
|
913 | + if ( '' !== $tab_template_path ) { |
|
914 | + include $tab_template_path; |
|
915 | + } |
|
916 | 916 | } |
917 | 917 | |
918 | 918 | /** |
@@ -921,28 +921,28 @@ discard block |
||
921 | 921 | * @return void |
922 | 922 | */ |
923 | 923 | function lsx_health_plan_workout_sets() { |
924 | - if ( is_singular( 'workout' ) ) { |
|
925 | - global $connected_workouts; |
|
926 | - $connected_workouts = array( get_the_ID() ); |
|
927 | - } |
|
928 | - if ( is_singular( 'plan' ) ) { |
|
929 | - |
|
930 | - global $connected_workouts; |
|
931 | - |
|
932 | - $section_key = get_query_var( 'section' ); |
|
933 | - if ( '' !== $section && \lsx_health_plan\functions\plan\has_sections() ) { |
|
934 | - $section_info = \lsx_health_plan\functions\plan\get_section_info( $section_key ); |
|
935 | - if ( isset( $section_info['connected_workouts'] ) && '' !== $section_info['connected_workouts'] ) { |
|
936 | - |
|
937 | - $connected_workouts = \lsx_health_plan\functions\prep_array( $section_info['connected_workouts'] ); |
|
938 | - } |
|
939 | - } |
|
940 | - } |
|
941 | - $template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-sets.php'; |
|
942 | - $template_path = apply_filters( 'lsx_health_plan_workout_set_template_path', $template_path ); |
|
943 | - if ( '' !== $template_path && ! empty( $template_path ) ) { |
|
944 | - include $template_path; |
|
945 | - } |
|
924 | + if ( is_singular( 'workout' ) ) { |
|
925 | + global $connected_workouts; |
|
926 | + $connected_workouts = array( get_the_ID() ); |
|
927 | + } |
|
928 | + if ( is_singular( 'plan' ) ) { |
|
929 | + |
|
930 | + global $connected_workouts; |
|
931 | + |
|
932 | + $section_key = get_query_var( 'section' ); |
|
933 | + if ( '' !== $section && \lsx_health_plan\functions\plan\has_sections() ) { |
|
934 | + $section_info = \lsx_health_plan\functions\plan\get_section_info( $section_key ); |
|
935 | + if ( isset( $section_info['connected_workouts'] ) && '' !== $section_info['connected_workouts'] ) { |
|
936 | + |
|
937 | + $connected_workouts = \lsx_health_plan\functions\prep_array( $section_info['connected_workouts'] ); |
|
938 | + } |
|
939 | + } |
|
940 | + } |
|
941 | + $template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-sets.php'; |
|
942 | + $template_path = apply_filters( 'lsx_health_plan_workout_set_template_path', $template_path ); |
|
943 | + if ( '' !== $template_path && ! empty( $template_path ) ) { |
|
944 | + include $template_path; |
|
945 | + } |
|
946 | 946 | } |
947 | 947 | |
948 | 948 | /** |
@@ -953,11 +953,11 @@ discard block |
||
953 | 953 | */ |
954 | 954 | function lsx_health_plan_warmup_sets( $connected_workouts ) { |
955 | 955 | |
956 | - $template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-sets.php'; |
|
957 | - $template_path = apply_filters( 'lsx_health_plan_workout_set_template_path', $template_path ); |
|
958 | - if ( '' !== $template_path && ! empty( $template_path ) ) { |
|
959 | - include $template_path; |
|
960 | - } |
|
956 | + $template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-sets.php'; |
|
957 | + $template_path = apply_filters( 'lsx_health_plan_workout_set_template_path', $template_path ); |
|
958 | + if ( '' !== $template_path && ! empty( $template_path ) ) { |
|
959 | + include $template_path; |
|
960 | + } |
|
961 | 961 | } |
962 | 962 | |
963 | 963 | /** |
@@ -967,48 +967,48 @@ discard block |
||
967 | 967 | * @return void |
968 | 968 | */ |
969 | 969 | function lsx_hp_meal_plan_recipes( $args = array() ) { |
970 | - $defaults = array( |
|
971 | - 'meal_id' => false, |
|
972 | - 'meal_time' => '', |
|
973 | - 'modal' => true, |
|
974 | - ); |
|
975 | - $args = wp_parse_args( $args, $defaults ); |
|
976 | - // Looking for recipes. |
|
977 | - $connected_recipes = get_post_meta( $args['meal_id'], $args['meal_time'] . '_recipes', true ); |
|
978 | - if ( ! empty( $connected_recipes ) ) { |
|
979 | - $query_args = array( |
|
980 | - 'orderby' => 'date', |
|
981 | - 'order' => 'DESC', |
|
982 | - 'post_type' => 'recipe', |
|
983 | - 'post__in' => $connected_recipes, |
|
984 | - ); |
|
985 | - $recipes = new WP_Query( $query_args ); |
|
986 | - ?> |
|
970 | + $defaults = array( |
|
971 | + 'meal_id' => false, |
|
972 | + 'meal_time' => '', |
|
973 | + 'modal' => true, |
|
974 | + ); |
|
975 | + $args = wp_parse_args( $args, $defaults ); |
|
976 | + // Looking for recipes. |
|
977 | + $connected_recipes = get_post_meta( $args['meal_id'], $args['meal_time'] . '_recipes', true ); |
|
978 | + if ( ! empty( $connected_recipes ) ) { |
|
979 | + $query_args = array( |
|
980 | + 'orderby' => 'date', |
|
981 | + 'order' => 'DESC', |
|
982 | + 'post_type' => 'recipe', |
|
983 | + 'post__in' => $connected_recipes, |
|
984 | + ); |
|
985 | + $recipes = new WP_Query( $query_args ); |
|
986 | + ?> |
|
987 | 987 | <div class="recipes"> |
988 | 988 | <div class="row eating-row"> |
989 | 989 | <?php |
990 | - if ( $recipes->have_posts() ) { |
|
991 | - while ( $recipes->have_posts() ) { |
|
992 | - $recipes->the_post(); |
|
993 | - if ( false !== $args['modal'] ) { |
|
994 | - \lsx_health_plan\functions\recipes\register_recipe_modal(); |
|
995 | - } |
|
996 | - ?> |
|
990 | + if ( $recipes->have_posts() ) { |
|
991 | + while ( $recipes->have_posts() ) { |
|
992 | + $recipes->the_post(); |
|
993 | + if ( false !== $args['modal'] ) { |
|
994 | + \lsx_health_plan\functions\recipes\register_recipe_modal(); |
|
995 | + } |
|
996 | + ?> |
|
997 | 997 | <div class="recipe-column"> |
998 | 998 | <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"> |
999 | 999 | <div class="recipe-feature-img"> |
1000 | 1000 | <?php |
1001 | - $featured_image = get_the_post_thumbnail(); |
|
1002 | - if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
1003 | - the_post_thumbnail( 'lsx-thumbnail-square', array( |
|
1004 | - 'class' => 'aligncenter', |
|
1005 | - ) ); |
|
1006 | - } else { |
|
1007 | - ?> |
|
1001 | + $featured_image = get_the_post_thumbnail(); |
|
1002 | + if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
1003 | + the_post_thumbnail( 'lsx-thumbnail-square', array( |
|
1004 | + 'class' => 'aligncenter', |
|
1005 | + ) ); |
|
1006 | + } else { |
|
1007 | + ?> |
|
1008 | 1008 | <img loading="lazy" class="placeholder" src="<?php echo esc_attr( plugin_dir_url( __DIR__ ) . 'assets/images/placeholder.jpg' ); ?>"> |
1009 | 1009 | <?php |
1010 | - } |
|
1011 | - ?> |
|
1010 | + } |
|
1011 | + ?> |
|
1012 | 1012 | </div> |
1013 | 1013 | <div class="recipe-content"> |
1014 | 1014 | <h3 class="recipe-title"><?php the_title(); ?></h3> |
@@ -1017,41 +1017,41 @@ discard block |
||
1017 | 1017 | </a> |
1018 | 1018 | </div> |
1019 | 1019 | <?php |
1020 | - } |
|
1021 | - } |
|
1022 | - wp_reset_postdata(); |
|
1023 | - ?> |
|
1020 | + } |
|
1021 | + } |
|
1022 | + wp_reset_postdata(); |
|
1023 | + ?> |
|
1024 | 1024 | </div> |
1025 | 1025 | </div> |
1026 | 1026 | <?php |
1027 | 1027 | |
1028 | - } |
|
1028 | + } |
|
1029 | 1029 | } |
1030 | 1030 | |
1031 | 1031 | /** |
1032 | 1032 | * Output the connected. |
1033 | 1033 | */ |
1034 | 1034 | function lsx_hp_recipe_plan_meta( $args = array() ) { |
1035 | - $defaults = array(); |
|
1036 | - $top_level_plans = array(); |
|
1037 | - // Get meals this exercise is connected to. |
|
1038 | - $plans = get_post_meta( get_the_ID(), 'connected_plans', true ); |
|
1039 | - if ( ! empty( $plans ) ) { |
|
1040 | - $plan = end( $plans ); |
|
1041 | - $has_parent = wp_get_post_parent_id( $plan ); |
|
1042 | - if ( 0 === $has_parent ) { |
|
1043 | - $top_level_plans[] = $plan; |
|
1044 | - } elseif ( false !== $top_level_plans ) { |
|
1045 | - $top_level_plans[] = $has_parent; |
|
1046 | - } |
|
1047 | - } |
|
1048 | - if ( ! empty( $top_level_plans ) && ( '' !== $top_level_plans ) ) { |
|
1049 | - $top_level_plans = array_unique( $top_level_plans ); |
|
1050 | - $top_level_plan = end( $top_level_plans ); |
|
1051 | - ?> |
|
1035 | + $defaults = array(); |
|
1036 | + $top_level_plans = array(); |
|
1037 | + // Get meals this exercise is connected to. |
|
1038 | + $plans = get_post_meta( get_the_ID(), 'connected_plans', true ); |
|
1039 | + if ( ! empty( $plans ) ) { |
|
1040 | + $plan = end( $plans ); |
|
1041 | + $has_parent = wp_get_post_parent_id( $plan ); |
|
1042 | + if ( 0 === $has_parent ) { |
|
1043 | + $top_level_plans[] = $plan; |
|
1044 | + } elseif ( false !== $top_level_plans ) { |
|
1045 | + $top_level_plans[] = $has_parent; |
|
1046 | + } |
|
1047 | + } |
|
1048 | + if ( ! empty( $top_level_plans ) && ( '' !== $top_level_plans ) ) { |
|
1049 | + $top_level_plans = array_unique( $top_level_plans ); |
|
1050 | + $top_level_plan = end( $top_level_plans ); |
|
1051 | + ?> |
|
1052 | 1052 | <span class="recipe-type recipe-parent"><?php echo esc_html( get_the_title( $top_level_plan ) ); ?></span> |
1053 | 1053 | <?php |
1054 | - } |
|
1054 | + } |
|
1055 | 1055 | } |
1056 | 1056 | |
1057 | 1057 | /** |
@@ -1059,42 +1059,42 @@ discard block |
||
1059 | 1059 | */ |
1060 | 1060 | function lsx_hp_exercise_plan_meta() { |
1061 | 1061 | |
1062 | - $top_level_plans = array(); |
|
1063 | - |
|
1064 | - // Get workouts this exercise is connected to. |
|
1065 | - $workouts = get_post_meta( get_the_ID(), 'connected_workouts', true ); |
|
1066 | - |
|
1067 | - if ( '' !== $workouts && ! is_array( $workouts ) ) { |
|
1068 | - $workouts = array( $workouts ); |
|
1069 | - } |
|
1070 | - if ( ! empty( $workouts ) ) { |
|
1071 | - foreach ( $workouts as $workout ) { |
|
1072 | - // Get the plans this workout is connected to. |
|
1073 | - $plans = get_post_meta( $workout, 'connected_plans', true ); |
|
1074 | - |
|
1075 | - if ( '' !== $plans && ! is_array( $plans ) ) { |
|
1076 | - $plans = array( $plans ); |
|
1077 | - } |
|
1078 | - if ( ! empty( $plans ) ) { |
|
1079 | - foreach ( $plans as $plan ) { |
|
1080 | - $has_parent = wp_get_post_parent_id( $plan ); |
|
1081 | - if ( 0 === $has_parent ) { |
|
1082 | - $top_level_plans = $plan; |
|
1083 | - } else { |
|
1084 | - $top_level_plans = $has_parent; |
|
1085 | - } |
|
1086 | - } |
|
1087 | - } |
|
1088 | - } |
|
1089 | - } |
|
1090 | - |
|
1091 | - if ( ! empty( $top_level_plans ) && ( '' !== $top_level_plans ) ) { |
|
1092 | - $top_level_plans = array_unique( $top_level_plans ); |
|
1093 | - $top_level_plan = end( $top_level_plans ); |
|
1094 | - ?> |
|
1062 | + $top_level_plans = array(); |
|
1063 | + |
|
1064 | + // Get workouts this exercise is connected to. |
|
1065 | + $workouts = get_post_meta( get_the_ID(), 'connected_workouts', true ); |
|
1066 | + |
|
1067 | + if ( '' !== $workouts && ! is_array( $workouts ) ) { |
|
1068 | + $workouts = array( $workouts ); |
|
1069 | + } |
|
1070 | + if ( ! empty( $workouts ) ) { |
|
1071 | + foreach ( $workouts as $workout ) { |
|
1072 | + // Get the plans this workout is connected to. |
|
1073 | + $plans = get_post_meta( $workout, 'connected_plans', true ); |
|
1074 | + |
|
1075 | + if ( '' !== $plans && ! is_array( $plans ) ) { |
|
1076 | + $plans = array( $plans ); |
|
1077 | + } |
|
1078 | + if ( ! empty( $plans ) ) { |
|
1079 | + foreach ( $plans as $plan ) { |
|
1080 | + $has_parent = wp_get_post_parent_id( $plan ); |
|
1081 | + if ( 0 === $has_parent ) { |
|
1082 | + $top_level_plans = $plan; |
|
1083 | + } else { |
|
1084 | + $top_level_plans = $has_parent; |
|
1085 | + } |
|
1086 | + } |
|
1087 | + } |
|
1088 | + } |
|
1089 | + } |
|
1090 | + |
|
1091 | + if ( ! empty( $top_level_plans ) && ( '' !== $top_level_plans ) ) { |
|
1092 | + $top_level_plans = array_unique( $top_level_plans ); |
|
1093 | + $top_level_plan = end( $top_level_plans ); |
|
1094 | + ?> |
|
1095 | 1095 | <span class="recipe-type recipe-parent"><?php echo esc_html( get_the_title( $top_level_plan ) ); ?></span> |
1096 | 1096 | <?php |
1097 | - } |
|
1097 | + } |
|
1098 | 1098 | } |
1099 | 1099 | |
1100 | 1100 | /** |
@@ -1104,7 +1104,7 @@ discard block |
||
1104 | 1104 | * @return void |
1105 | 1105 | */ |
1106 | 1106 | function lsx_hp_single_related( $related_content, $post_type_text ) { |
1107 | - ?> |
|
1107 | + ?> |
|
1108 | 1108 | <section id="lsx-hp-related"> |
1109 | 1109 | <div class="row lsx-related-posts lsx-related-posts-title"> |
1110 | 1110 | <div class="col-xs-12"> |
@@ -1115,14 +1115,14 @@ discard block |
||
1115 | 1115 | <div class="col-xs-12"> |
1116 | 1116 | <div class="lsx-related-posts-wrapper"> |
1117 | 1117 | <?php |
1118 | - $i = 0; |
|
1119 | - foreach ( $related_content as $article ) { |
|
1120 | - $post_title = get_the_title( $article ); |
|
1121 | - $post_categories = wp_get_post_categories( $article ); |
|
1122 | - $post_link = get_permalink( $article ); |
|
1123 | - |
|
1124 | - $cats = array(); |
|
1125 | - ?> |
|
1118 | + $i = 0; |
|
1119 | + foreach ( $related_content as $article ) { |
|
1120 | + $post_title = get_the_title( $article ); |
|
1121 | + $post_categories = wp_get_post_categories( $article ); |
|
1122 | + $post_link = get_permalink( $article ); |
|
1123 | + |
|
1124 | + $cats = array(); |
|
1125 | + ?> |
|
1126 | 1126 | <article id="post-<?php echo esc_html( $article ); ?>" class="lsx-slot post"> |
1127 | 1127 | <div class="entry-layout lsx-hp-shadow"> |
1128 | 1128 | <div class="entry-layout-content"> |
@@ -1130,25 +1130,25 @@ discard block |
||
1130 | 1130 | <div class="entry-image"> |
1131 | 1131 | <a href="<?php echo esc_url( $post_link ); ?>" class="thumbnail"> |
1132 | 1132 | <?php |
1133 | - $featured_image = get_the_post_thumbnail( $article, 'lsx-thumbnail-wide' ); |
|
1134 | - if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
1135 | - echo wp_kses_post( $featured_image ); |
|
1136 | - } else { |
|
1137 | - ?> |
|
1133 | + $featured_image = get_the_post_thumbnail( $article, 'lsx-thumbnail-wide' ); |
|
1134 | + if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
1135 | + echo wp_kses_post( $featured_image ); |
|
1136 | + } else { |
|
1137 | + ?> |
|
1138 | 1138 | <img loading="lazy" class="placeholder" src="<?php echo esc_attr( plugin_dir_url( __FILE__ ) . '../assets/images/placeholder.jpg' ); ?>"> |
1139 | 1139 | <?php |
1140 | - } |
|
1141 | - ?> |
|
1140 | + } |
|
1141 | + ?> |
|
1142 | 1142 | </a> |
1143 | 1143 | </div> |
1144 | 1144 | <div class="entry-meta"> |
1145 | 1145 | <?php |
1146 | - foreach ( $post_categories as $c ) { |
|
1147 | - $cat = get_category( $c ); |
|
1148 | - /* Translators: %s: category name */ |
|
1149 | - $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>'; |
|
1150 | - } |
|
1151 | - if ( ! empty( $cats ) ) { ?> |
|
1146 | + foreach ( $post_categories as $c ) { |
|
1147 | + $cat = get_category( $c ); |
|
1148 | + /* Translators: %s: category name */ |
|
1149 | + $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>'; |
|
1150 | + } |
|
1151 | + if ( ! empty( $cats ) ) { ?> |
|
1152 | 1152 | <div class="post-categories"><span></span><?php echo wp_kses_post( implode( ', ', $cats ) ); ?></div> |
1153 | 1153 | <?php } ?> |
1154 | 1154 | </div> |
@@ -1163,8 +1163,8 @@ discard block |
||
1163 | 1163 | </article> |
1164 | 1164 | |
1165 | 1165 | <?php |
1166 | - if (++$i === 3) break; |
|
1167 | - } ?> |
|
1166 | + if (++$i === 3) break; |
|
1167 | + } ?> |
|
1168 | 1168 | </div> |
1169 | 1169 | </div> |
1170 | 1170 | </div> |
@@ -1179,32 +1179,32 @@ discard block |
||
1179 | 1179 | * @return void |
1180 | 1180 | */ |
1181 | 1181 | function lsx_hp_member_connected( $connected_members, $post_type ) { |
1182 | - if ( ! empty( $connected_members ) ) { |
|
1183 | - $content = '<div id="hp-connected-members" class="hp-connected-members connected-' . $post_type . '">'; |
|
1184 | - foreach ( $connected_members as $member ) { |
|
1185 | - $post_link = get_permalink( $member ); |
|
1186 | - $member_name = get_the_title( $member ); |
|
1187 | - $member_name = '<span class="lsx-team-name">' . $member_name . '</span>'; |
|
1188 | - |
|
1189 | - $member_link = '<a href="' . $post_link . '" >' . $member_name . '</a>'; |
|
1190 | - |
|
1191 | - $roles = ''; |
|
1192 | - $terms = get_the_terms( $member, 'team_role' ); |
|
1193 | - |
|
1194 | - if ( $terms && ! is_wp_error( $terms ) ) { |
|
1195 | - $roles = array(); |
|
1196 | - |
|
1197 | - foreach ( $terms as $term ) { |
|
1198 | - $roles[] = $term->name; |
|
1199 | - } |
|
1200 | - |
|
1201 | - $roles = join( ', ', $roles ); |
|
1202 | - } |
|
1203 | - $member_roles = '' !== $roles ? "<small class='lsx-team-roles'>$roles</small>" : ''; |
|
1204 | - |
|
1205 | - $content .= '<p>' . $member_roles . ': ' . $member_link . '</p>'; |
|
1206 | - } |
|
1207 | - $content .= '</div>'; |
|
1208 | - return $content; |
|
1209 | - } |
|
1182 | + if ( ! empty( $connected_members ) ) { |
|
1183 | + $content = '<div id="hp-connected-members" class="hp-connected-members connected-' . $post_type . '">'; |
|
1184 | + foreach ( $connected_members as $member ) { |
|
1185 | + $post_link = get_permalink( $member ); |
|
1186 | + $member_name = get_the_title( $member ); |
|
1187 | + $member_name = '<span class="lsx-team-name">' . $member_name . '</span>'; |
|
1188 | + |
|
1189 | + $member_link = '<a href="' . $post_link . '" >' . $member_name . '</a>'; |
|
1190 | + |
|
1191 | + $roles = ''; |
|
1192 | + $terms = get_the_terms( $member, 'team_role' ); |
|
1193 | + |
|
1194 | + if ( $terms && ! is_wp_error( $terms ) ) { |
|
1195 | + $roles = array(); |
|
1196 | + |
|
1197 | + foreach ( $terms as $term ) { |
|
1198 | + $roles[] = $term->name; |
|
1199 | + } |
|
1200 | + |
|
1201 | + $roles = join( ', ', $roles ); |
|
1202 | + } |
|
1203 | + $member_roles = '' !== $roles ? "<small class='lsx-team-roles'>$roles</small>" : ''; |
|
1204 | + |
|
1205 | + $content .= '<p>' . $member_roles . ': ' . $member_link . '</p>'; |
|
1206 | + } |
|
1207 | + $content .= '</div>'; |
|
1208 | + return $content; |
|
1209 | + } |
|
1210 | 1210 | } |
@@ -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,25 +166,25 @@ discard block |
||
166 | 166 | <ul class="nav nav-pills"> |
167 | 167 | <li class=" |
168 | 168 | <?php |
169 | - if ( ( function_exists( 'is_wc_endpoint_url' ) && ! is_wc_endpoint_url( 'edit-account' ) ) || ! function_exists( 'is_wc_endpoint_url' ) ) { |
|
170 | - echo esc_attr( 'active' ); |
|
169 | + if ((function_exists('is_wc_endpoint_url') && ! is_wc_endpoint_url('edit-account')) || ! function_exists('is_wc_endpoint_url')) { |
|
170 | + echo esc_attr('active'); |
|
171 | 171 | } |
172 | 172 | ?> |
173 | - "><a class="my-plan-tab" href="<?php the_permalink(); ?>"><?php esc_html_e( 'My Plans', 'lsx-health-plan' ); ?></a></li> |
|
173 | + "><a class="my-plan-tab" href="<?php the_permalink(); ?>"><?php esc_html_e('My Plans', 'lsx-health-plan'); ?></a></li> |
|
174 | 174 | <?php |
175 | - if ( function_exists( 'WC' ) ) { |
|
175 | + if (function_exists('WC')) { |
|
176 | 176 | ?> |
177 | 177 | <li class=" |
178 | 178 | <?php |
179 | - if ( function_exists( 'is_wc_endpoint_url' ) && is_wc_endpoint_url( 'edit-account' ) ) { |
|
180 | - echo esc_attr( 'active' ); |
|
179 | + if (function_exists('is_wc_endpoint_url') && is_wc_endpoint_url('edit-account')) { |
|
180 | + echo esc_attr('active'); |
|
181 | 181 | } |
182 | 182 | ?> |
183 | - "><a class="account-details-tab" href="<?php the_permalink(); ?>edit-account/"><?php esc_html_e( 'Account Details', 'lsx-health-plan' ); ?></a></li> |
|
183 | + "><a class="account-details-tab" href="<?php the_permalink(); ?>edit-account/"><?php esc_html_e('Account Details', 'lsx-health-plan'); ?></a></li> |
|
184 | 184 | <?php |
185 | 185 | } |
186 | 186 | ?> |
187 | - <li class=""><a class="logout-tab" href="<?php echo esc_url( wp_logout_url( get_permalink() ) ); ?>"><?php esc_html_e( 'Logout', 'lsx-health-plan' ); ?></a></li> |
|
187 | + <li class=""><a class="logout-tab" href="<?php echo esc_url(wp_logout_url(get_permalink())); ?>"><?php esc_html_e('Logout', 'lsx-health-plan'); ?></a></li> |
|
188 | 188 | </ul> |
189 | 189 | </div> |
190 | 190 | <?php |
@@ -199,84 +199,84 @@ discard block |
||
199 | 199 | ?> |
200 | 200 | <div class="lsx-health-plan my-profile-block wp-block-cover alignfull"> |
201 | 201 | <div class="wp-block-cover__inner-container"> |
202 | - <h2><?php esc_html_e( 'My Dashboard', 'lsx-health-plan' ); ?></h2> |
|
203 | - <?php if ( function_exists( 'WC' ) || class_exists( 'WP_User_Avatar_Setup' ) ) { ?> |
|
202 | + <h2><?php esc_html_e('My Dashboard', 'lsx-health-plan'); ?></h2> |
|
203 | + <?php if (function_exists('WC') || class_exists('WP_User_Avatar_Setup')) { ?> |
|
204 | 204 | <section id="dashboard-card"> |
205 | - <?php if ( function_exists( 'WC' ) || class_exists( 'WP_User_Avatar_Setup' ) ) { ?> |
|
205 | + <?php if (function_exists('WC') || class_exists('WP_User_Avatar_Setup')) { ?> |
|
206 | 206 | <div class="profile-navigation"> |
207 | 207 | <div class="profile-photo"> |
208 | 208 | <?php |
209 | 209 | global $current_user; |
210 | - if ( function_exists( 'WC' ) ) { |
|
210 | + if (function_exists('WC')) { |
|
211 | 211 | get_current_user(); |
212 | 212 | } |
213 | - if ( class_exists( 'WP_User_Avatar_Setup' ) ) { |
|
214 | - echo get_avatar( $current_user->ID, 240 ); |
|
213 | + if (class_exists('WP_User_Avatar_Setup')) { |
|
214 | + echo get_avatar($current_user->ID, 240); |
|
215 | 215 | } |
216 | 216 | ?> |
217 | 217 | </div> |
218 | 218 | </div> |
219 | 219 | <?php } ?> |
220 | - <?php if ( function_exists( 'WC' ) ) { ?> |
|
220 | + <?php if (function_exists('WC')) { ?> |
|
221 | 221 | <div class="profile-details"> |
222 | - <h1 class="title-lined has-text-color"><?php echo esc_html( $current_user->display_name ); ?></h1> |
|
222 | + <h1 class="title-lined has-text-color"><?php echo esc_html($current_user->display_name); ?></h1> |
|
223 | 223 | <?php |
224 | - $disable_stats = \lsx_health_plan\functions\get_option( 'disable_all_stats', false ); |
|
225 | - if ( 'on' !== $disable_stats && function_exists( 'WC' ) ) { |
|
224 | + $disable_stats = \lsx_health_plan\functions\get_option('disable_all_stats', false); |
|
225 | + if ('on' !== $disable_stats && function_exists('WC')) { |
|
226 | 226 | |
227 | - $is_weight_disabled = \lsx_health_plan\functions\get_option( 'disable_weight_checkbox', false ); |
|
228 | - $is_height_disabled = \lsx_health_plan\functions\get_option( 'disable_height_checkbox', false ); |
|
229 | - $is_waist_disabled = \lsx_health_plan\functions\get_option( 'disable_waist_checkbox', false ); |
|
230 | - $is_bmi_disabled = \lsx_health_plan\functions\get_option( 'disable_bmi_checkbox', false ); |
|
227 | + $is_weight_disabled = \lsx_health_plan\functions\get_option('disable_weight_checkbox', false); |
|
228 | + $is_height_disabled = \lsx_health_plan\functions\get_option('disable_height_checkbox', false); |
|
229 | + $is_waist_disabled = \lsx_health_plan\functions\get_option('disable_waist_checkbox', false); |
|
230 | + $is_bmi_disabled = \lsx_health_plan\functions\get_option('disable_bmi_checkbox', false); |
|
231 | 231 | |
232 | - $weight = get_user_meta( get_current_user_id(), 'weight', true ); |
|
233 | - $waist = get_user_meta( get_current_user_id(), 'waist', true ); |
|
234 | - $height = get_user_meta( get_current_user_id(), 'height', true ); |
|
232 | + $weight = get_user_meta(get_current_user_id(), 'weight', true); |
|
233 | + $waist = get_user_meta(get_current_user_id(), 'waist', true); |
|
234 | + $height = get_user_meta(get_current_user_id(), 'height', true); |
|
235 | 235 | |
236 | 236 | $height_m = 0; |
237 | - if ( is_numeric( $height ) ) { |
|
237 | + if (is_numeric($height)) { |
|
238 | 238 | $height_m = $height / 100; |
239 | 239 | } |
240 | 240 | |
241 | - if ( 1 < $weight && 1 < $height_m ) { |
|
242 | - $bmi = $weight / ( $height_m * $height_m ); |
|
243 | - $bmi = number_format( $bmi, 1 ); |
|
241 | + if (1 < $weight && 1 < $height_m) { |
|
242 | + $bmi = $weight / ($height_m * $height_m); |
|
243 | + $bmi = number_format($bmi, 1); |
|
244 | 244 | } else { |
245 | - $bmi = __( 'Add more data', 'lsx-health-plan' ); |
|
245 | + $bmi = __('Add more data', 'lsx-health-plan'); |
|
246 | 246 | } |
247 | 247 | |
248 | 248 | ?> |
249 | 249 | |
250 | 250 | <div> |
251 | - <?php if ( 'on' !== $is_weight_disabled ) { ?> |
|
252 | - <span><strong><?php esc_html_e( 'Weight:', 'lsx-health-plan' ); ?></strong> |
|
251 | + <?php if ('on' !== $is_weight_disabled) { ?> |
|
252 | + <span><strong><?php esc_html_e('Weight:', 'lsx-health-plan'); ?></strong> |
|
253 | 253 | <?php |
254 | - if ( '' !== $weight ) { |
|
255 | - echo wp_kses_post( $weight . ' kg' ); |
|
254 | + if ('' !== $weight) { |
|
255 | + echo wp_kses_post($weight . ' kg'); |
|
256 | 256 | } else { |
257 | 257 | echo '/'; |
258 | 258 | } |
259 | 259 | ?> |
260 | 260 | </span> |
261 | 261 | <?php } |
262 | - if ( 'on' !== $is_waist_disabled ) { |
|
262 | + if ('on' !== $is_waist_disabled) { |
|
263 | 263 | ?> |
264 | - <span><strong><?php esc_html_e( 'Waist:', 'lsx-health-plan' ); ?></strong> |
|
264 | + <span><strong><?php esc_html_e('Waist:', 'lsx-health-plan'); ?></strong> |
|
265 | 265 | <?php |
266 | - if ( '' !== $waist ) { |
|
267 | - echo wp_kses_post( $waist . ' cm' ); |
|
266 | + if ('' !== $waist) { |
|
267 | + echo wp_kses_post($waist . ' cm'); |
|
268 | 268 | } else { |
269 | 269 | echo '/'; |
270 | 270 | } |
271 | 271 | ?> |
272 | 272 | </span> |
273 | 273 | <?php } |
274 | - if ( 'on' !== $is_bmi_disabled ) { |
|
274 | + if ('on' !== $is_bmi_disabled) { |
|
275 | 275 | ?> |
276 | - <span><strong><?php esc_html_e( 'BMI:', 'lsx-health-plan' ); ?></strong> |
|
276 | + <span><strong><?php esc_html_e('BMI:', 'lsx-health-plan'); ?></strong> |
|
277 | 277 | <?php |
278 | - if ( '' !== $bmi ) { |
|
279 | - echo wp_kses_post( $bmi ); |
|
278 | + if ('' !== $bmi) { |
|
279 | + echo wp_kses_post($bmi); |
|
280 | 280 | } else { |
281 | 281 | echo '/'; |
282 | 282 | } |
@@ -288,17 +288,17 @@ discard block |
||
288 | 288 | } |
289 | 289 | |
290 | 290 | // Only display the edit account link if woocommerce is active. |
291 | - if ( function_exists( 'WC' ) ) { |
|
291 | + if (function_exists('WC')) { |
|
292 | 292 | ?> |
293 | 293 | <div class="edit-profile"> |
294 | 294 | <?php |
295 | - if ( function_exists( 'wc_get_page_id' ) ) { |
|
296 | - $url_id = wc_get_page_id( 'myaccount' ); |
|
295 | + if (function_exists('wc_get_page_id')) { |
|
296 | + $url_id = wc_get_page_id('myaccount'); |
|
297 | 297 | } else { |
298 | 298 | $url_id = ''; |
299 | 299 | } |
300 | 300 | ?> |
301 | - <a href="<?php echo esc_url( get_permalink( $url_id ) ); ?>edit-account/"><?php esc_html_e( 'Edit', 'lsx-health-plan' ); ?></a> |
|
301 | + <a href="<?php echo esc_url(get_permalink($url_id)); ?>edit-account/"><?php esc_html_e('Edit', 'lsx-health-plan'); ?></a> |
|
302 | 302 | </div> |
303 | 303 | <?php |
304 | 304 | } |
@@ -328,9 +328,9 @@ discard block |
||
328 | 328 | 'post_parent' => 0, |
329 | 329 | ); |
330 | 330 | |
331 | - if ( function_exists( '\lsx_health_plan\functions\woocommerce\get_membership_products' ) ) { |
|
331 | + if (function_exists('\lsx_health_plan\functions\woocommerce\get_membership_products')) { |
|
332 | 332 | $product_ids = \lsx_health_plan\functions\woocommerce\get_membership_products(); |
333 | - if ( ! empty( $product_ids ) ) { |
|
333 | + if ( ! empty($product_ids)) { |
|
334 | 334 | $args['meta_query'] = array( |
335 | 335 | 'relation' => 'OR', |
336 | 336 | array( |
@@ -346,82 +346,82 @@ discard block |
||
346 | 346 | } |
347 | 347 | } |
348 | 348 | |
349 | - $the_query = new WP_Query( $args ); |
|
349 | + $the_query = new WP_Query($args); |
|
350 | 350 | ?> |
351 | 351 | <div class="all-plans-block plan-grid block-all-plans-block"> |
352 | 352 | <div class="row"> |
353 | 353 | <?php |
354 | - if ( $the_query->have_posts() ) : |
|
355 | - while ( $the_query->have_posts() ) : |
|
354 | + if ($the_query->have_posts()) : |
|
355 | + while ($the_query->have_posts()) : |
|
356 | 356 | $the_query->the_post(); |
357 | 357 | lsx_entry_before(); |
358 | 358 | $completed_class = ''; |
359 | 359 | $linked_product = false; |
360 | 360 | $restricted = false; |
361 | 361 | $product = null; |
362 | - if ( function_exists( 'lsx_health_plan\functions\woocommerce\plan_has_products' ) && \lsx_health_plan\functions\woocommerce\plan_has_products() ) { |
|
362 | + if (function_exists('lsx_health_plan\functions\woocommerce\plan_has_products') && \lsx_health_plan\functions\woocommerce\plan_has_products()) { |
|
363 | 363 | $products = \lsx_health_plan\functions\woocommerce\get_plan_products(); |
364 | - $linked_product = wc_get_product( $products[0] ); |
|
364 | + $linked_product = wc_get_product($products[0]); |
|
365 | 365 | $product = $linked_product; |
366 | 366 | } |
367 | - if ( function_exists( 'wc_memberships_is_post_content_restricted' ) ) { |
|
368 | - $restricted = wc_memberships_is_post_content_restricted( get_the_ID() ) && ! current_user_can( 'wc_memberships_view_restricted_post_content', get_the_ID() ); |
|
367 | + if (function_exists('wc_memberships_is_post_content_restricted')) { |
|
368 | + $restricted = wc_memberships_is_post_content_restricted(get_the_ID()) && ! current_user_can('wc_memberships_view_restricted_post_content', get_the_ID()); |
|
369 | 369 | } |
370 | 370 | |
371 | - if ( lsx_health_plan_is_plan_complete() ) { |
|
371 | + if (lsx_health_plan_is_plan_complete()) { |
|
372 | 372 | $completed_class = 'completed'; |
373 | 373 | } |
374 | 374 | $round_progress = ''; |
375 | 375 | $completed_progress = '100'; |
376 | - if ( false === $restricted ) { |
|
377 | - $round_progress = round( \lsx_health_plan\functions\get_progress( get_the_ID() ), 0 ); |
|
376 | + if (false === $restricted) { |
|
377 | + $round_progress = round(\lsx_health_plan\functions\get_progress(get_the_ID()), 0); |
|
378 | 378 | } |
379 | 379 | ?> |
380 | 380 | <div class="col-xs-12 col-sm-6 col-md-4"> |
381 | - <article class="lsx-slot lsx-hp-shadow <?php echo esc_html( 'progress-') . $round_progress; ?>"> |
|
381 | + <article class="lsx-slot lsx-hp-shadow <?php echo esc_html('progress-') . $round_progress; ?>"> |
|
382 | 382 | <div class="plan-feature-img"> |
383 | - <?php if ( (int)$completed_progress === (int)$round_progress ) { ?> |
|
384 | - <span class="featured-plan"><?php lsx_get_svg_icon( 'icon-completed.svg' ); ?></span> |
|
383 | + <?php if ((int) $completed_progress === (int) $round_progress) { ?> |
|
384 | + <span class="featured-plan"><?php lsx_get_svg_icon('icon-completed.svg'); ?></span> |
|
385 | 385 | <?php } ?> |
386 | - <a href="<?php echo esc_url( get_permalink() ); ?>"> |
|
386 | + <a href="<?php echo esc_url(get_permalink()); ?>"> |
|
387 | 387 | <?php |
388 | 388 | $featured_image = get_the_post_thumbnail(); |
389 | - if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
390 | - the_post_thumbnail( 'lsx-thumbnail', array( |
|
389 | + if ( ! empty($featured_image) && '' !== $featured_image) { |
|
390 | + the_post_thumbnail('lsx-thumbnail', array( |
|
391 | 391 | 'class' => 'aligncenter', |
392 | - ) ); |
|
392 | + )); |
|
393 | 393 | } else { |
394 | 394 | ?> |
395 | - <img loading="lazy" class="placeholder" src="<?php echo esc_attr( plugin_dir_url( __FILE__ ) . '../assets/images/placeholder.jpg' ); ?>"> |
|
395 | + <img loading="lazy" class="placeholder" src="<?php echo esc_attr(plugin_dir_url(__FILE__) . '../assets/images/placeholder.jpg'); ?>"> |
|
396 | 396 | <?php |
397 | 397 | } |
398 | 398 | ?> |
399 | 399 | </a> |
400 | 400 | </div> |
401 | 401 | <div class="content-box plan-content-box"> |
402 | - <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> |
|
402 | + <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> |
|
403 | 403 | <?php |
404 | - echo wp_kses_post( \lsx_health_plan\functions\hp_get_plan_type_meta( $post ) ); |
|
404 | + echo wp_kses_post(\lsx_health_plan\functions\hp_get_plan_type_meta($post)); |
|
405 | 405 | ?> |
406 | 406 | <?php |
407 | - if ( false !== $linked_product && false !== $restricted ) { |
|
408 | - echo wp_kses_post( $linked_product->get_price_html() ); |
|
407 | + if (false !== $linked_product && false !== $restricted) { |
|
408 | + echo wp_kses_post($linked_product->get_price_html()); |
|
409 | 409 | } |
410 | 410 | ?> |
411 | 411 | <div class="excerpt"> |
412 | 412 | <?php |
413 | - if ( ! has_excerpt() ) { |
|
414 | - $content = wp_trim_words( get_the_content(), 20 ); |
|
413 | + if ( ! has_excerpt()) { |
|
414 | + $content = wp_trim_words(get_the_content(), 20); |
|
415 | 415 | $content = '<p>' . $content . '</pre>'; |
416 | 416 | } else { |
417 | - $content = apply_filters( 'the_excerpt', get_the_excerpt() ); |
|
417 | + $content = apply_filters('the_excerpt', get_the_excerpt()); |
|
418 | 418 | } |
419 | - echo wp_kses_post( $content ); |
|
419 | + echo wp_kses_post($content); |
|
420 | 420 | ?> |
421 | 421 | </div> |
422 | 422 | <?php |
423 | - if ( false === $restricted ) { |
|
424 | - 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>' ); |
|
423 | + if (false === $restricted) { |
|
424 | + 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>'); |
|
425 | 425 | } |
426 | 426 | ?> |
427 | 427 | </div> |
@@ -441,30 +441,30 @@ discard block |
||
441 | 441 | * |
442 | 442 | * @return void |
443 | 443 | */ |
444 | -function lsx_health_plan_day_plan_block( $args = array() ) { |
|
444 | +function lsx_health_plan_day_plan_block($args = array()) { |
|
445 | 445 | $defaults = array( |
446 | 446 | 'plan' => '', |
447 | 447 | ); |
448 | - $args = wp_parse_args( $args, $defaults ); |
|
448 | + $args = wp_parse_args($args, $defaults); |
|
449 | 449 | |
450 | - if ( isset( $args['plan'] ) && '' !== $args['plan'] && \lsx_health_plan\functions\plan\has_sections( $args['plan'] ) ) { |
|
450 | + if (isset($args['plan']) && '' !== $args['plan'] && \lsx_health_plan\functions\plan\has_sections($args['plan'])) { |
|
451 | 451 | $sections = \lsx_health_plan\functions\plan\get_sections(); |
452 | 452 | ?> |
453 | 453 | <div class="daily-plan-block day-grid"> |
454 | 454 | <?php |
455 | - foreach ( $sections as $section_key => $section_values ) { |
|
456 | - $defaults = array( |
|
457 | - 'title' => __( 'Day', 'lsx-health-plan' ) . ' ' . ( $section_key + 1 ), |
|
455 | + foreach ($sections as $section_key => $section_values) { |
|
456 | + $defaults = array( |
|
457 | + 'title' => __('Day', 'lsx-health-plan') . ' ' . ($section_key + 1), |
|
458 | 458 | ); |
459 | - $section_args = wp_parse_args( $section_values, $defaults ); |
|
459 | + $section_args = wp_parse_args($section_values, $defaults); |
|
460 | 460 | |
461 | 461 | $completed_class = ''; |
462 | - if ( lsx_health_plan_is_day_complete() ) { |
|
462 | + if (lsx_health_plan_is_day_complete()) { |
|
463 | 463 | $completed_class = 'completed'; |
464 | 464 | } |
465 | 465 | ?> |
466 | - <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 ); ?>"> |
|
467 | - <div class="plan-content"><?php echo esc_attr( $section_args['title'] ); ?></div> |
|
466 | + <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); ?>"> |
|
467 | + <div class="plan-content"><?php echo esc_attr($section_args['title']); ?></div> |
|
468 | 468 | </a> |
469 | 469 | <?php |
470 | 470 | } |
@@ -480,31 +480,31 @@ discard block |
||
480 | 480 | * @param array $args An array of arguments. |
481 | 481 | * @return void |
482 | 482 | */ |
483 | -function lsx_health_plan_week_plan_block( $args = array() ) { |
|
483 | +function lsx_health_plan_week_plan_block($args = array()) { |
|
484 | 484 | $defaults = array( |
485 | 485 | 'show_downloads' => false, |
486 | 486 | 'plan' => '', |
487 | 487 | ); |
488 | - $args = wp_parse_args( $args, $defaults ); |
|
488 | + $args = wp_parse_args($args, $defaults); |
|
489 | 489 | |
490 | - if ( isset( $args['plan'] ) && '' !== $args['plan'] && \lsx_health_plan\functions\plan\has_sections( $args['plan'] ) ) { |
|
491 | - $groups = \lsx_health_plan\functions\plan\get_sections( true ); |
|
490 | + if (isset($args['plan']) && '' !== $args['plan'] && \lsx_health_plan\functions\plan\has_sections($args['plan'])) { |
|
491 | + $groups = \lsx_health_plan\functions\plan\get_sections(true); |
|
492 | 492 | |
493 | - if ( ! empty( $groups ) ) { |
|
493 | + if ( ! empty($groups)) { |
|
494 | 494 | $counter = 1; |
495 | 495 | $group_open = false; |
496 | 496 | |
497 | - foreach ( $groups as $group_key => $sections ) { |
|
497 | + foreach ($groups as $group_key => $sections) { |
|
498 | 498 | $collapse_class = ''; |
499 | - $group_title = \lsx_health_plan\functions\plan\get_group_title( $sections ); |
|
499 | + $group_title = \lsx_health_plan\functions\plan\get_group_title($sections); |
|
500 | 500 | |
501 | 501 | // Determine if the current week is complete. |
502 | - $day_ids = wp_list_pluck( $sections, 'title' ); |
|
503 | - if ( false === $group_open ) { |
|
504 | - if ( 1 === $counter && ! \lsx_health_plan\functions\is_week_complete( false, $day_ids, $group_title ) ) { |
|
502 | + $day_ids = wp_list_pluck($sections, 'title'); |
|
503 | + if (false === $group_open) { |
|
504 | + if (1 === $counter && ! \lsx_health_plan\functions\is_week_complete(false, $day_ids, $group_title)) { |
|
505 | 505 | $collapse_class = 'in'; |
506 | 506 | $group_open = true; |
507 | - } elseif ( ! \lsx_health_plan\functions\is_week_complete( false, $day_ids, $group_title ) ) { |
|
507 | + } elseif ( ! \lsx_health_plan\functions\is_week_complete(false, $day_ids, $group_title)) { |
|
508 | 508 | $collapse_class = 'in'; |
509 | 509 | $group_open = true; |
510 | 510 | } |
@@ -512,47 +512,47 @@ discard block |
||
512 | 512 | |
513 | 513 | // Determine if there are any weekly downloads. |
514 | 514 | $week_downloads_view = ''; |
515 | - if ( isset( $args['show_downloads'] ) && false !== $args['show_downloads'] ) { |
|
516 | - $weekly_downloads = \lsx_health_plan\functions\get_weekly_downloads( $group_key ); |
|
517 | - if ( ! empty( $weekly_downloads ) ) { |
|
515 | + if (isset($args['show_downloads']) && false !== $args['show_downloads']) { |
|
516 | + $weekly_downloads = \lsx_health_plan\functions\get_weekly_downloads($group_key); |
|
517 | + if ( ! empty($weekly_downloads)) { |
|
518 | 518 | $week_downloads_view = 'week-downloads-view-on'; |
519 | 519 | } |
520 | 520 | } |
521 | 521 | ?> |
522 | 522 | <div class="daily-plan-block week-grid"> |
523 | - <a href="#group-<?php echo esc_attr( $group_key ); ?>" data-toggle="collapse" class="week-title"><?php echo esc_attr( $group_title ); ?></a> |
|
524 | - <div id="group-<?php echo esc_attr( $group_key ); ?>" class="week-row collapse <?php echo esc_attr( $collapse_class ); ?>"> |
|
525 | - <div class="week-row-inner <?php echo esc_html( $week_downloads_view ); ?>"> |
|
523 | + <a href="#group-<?php echo esc_attr($group_key); ?>" data-toggle="collapse" class="week-title"><?php echo esc_attr($group_title); ?></a> |
|
524 | + <div id="group-<?php echo esc_attr($group_key); ?>" class="week-row collapse <?php echo esc_attr($collapse_class); ?>"> |
|
525 | + <div class="week-row-inner <?php echo esc_html($week_downloads_view); ?>"> |
|
526 | 526 | <div class="week-meals-recipes-box"> |
527 | 527 | |
528 | - <?php if ( ! empty( $week_downloads_view ) ) { ?> |
|
529 | - <h3 class="title"><?php lsx_get_svg_icon( 'daily-plan.svg' ); ?><?php echo esc_html_e( 'Plan', 'lsx-health-plan' ); ?></h3> |
|
528 | + <?php if ( ! empty($week_downloads_view)) { ?> |
|
529 | + <h3 class="title"><?php lsx_get_svg_icon('daily-plan.svg'); ?><?php echo esc_html_e('Plan', 'lsx-health-plan'); ?></h3> |
|
530 | 530 | <?php } ?> |
531 | 531 | |
532 | 532 | <div class="week-meals-recipes-box-inner"> |
533 | 533 | <?php |
534 | 534 | |
535 | - foreach ( $sections as $section_key => $section_values ) { |
|
535 | + foreach ($sections as $section_key => $section_values) { |
|
536 | 536 | |
537 | - $defaults = array( |
|
538 | - 'title' => __( 'Day', 'lsx-health-plan' ) . ' ' . ( $section_key + 1 ), |
|
537 | + $defaults = array( |
|
538 | + 'title' => __('Day', 'lsx-health-plan') . ' ' . ($section_key + 1), |
|
539 | 539 | ); |
540 | - $section_args = wp_parse_args( $section_values, $defaults ); |
|
540 | + $section_args = wp_parse_args($section_values, $defaults); |
|
541 | 541 | |
542 | 542 | $completed_class = ''; |
543 | - if ( lsx_health_plan_is_day_complete( $args['plan'], $section_args['title'] ) ) { |
|
543 | + if (lsx_health_plan_is_day_complete($args['plan'], $section_args['title'])) { |
|
544 | 544 | $completed_class = 'completed'; |
545 | 545 | } |
546 | - if ( $section_args['rest_day_enabled'] && ! $section_args['connected_meals'] ) { |
|
546 | + if ($section_args['rest_day_enabled'] && ! $section_args['connected_meals']) { |
|
547 | 547 | ?> |
548 | - <span class="day id-<?php echo esc_attr( $section_key + 1 ); ?> <?php echo esc_attr( $completed_class ); ?>"> |
|
549 | - <div class="plan-content"><?php echo esc_attr( $section_args['title'] ); ?></div> |
|
548 | + <span class="day id-<?php echo esc_attr($section_key + 1); ?> <?php echo esc_attr($completed_class); ?>"> |
|
549 | + <div class="plan-content"><?php echo esc_attr($section_args['title']); ?></div> |
|
550 | 550 | </span> |
551 | 551 | <?php |
552 | 552 | } else { |
553 | 553 | ?> |
554 | - <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 ); ?>"> |
|
555 | - <div class="plan-content"><?php echo esc_attr( $section_args['title'] ); ?></div> |
|
554 | + <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); ?>"> |
|
555 | + <div class="plan-content"><?php echo esc_attr($section_args['title']); ?></div> |
|
556 | 556 | </a> |
557 | 557 | <?php |
558 | 558 | } |
@@ -561,8 +561,8 @@ discard block |
||
561 | 561 | </div> |
562 | 562 | </div> |
563 | 563 | <?php |
564 | - if ( ! empty( $week_downloads_view ) ) { |
|
565 | - lsx_health_plan_weekly_downloads( $weekly_downloads ); |
|
564 | + if ( ! empty($week_downloads_view)) { |
|
565 | + lsx_health_plan_weekly_downloads($weekly_downloads); |
|
566 | 566 | } |
567 | 567 | ?> |
568 | 568 | </div> |
@@ -580,16 +580,16 @@ discard block |
||
580 | 580 | * @param array $weekly_downloads An array of the download ids. |
581 | 581 | * @return void |
582 | 582 | */ |
583 | -function lsx_health_plan_weekly_downloads( $weekly_downloads = array() ) { |
|
584 | - if ( ! empty( $weekly_downloads ) ) { |
|
583 | +function lsx_health_plan_weekly_downloads($weekly_downloads = array()) { |
|
584 | + if ( ! empty($weekly_downloads)) { |
|
585 | 585 | ?> |
586 | 586 | <div class="week-download-box"> |
587 | - <h3 class="title"><?php lsx_get_svg_icon( 'download.svg' ); ?><?php echo esc_html_e( 'Downloads', 'lsx-health-plan' ); ?></h3> |
|
587 | + <h3 class="title"><?php lsx_get_svg_icon('download.svg'); ?><?php echo esc_html_e('Downloads', 'lsx-health-plan'); ?></h3> |
|
588 | 588 | <ul class="week-download-box-list"> |
589 | 589 | <?php |
590 | - foreach ( $weekly_downloads as $weekly_download ) { |
|
590 | + foreach ($weekly_downloads as $weekly_download) { |
|
591 | 591 | ?> |
592 | - <li><?php echo wp_kses_post( do_shortcode( '[download id="' . $weekly_download . '"]' ) ); ?></li> |
|
592 | + <li><?php echo wp_kses_post(do_shortcode('[download id="' . $weekly_download . '"]')); ?></li> |
|
593 | 593 | <?php |
594 | 594 | } |
595 | 595 | ?> |
@@ -604,7 +604,7 @@ discard block |
||
604 | 604 | * |
605 | 605 | * @return void |
606 | 606 | */ |
607 | -function lsx_health_plan_items( $args = array() ) { |
|
607 | +function lsx_health_plan_items($args = array()) { |
|
608 | 608 | global $shortcode_args; |
609 | 609 | $shortcode_args = $args; |
610 | 610 | include LSX_HEALTH_PLAN_PATH . '/templates/partials/shortcode-loop.php'; |
@@ -616,7 +616,7 @@ discard block |
||
616 | 616 | * @return void |
617 | 617 | */ |
618 | 618 | function lsx_health_plan_featured_video_block() { |
619 | - if ( ! post_type_exists( 'video' ) ) { |
|
619 | + if ( ! post_type_exists('video')) { |
|
620 | 620 | return; |
621 | 621 | } |
622 | 622 | include LSX_HEALTH_PLAN_PATH . '/templates/featured-videos.php'; |
@@ -628,7 +628,7 @@ discard block |
||
628 | 628 | * @return void |
629 | 629 | */ |
630 | 630 | function lsx_health_plan_featured_recipes_block() { |
631 | - if ( ! post_type_exists( 'recipe' ) ) { |
|
631 | + if ( ! post_type_exists('recipe')) { |
|
632 | 632 | return; |
633 | 633 | } |
634 | 634 | include LSX_HEALTH_PLAN_PATH . '/templates/featured-recipes.php'; |
@@ -650,7 +650,7 @@ discard block |
||
650 | 650 | * @return void |
651 | 651 | */ |
652 | 652 | function lsx_health_plan_day_button() { |
653 | - if ( lsx_health_plan_is_day_complete() ) { |
|
653 | + if (lsx_health_plan_is_day_complete()) { |
|
654 | 654 | lsx_health_plan_unlock_button(); |
655 | 655 | } else { |
656 | 656 | lsx_health_plan_complete_button(); |
@@ -666,9 +666,9 @@ discard block |
||
666 | 666 | ?> |
667 | 667 | <div class="single-plan-inner-buttons"> |
668 | 668 | <form action="<?php the_permalink(); ?>" method="post" class="form-complete-day complete-plan-btn"> |
669 | - <?php wp_nonce_field( 'complete', 'lsx-health-plan-actions' ); ?> |
|
670 | - <input type="hidden" name="lsx-health-plan-id" value="<?php echo esc_attr( \lsx_health_plan\functions\plan\generate_section_id() ); ?>" /> |
|
671 | - <button class="btn cta-btn" type="submit"><?php esc_html_e( 'Complete Day', 'lsx-health-plan' ); ?></button> |
|
669 | + <?php wp_nonce_field('complete', 'lsx-health-plan-actions'); ?> |
|
670 | + <input type="hidden" name="lsx-health-plan-id" value="<?php echo esc_attr(\lsx_health_plan\functions\plan\generate_section_id()); ?>" /> |
|
671 | + <button class="btn cta-btn" type="submit"><?php esc_html_e('Complete Day', 'lsx-health-plan'); ?></button> |
|
672 | 672 | </form> |
673 | 673 | <?php lsx_health_plan_back_to_plan_button(); ?> |
674 | 674 | </div> |
@@ -684,9 +684,9 @@ discard block |
||
684 | 684 | ?> |
685 | 685 | <div class="single-plan-inner-buttons"> |
686 | 686 | <form action="<?php the_permalink(); ?>" method="post" class="form-complete-day complete-plan-btn"> |
687 | - <?php wp_nonce_field( 'unlock', 'lsx-health-plan-actions' ); ?> |
|
688 | - <input type="hidden" name="lsx-health-plan-id" value="<?php echo esc_attr( \lsx_health_plan\functions\plan\generate_section_id() ); ?>" /> |
|
689 | - <button class="btn secondary-btn" type="submit"><?php esc_html_e( 'Im not done!', 'lsx-health-plan' ); ?></button> |
|
687 | + <?php wp_nonce_field('unlock', 'lsx-health-plan-actions'); ?> |
|
688 | + <input type="hidden" name="lsx-health-plan-id" value="<?php echo esc_attr(\lsx_health_plan\functions\plan\generate_section_id()); ?>" /> |
|
689 | + <button class="btn secondary-btn" type="submit"><?php esc_html_e('Im not done!', 'lsx-health-plan'); ?></button> |
|
690 | 690 | </form> |
691 | 691 | <?php lsx_health_plan_back_to_plan_button(); ?> |
692 | 692 | </div> |
@@ -700,8 +700,8 @@ discard block |
||
700 | 700 | * @return void |
701 | 701 | */ |
702 | 702 | function lsx_health_plan_single_nav() { |
703 | - $tab_template_path = apply_filters( 'lsx_health_plan_single_nav_path', LSX_HEALTH_PLAN_PATH . '/templates/single-plan-tabs.php' ); |
|
704 | - if ( '' !== $tab_template_path ) { |
|
703 | + $tab_template_path = apply_filters('lsx_health_plan_single_nav_path', LSX_HEALTH_PLAN_PATH . '/templates/single-plan-tabs.php'); |
|
704 | + if ('' !== $tab_template_path) { |
|
705 | 705 | require $tab_template_path; |
706 | 706 | } |
707 | 707 | } |
@@ -713,8 +713,8 @@ discard block |
||
713 | 713 | * @return void |
714 | 714 | */ |
715 | 715 | function lsx_health_plan_single_tabs() { |
716 | - $endpoint = get_query_var( 'endpoint' ); |
|
717 | - switch ( $endpoint ) { |
|
716 | + $endpoint = get_query_var('endpoint'); |
|
717 | + switch ($endpoint) { |
|
718 | 718 | case 'meal': |
719 | 719 | $tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-meal.php'; |
720 | 720 | break; |
@@ -735,8 +735,8 @@ discard block |
||
735 | 735 | $tab_template_path = LSX_HEALTH_PLAN_PATH . '/templates/tab-content-plan.php'; |
736 | 736 | break; |
737 | 737 | } |
738 | - $tab_template_path = apply_filters( 'lsx_health_plan_single_tab_path', $tab_template_path ); |
|
739 | - if ( '' !== $tab_template_path ) { |
|
738 | + $tab_template_path = apply_filters('lsx_health_plan_single_tab_path', $tab_template_path); |
|
739 | + if ('' !== $tab_template_path) { |
|
740 | 740 | include $tab_template_path; |
741 | 741 | } |
742 | 742 | } |
@@ -756,9 +756,9 @@ discard block |
||
756 | 756 | * @return recipe_type |
757 | 757 | */ |
758 | 758 | function lsx_health_plan_recipe_type() { |
759 | - $term_obj_list = get_the_terms( get_the_ID(), 'recipe-type' ); |
|
759 | + $term_obj_list = get_the_terms(get_the_ID(), 'recipe-type'); |
|
760 | 760 | $recipe_type = $term_obj_list[0]->name; |
761 | - if ( ! empty( $recipe_type ) ) { |
|
761 | + if ( ! empty($recipe_type)) { |
|
762 | 762 | return $recipe_type; |
763 | 763 | } |
764 | 764 | } |
@@ -770,32 +770,32 @@ discard block |
||
770 | 770 | * @param array $group |
771 | 771 | * @return void |
772 | 772 | */ |
773 | -function lsx_health_plan_workout_video_play_button( $m, $group, $echo = true ) { |
|
773 | +function lsx_health_plan_workout_video_play_button($m, $group, $echo = true) { |
|
774 | 774 | $workout_video = ''; |
775 | 775 | $giphy = ''; |
776 | 776 | $youtube = ''; |
777 | - if ( isset( $group['connected_videos'] ) && '' !== $group['connected_videos'] ) { |
|
778 | - $workout_video = esc_html( $group['connected_videos'] ); |
|
779 | - $giphy = get_post_meta( $workout_video, 'video_giphy_source', true ); |
|
780 | - $youtube = esc_url( get_post_meta( $workout_video, 'video_youtube_source', 1 ) ); |
|
781 | - $content = get_post_field( 'post_content', $workout_video ); |
|
777 | + if (isset($group['connected_videos']) && '' !== $group['connected_videos']) { |
|
778 | + $workout_video = esc_html($group['connected_videos']); |
|
779 | + $giphy = get_post_meta($workout_video, 'video_giphy_source', true); |
|
780 | + $youtube = esc_url(get_post_meta($workout_video, 'video_youtube_source', 1)); |
|
781 | + $content = get_post_field('post_content', $workout_video); |
|
782 | 782 | $play_button = '<button data-toggle="modal" data-target="#workout-video-modal-' . $m . '"><span class="fa fa-play-circle"></span></button>'; |
783 | 783 | |
784 | 784 | $modal_body = ''; |
785 | - if ( ! empty( $giphy ) ) { |
|
786 | - $giphy = \lsx_health_plan\functions\get_video_url( $giphy ); |
|
785 | + if ( ! empty($giphy)) { |
|
786 | + $giphy = \lsx_health_plan\functions\get_video_url($giphy); |
|
787 | 787 | $modal_body = $giphy; // WPCS: XSS OK. |
788 | - } elseif ( ! empty( $youtube ) ) { |
|
789 | - $modal_body = wp_oembed_get( $youtube, array( // WPCS: XSS OK. |
|
788 | + } elseif ( ! empty($youtube)) { |
|
789 | + $modal_body = wp_oembed_get($youtube, array( // WPCS: XSS OK. |
|
790 | 790 | 'width' => 480, |
791 | - ) ); |
|
791 | + )); |
|
792 | 792 | } |
793 | 793 | $modal_body .= '<h5 class="modal-title title-lined">' . $group['name'] . '</h5>'; |
794 | 794 | $modal_body .= $content; |
795 | - \lsx_health_plan\functions\register_modal( 'workout-video-modal-' . $m, '', $modal_body ); |
|
795 | + \lsx_health_plan\functions\register_modal('workout-video-modal-' . $m, '', $modal_body); |
|
796 | 796 | |
797 | - if ( true === $echo ) { |
|
798 | - echo wp_kses_post( $play_button ); |
|
797 | + if (true === $echo) { |
|
798 | + echo wp_kses_post($play_button); |
|
799 | 799 | } else { |
800 | 800 | return $play_button; |
801 | 801 | } |
@@ -809,17 +809,17 @@ discard block |
||
809 | 809 | */ |
810 | 810 | function lsx_health_plan_recipe_archive_description() { |
811 | 811 | $description = ''; |
812 | - if ( is_post_type_archive( 'recipe' ) ) { |
|
813 | - $description = \lsx_health_plan\functions\get_option( 'recipe_archive_description', '' ); |
|
814 | - } elseif ( is_post_type_archive( 'exercise' ) ) { |
|
815 | - $description = \lsx_health_plan\functions\get_option( 'exercise_archive_description', '' ); |
|
816 | - } elseif ( is_tax() ) { |
|
812 | + if (is_post_type_archive('recipe')) { |
|
813 | + $description = \lsx_health_plan\functions\get_option('recipe_archive_description', ''); |
|
814 | + } elseif (is_post_type_archive('exercise')) { |
|
815 | + $description = \lsx_health_plan\functions\get_option('exercise_archive_description', ''); |
|
816 | + } elseif (is_tax()) { |
|
817 | 817 | $description = get_the_archive_description(); |
818 | 818 | } |
819 | - if ( '' !== $description ) { |
|
819 | + if ('' !== $description) { |
|
820 | 820 | ?> |
821 | 821 | <div class="lsx-hp-archive-description row"> |
822 | - <div class="col-xs-12 description-wrapper"><?php echo wp_kses_post( wpautop( $description ) ); ?></div> |
|
822 | + <div class="col-xs-12 description-wrapper"><?php echo wp_kses_post(wpautop($description)); ?></div> |
|
823 | 823 | </div> |
824 | 824 | <?php |
825 | 825 | } |
@@ -832,19 +832,19 @@ discard block |
||
832 | 832 | */ |
833 | 833 | function lsx_health_plan_workout_main_content() { |
834 | 834 | // Getting translated endpoint. |
835 | - $workout = \lsx_health_plan\functions\get_option( 'endpoint_workout', 'workout' ); |
|
835 | + $workout = \lsx_health_plan\functions\get_option('endpoint_workout', 'workout'); |
|
836 | 836 | |
837 | - $connected_members = get_post_meta( get_the_ID(), ( $workout . '_connected_team_member' ), true ); |
|
838 | - $small_description = get_post_meta( get_the_ID(), ( $workout . '_short_description' ), true ); |
|
837 | + $connected_members = get_post_meta(get_the_ID(), ($workout . '_connected_team_member'), true); |
|
838 | + $small_description = get_post_meta(get_the_ID(), ($workout . '_short_description'), true); |
|
839 | 839 | |
840 | 840 | $content = ''; |
841 | - if ( $small_description || $connected_members || lsx_health_plan_has_tips() ) { |
|
841 | + if ($small_description || $connected_members || lsx_health_plan_has_tips()) { |
|
842 | 842 | $content .= '<div class="short-desc set-box set content-box entry-content">'; |
843 | 843 | $content .= '<div class="the-content">'; |
844 | - $content .= lsx_hp_member_connected( $connected_members, $workout ); |
|
844 | + $content .= lsx_hp_member_connected($connected_members, $workout); |
|
845 | 845 | $content .= '<span>' . $small_description . '</span>'; |
846 | 846 | $content .= '</div>'; |
847 | - $content .= do_shortcode( '[lsx_health_plan_featured_tips_block]' ); |
|
847 | + $content .= do_shortcode('[lsx_health_plan_featured_tips_block]'); |
|
848 | 848 | $content .= '</div>'; |
849 | 849 | } |
850 | 850 | return $content; |
@@ -857,19 +857,19 @@ discard block |
||
857 | 857 | */ |
858 | 858 | function lsx_health_plan_meal_main_content() { |
859 | 859 | // Getting translated endpoint. |
860 | - $meal = \lsx_health_plan\functions\get_option( 'endpoint_meal', 'meal' ); |
|
860 | + $meal = \lsx_health_plan\functions\get_option('endpoint_meal', 'meal'); |
|
861 | 861 | |
862 | - $connected_members = get_post_meta( get_the_ID(), ( $meal . '_connected_team_member' ), true ); |
|
863 | - $small_description = get_post_meta( get_the_ID(), ( $meal . '_short_description' ), true ); |
|
862 | + $connected_members = get_post_meta(get_the_ID(), ($meal . '_connected_team_member'), true); |
|
863 | + $small_description = get_post_meta(get_the_ID(), ($meal . '_short_description'), true); |
|
864 | 864 | |
865 | 865 | $content_meal = ''; |
866 | - if ( $small_description || $connected_members || lsx_health_plan_has_tips() ) { |
|
866 | + if ($small_description || $connected_members || lsx_health_plan_has_tips()) { |
|
867 | 867 | $content_meal .= '<div class="set-box set content-box entry-content">'; |
868 | 868 | $content_meal .= '<div class="the-content">'; |
869 | - $content_meal .= lsx_hp_member_connected( $connected_members, $meal ); |
|
869 | + $content_meal .= lsx_hp_member_connected($connected_members, $meal); |
|
870 | 870 | $content_meal .= '<span>' . $small_description . '</span>'; |
871 | 871 | $content_meal .= '</div>'; |
872 | - $content_meal .= do_shortcode( '[lsx_health_plan_featured_tips_block]' ); |
|
872 | + $content_meal .= do_shortcode('[lsx_health_plan_featured_tips_block]'); |
|
873 | 873 | $content_meal .= '</div>'; |
874 | 874 | } |
875 | 875 | return $content_meal; |
@@ -882,21 +882,21 @@ discard block |
||
882 | 882 | * @param string $index |
883 | 883 | * @return void |
884 | 884 | */ |
885 | -function lsx_health_plan_workout_tab_content( $index = 1 ) { |
|
886 | - global $group_name,$shortcode_args; |
|
885 | +function lsx_health_plan_workout_tab_content($index = 1) { |
|
886 | + global $group_name, $shortcode_args; |
|
887 | 887 | $group_name = 'workout_section_' . $index; |
888 | - if ( false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) { |
|
889 | - $layout = strtolower( \lsx_health_plan\functions\get_option( 'workout_tab_layout', 'table' ) ); |
|
888 | + if (false !== \lsx_health_plan\functions\get_option('exercise_enabled', false)) { |
|
889 | + $layout = strtolower(\lsx_health_plan\functions\get_option('workout_tab_layout', 'table')); |
|
890 | 890 | |
891 | 891 | // Check for shortcode overrides. |
892 | - if ( null !== $shortcode_args && isset( $shortcode_args['layout'] ) ) { |
|
892 | + if (null !== $shortcode_args && isset($shortcode_args['layout'])) { |
|
893 | 893 | $layout = $shortcode_args['layout']; |
894 | 894 | } |
895 | 895 | } else { |
896 | 896 | $layout = 'table'; |
897 | 897 | } |
898 | 898 | |
899 | - switch ( $layout ) { |
|
899 | + switch ($layout) { |
|
900 | 900 | case 'list': |
901 | 901 | $tab_template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-list.php'; |
902 | 902 | break; |
@@ -909,8 +909,8 @@ discard block |
||
909 | 909 | $tab_template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-table.php'; |
910 | 910 | break; |
911 | 911 | } |
912 | - $tab_template_path = apply_filters( 'lsx_health_plan_workout_tab_content_path', $tab_template_path ); |
|
913 | - if ( '' !== $tab_template_path ) { |
|
912 | + $tab_template_path = apply_filters('lsx_health_plan_workout_tab_content_path', $tab_template_path); |
|
913 | + if ('' !== $tab_template_path) { |
|
914 | 914 | include $tab_template_path; |
915 | 915 | } |
916 | 916 | } |
@@ -921,26 +921,26 @@ discard block |
||
921 | 921 | * @return void |
922 | 922 | */ |
923 | 923 | function lsx_health_plan_workout_sets() { |
924 | - if ( is_singular( 'workout' ) ) { |
|
924 | + if (is_singular('workout')) { |
|
925 | 925 | global $connected_workouts; |
926 | - $connected_workouts = array( get_the_ID() ); |
|
926 | + $connected_workouts = array(get_the_ID()); |
|
927 | 927 | } |
928 | - if ( is_singular( 'plan' ) ) { |
|
928 | + if (is_singular('plan')) { |
|
929 | 929 | |
930 | 930 | global $connected_workouts; |
931 | 931 | |
932 | - $section_key = get_query_var( 'section' ); |
|
933 | - if ( '' !== $section && \lsx_health_plan\functions\plan\has_sections() ) { |
|
934 | - $section_info = \lsx_health_plan\functions\plan\get_section_info( $section_key ); |
|
935 | - if ( isset( $section_info['connected_workouts'] ) && '' !== $section_info['connected_workouts'] ) { |
|
932 | + $section_key = get_query_var('section'); |
|
933 | + if ('' !== $section && \lsx_health_plan\functions\plan\has_sections()) { |
|
934 | + $section_info = \lsx_health_plan\functions\plan\get_section_info($section_key); |
|
935 | + if (isset($section_info['connected_workouts']) && '' !== $section_info['connected_workouts']) { |
|
936 | 936 | |
937 | - $connected_workouts = \lsx_health_plan\functions\prep_array( $section_info['connected_workouts'] ); |
|
937 | + $connected_workouts = \lsx_health_plan\functions\prep_array($section_info['connected_workouts']); |
|
938 | 938 | } |
939 | 939 | } |
940 | 940 | } |
941 | 941 | $template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-sets.php'; |
942 | - $template_path = apply_filters( 'lsx_health_plan_workout_set_template_path', $template_path ); |
|
943 | - if ( '' !== $template_path && ! empty( $template_path ) ) { |
|
942 | + $template_path = apply_filters('lsx_health_plan_workout_set_template_path', $template_path); |
|
943 | + if ('' !== $template_path && ! empty($template_path)) { |
|
944 | 944 | include $template_path; |
945 | 945 | } |
946 | 946 | } |
@@ -951,11 +951,11 @@ discard block |
||
951 | 951 | * @param [type] $connected_workouts |
952 | 952 | * @return void |
953 | 953 | */ |
954 | -function lsx_health_plan_warmup_sets( $connected_workouts ) { |
|
954 | +function lsx_health_plan_warmup_sets($connected_workouts) { |
|
955 | 955 | |
956 | 956 | $template_path = LSX_HEALTH_PLAN_PATH . 'templates/partials/workout-sets.php'; |
957 | - $template_path = apply_filters( 'lsx_health_plan_workout_set_template_path', $template_path ); |
|
958 | - if ( '' !== $template_path && ! empty( $template_path ) ) { |
|
957 | + $template_path = apply_filters('lsx_health_plan_workout_set_template_path', $template_path); |
|
958 | + if ('' !== $template_path && ! empty($template_path)) { |
|
959 | 959 | include $template_path; |
960 | 960 | } |
961 | 961 | } |
@@ -966,46 +966,46 @@ discard block |
||
966 | 966 | * @param array $args |
967 | 967 | * @return void |
968 | 968 | */ |
969 | -function lsx_hp_meal_plan_recipes( $args = array() ) { |
|
969 | +function lsx_hp_meal_plan_recipes($args = array()) { |
|
970 | 970 | $defaults = array( |
971 | 971 | 'meal_id' => false, |
972 | 972 | 'meal_time' => '', |
973 | 973 | 'modal' => true, |
974 | 974 | ); |
975 | - $args = wp_parse_args( $args, $defaults ); |
|
975 | + $args = wp_parse_args($args, $defaults); |
|
976 | 976 | // Looking for recipes. |
977 | - $connected_recipes = get_post_meta( $args['meal_id'], $args['meal_time'] . '_recipes', true ); |
|
978 | - if ( ! empty( $connected_recipes ) ) { |
|
979 | - $query_args = array( |
|
977 | + $connected_recipes = get_post_meta($args['meal_id'], $args['meal_time'] . '_recipes', true); |
|
978 | + if ( ! empty($connected_recipes)) { |
|
979 | + $query_args = array( |
|
980 | 980 | 'orderby' => 'date', |
981 | 981 | 'order' => 'DESC', |
982 | 982 | 'post_type' => 'recipe', |
983 | 983 | 'post__in' => $connected_recipes, |
984 | 984 | ); |
985 | - $recipes = new WP_Query( $query_args ); |
|
985 | + $recipes = new WP_Query($query_args); |
|
986 | 986 | ?> |
987 | 987 | <div class="recipes"> |
988 | 988 | <div class="row eating-row"> |
989 | 989 | <?php |
990 | - if ( $recipes->have_posts() ) { |
|
991 | - while ( $recipes->have_posts() ) { |
|
990 | + if ($recipes->have_posts()) { |
|
991 | + while ($recipes->have_posts()) { |
|
992 | 992 | $recipes->the_post(); |
993 | - if ( false !== $args['modal'] ) { |
|
993 | + if (false !== $args['modal']) { |
|
994 | 994 | \lsx_health_plan\functions\recipes\register_recipe_modal(); |
995 | 995 | } |
996 | 996 | ?> |
997 | 997 | <div class="recipe-column"> |
998 | - <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"> |
|
998 | + <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"> |
|
999 | 999 | <div class="recipe-feature-img"> |
1000 | 1000 | <?php |
1001 | 1001 | $featured_image = get_the_post_thumbnail(); |
1002 | - if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
1003 | - the_post_thumbnail( 'lsx-thumbnail-square', array( |
|
1002 | + if ( ! empty($featured_image) && '' !== $featured_image) { |
|
1003 | + the_post_thumbnail('lsx-thumbnail-square', array( |
|
1004 | 1004 | 'class' => 'aligncenter', |
1005 | - ) ); |
|
1005 | + )); |
|
1006 | 1006 | } else { |
1007 | 1007 | ?> |
1008 | - <img loading="lazy" class="placeholder" src="<?php echo esc_attr( plugin_dir_url( __DIR__ ) . 'assets/images/placeholder.jpg' ); ?>"> |
|
1008 | + <img loading="lazy" class="placeholder" src="<?php echo esc_attr(plugin_dir_url(__DIR__) . 'assets/images/placeholder.jpg'); ?>"> |
|
1009 | 1009 | <?php |
1010 | 1010 | } |
1011 | 1011 | ?> |
@@ -1031,25 +1031,25 @@ discard block |
||
1031 | 1031 | /** |
1032 | 1032 | * Output the connected. |
1033 | 1033 | */ |
1034 | -function lsx_hp_recipe_plan_meta( $args = array() ) { |
|
1034 | +function lsx_hp_recipe_plan_meta($args = array()) { |
|
1035 | 1035 | $defaults = array(); |
1036 | 1036 | $top_level_plans = array(); |
1037 | 1037 | // Get meals this exercise is connected to. |
1038 | - $plans = get_post_meta( get_the_ID(), 'connected_plans', true ); |
|
1039 | - if ( ! empty( $plans ) ) { |
|
1040 | - $plan = end( $plans ); |
|
1041 | - $has_parent = wp_get_post_parent_id( $plan ); |
|
1042 | - if ( 0 === $has_parent ) { |
|
1038 | + $plans = get_post_meta(get_the_ID(), 'connected_plans', true); |
|
1039 | + if ( ! empty($plans)) { |
|
1040 | + $plan = end($plans); |
|
1041 | + $has_parent = wp_get_post_parent_id($plan); |
|
1042 | + if (0 === $has_parent) { |
|
1043 | 1043 | $top_level_plans[] = $plan; |
1044 | - } elseif ( false !== $top_level_plans ) { |
|
1044 | + } elseif (false !== $top_level_plans) { |
|
1045 | 1045 | $top_level_plans[] = $has_parent; |
1046 | 1046 | } |
1047 | 1047 | } |
1048 | - if ( ! empty( $top_level_plans ) && ( '' !== $top_level_plans ) ) { |
|
1049 | - $top_level_plans = array_unique( $top_level_plans ); |
|
1050 | - $top_level_plan = end( $top_level_plans ); |
|
1048 | + if ( ! empty($top_level_plans) && ('' !== $top_level_plans)) { |
|
1049 | + $top_level_plans = array_unique($top_level_plans); |
|
1050 | + $top_level_plan = end($top_level_plans); |
|
1051 | 1051 | ?> |
1052 | - <span class="recipe-type recipe-parent"><?php echo esc_html( get_the_title( $top_level_plan ) ); ?></span> |
|
1052 | + <span class="recipe-type recipe-parent"><?php echo esc_html(get_the_title($top_level_plan)); ?></span> |
|
1053 | 1053 | <?php |
1054 | 1054 | } |
1055 | 1055 | } |
@@ -1062,23 +1062,23 @@ discard block |
||
1062 | 1062 | $top_level_plans = array(); |
1063 | 1063 | |
1064 | 1064 | // Get workouts this exercise is connected to. |
1065 | - $workouts = get_post_meta( get_the_ID(), 'connected_workouts', true ); |
|
1065 | + $workouts = get_post_meta(get_the_ID(), 'connected_workouts', true); |
|
1066 | 1066 | |
1067 | - if ( '' !== $workouts && ! is_array( $workouts ) ) { |
|
1068 | - $workouts = array( $workouts ); |
|
1067 | + if ('' !== $workouts && ! is_array($workouts)) { |
|
1068 | + $workouts = array($workouts); |
|
1069 | 1069 | } |
1070 | - if ( ! empty( $workouts ) ) { |
|
1071 | - foreach ( $workouts as $workout ) { |
|
1070 | + if ( ! empty($workouts)) { |
|
1071 | + foreach ($workouts as $workout) { |
|
1072 | 1072 | // Get the plans this workout is connected to. |
1073 | - $plans = get_post_meta( $workout, 'connected_plans', true ); |
|
1073 | + $plans = get_post_meta($workout, 'connected_plans', true); |
|
1074 | 1074 | |
1075 | - if ( '' !== $plans && ! is_array( $plans ) ) { |
|
1076 | - $plans = array( $plans ); |
|
1075 | + if ('' !== $plans && ! is_array($plans)) { |
|
1076 | + $plans = array($plans); |
|
1077 | 1077 | } |
1078 | - if ( ! empty( $plans ) ) { |
|
1079 | - foreach ( $plans as $plan ) { |
|
1080 | - $has_parent = wp_get_post_parent_id( $plan ); |
|
1081 | - if ( 0 === $has_parent ) { |
|
1078 | + if ( ! empty($plans)) { |
|
1079 | + foreach ($plans as $plan) { |
|
1080 | + $has_parent = wp_get_post_parent_id($plan); |
|
1081 | + if (0 === $has_parent) { |
|
1082 | 1082 | $top_level_plans = $plan; |
1083 | 1083 | } else { |
1084 | 1084 | $top_level_plans = $has_parent; |
@@ -1088,11 +1088,11 @@ discard block |
||
1088 | 1088 | } |
1089 | 1089 | } |
1090 | 1090 | |
1091 | - if ( ! empty( $top_level_plans ) && ( '' !== $top_level_plans ) ) { |
|
1092 | - $top_level_plans = array_unique( $top_level_plans ); |
|
1093 | - $top_level_plan = end( $top_level_plans ); |
|
1091 | + if ( ! empty($top_level_plans) && ('' !== $top_level_plans)) { |
|
1092 | + $top_level_plans = array_unique($top_level_plans); |
|
1093 | + $top_level_plan = end($top_level_plans); |
|
1094 | 1094 | ?> |
1095 | - <span class="recipe-type recipe-parent"><?php echo esc_html( get_the_title( $top_level_plan ) ); ?></span> |
|
1095 | + <span class="recipe-type recipe-parent"><?php echo esc_html(get_the_title($top_level_plan)); ?></span> |
|
1096 | 1096 | <?php |
1097 | 1097 | } |
1098 | 1098 | } |
@@ -1103,12 +1103,12 @@ discard block |
||
1103 | 1103 | * @param [type] $related_content |
1104 | 1104 | * @return void |
1105 | 1105 | */ |
1106 | -function lsx_hp_single_related( $related_content, $post_type_text ) { |
|
1106 | +function lsx_hp_single_related($related_content, $post_type_text) { |
|
1107 | 1107 | ?> |
1108 | 1108 | <section id="lsx-hp-related"> |
1109 | 1109 | <div class="row lsx-related-posts lsx-related-posts-title"> |
1110 | 1110 | <div class="col-xs-12"> |
1111 | - <h2 class="lsx-related-posts-headline"><?php echo esc_html( $post_type_text ); ?></h2> |
|
1111 | + <h2 class="lsx-related-posts-headline"><?php echo esc_html($post_type_text); ?></h2> |
|
1112 | 1112 | </div> |
1113 | 1113 | </div> |
1114 | 1114 | <div class="row lsx-related-posts lsx-related-posts-content"> |
@@ -1116,26 +1116,26 @@ discard block |
||
1116 | 1116 | <div class="lsx-related-posts-wrapper"> |
1117 | 1117 | <?php |
1118 | 1118 | $i = 0; |
1119 | - foreach ( $related_content as $article ) { |
|
1120 | - $post_title = get_the_title( $article ); |
|
1121 | - $post_categories = wp_get_post_categories( $article ); |
|
1122 | - $post_link = get_permalink( $article ); |
|
1119 | + foreach ($related_content as $article) { |
|
1120 | + $post_title = get_the_title($article); |
|
1121 | + $post_categories = wp_get_post_categories($article); |
|
1122 | + $post_link = get_permalink($article); |
|
1123 | 1123 | |
1124 | 1124 | $cats = array(); |
1125 | 1125 | ?> |
1126 | - <article id="post-<?php echo esc_html( $article ); ?>" class="lsx-slot post"> |
|
1126 | + <article id="post-<?php echo esc_html($article); ?>" class="lsx-slot post"> |
|
1127 | 1127 | <div class="entry-layout lsx-hp-shadow"> |
1128 | 1128 | <div class="entry-layout-content"> |
1129 | 1129 | <header class="entry-header"> |
1130 | 1130 | <div class="entry-image"> |
1131 | - <a href="<?php echo esc_url( $post_link ); ?>" class="thumbnail"> |
|
1131 | + <a href="<?php echo esc_url($post_link); ?>" class="thumbnail"> |
|
1132 | 1132 | <?php |
1133 | - $featured_image = get_the_post_thumbnail( $article, 'lsx-thumbnail-wide' ); |
|
1134 | - if ( ! empty( $featured_image ) && '' !== $featured_image ) { |
|
1135 | - echo wp_kses_post( $featured_image ); |
|
1133 | + $featured_image = get_the_post_thumbnail($article, 'lsx-thumbnail-wide'); |
|
1134 | + if ( ! empty($featured_image) && '' !== $featured_image) { |
|
1135 | + echo wp_kses_post($featured_image); |
|
1136 | 1136 | } else { |
1137 | 1137 | ?> |
1138 | - <img loading="lazy" class="placeholder" src="<?php echo esc_attr( plugin_dir_url( __FILE__ ) . '../assets/images/placeholder.jpg' ); ?>"> |
|
1138 | + <img loading="lazy" class="placeholder" src="<?php echo esc_attr(plugin_dir_url(__FILE__) . '../assets/images/placeholder.jpg'); ?>"> |
|
1139 | 1139 | <?php |
1140 | 1140 | } |
1141 | 1141 | ?> |
@@ -1143,18 +1143,18 @@ discard block |
||
1143 | 1143 | </div> |
1144 | 1144 | <div class="entry-meta"> |
1145 | 1145 | <?php |
1146 | - foreach ( $post_categories as $c ) { |
|
1147 | - $cat = get_category( $c ); |
|
1146 | + foreach ($post_categories as $c) { |
|
1147 | + $cat = get_category($c); |
|
1148 | 1148 | /* Translators: %s: category name */ |
1149 | - $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>'; |
|
1149 | + $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>'; |
|
1150 | 1150 | } |
1151 | - if ( ! empty( $cats ) ) { ?> |
|
1152 | - <div class="post-categories"><span></span><?php echo wp_kses_post( implode( ', ', $cats ) ); ?></div> |
|
1151 | + if ( ! empty($cats)) { ?> |
|
1152 | + <div class="post-categories"><span></span><?php echo wp_kses_post(implode(', ', $cats)); ?></div> |
|
1153 | 1153 | <?php } ?> |
1154 | 1154 | </div> |
1155 | 1155 | <h2 class="entry-title"> |
1156 | - <a href="<?php echo esc_url( $post_link ); ?>"> |
|
1157 | - <?php echo esc_html( $post_title ); ?> |
|
1156 | + <a href="<?php echo esc_url($post_link); ?>"> |
|
1157 | + <?php echo esc_html($post_title); ?> |
|
1158 | 1158 | </a> |
1159 | 1159 | </h2> |
1160 | 1160 | </header> |
@@ -1178,27 +1178,27 @@ discard block |
||
1178 | 1178 | * @param [type] $connected_members |
1179 | 1179 | * @return void |
1180 | 1180 | */ |
1181 | -function lsx_hp_member_connected( $connected_members, $post_type ) { |
|
1182 | - if ( ! empty( $connected_members ) ) { |
|
1181 | +function lsx_hp_member_connected($connected_members, $post_type) { |
|
1182 | + if ( ! empty($connected_members)) { |
|
1183 | 1183 | $content = '<div id="hp-connected-members" class="hp-connected-members connected-' . $post_type . '">'; |
1184 | - foreach ( $connected_members as $member ) { |
|
1185 | - $post_link = get_permalink( $member ); |
|
1186 | - $member_name = get_the_title( $member ); |
|
1184 | + foreach ($connected_members as $member) { |
|
1185 | + $post_link = get_permalink($member); |
|
1186 | + $member_name = get_the_title($member); |
|
1187 | 1187 | $member_name = '<span class="lsx-team-name">' . $member_name . '</span>'; |
1188 | 1188 | |
1189 | 1189 | $member_link = '<a href="' . $post_link . '" >' . $member_name . '</a>'; |
1190 | 1190 | |
1191 | 1191 | $roles = ''; |
1192 | - $terms = get_the_terms( $member, 'team_role' ); |
|
1192 | + $terms = get_the_terms($member, 'team_role'); |
|
1193 | 1193 | |
1194 | - if ( $terms && ! is_wp_error( $terms ) ) { |
|
1194 | + if ($terms && ! is_wp_error($terms)) { |
|
1195 | 1195 | $roles = array(); |
1196 | 1196 | |
1197 | - foreach ( $terms as $term ) { |
|
1197 | + foreach ($terms as $term) { |
|
1198 | 1198 | $roles[] = $term->name; |
1199 | 1199 | } |
1200 | 1200 | |
1201 | - $roles = join( ', ', $roles ); |
|
1201 | + $roles = join(', ', $roles); |
|
1202 | 1202 | } |
1203 | 1203 | $member_roles = '' !== $roles ? "<small class='lsx-team-roles'>$roles</small>" : ''; |
1204 | 1204 |
@@ -8,148 +8,148 @@ |
||
8 | 8 | */ |
9 | 9 | class LSX_Team { |
10 | 10 | |
11 | - /** |
|
12 | - * Holds class instance |
|
13 | - * |
|
14 | - * @var object \lsx_health_plan\classes\LSX_Team() |
|
15 | - */ |
|
16 | - protected static $instance = null; |
|
11 | + /** |
|
12 | + * Holds class instance |
|
13 | + * |
|
14 | + * @var object \lsx_health_plan\classes\LSX_Team() |
|
15 | + */ |
|
16 | + protected static $instance = null; |
|
17 | 17 | |
18 | - /** |
|
19 | - * Constructor. |
|
20 | - */ |
|
21 | - public function __construct() { |
|
22 | - $this->default_types = array( |
|
23 | - \lsx_health_plan\functions\get_option( 'endpoint_meal', 'meal' ), |
|
24 | - \lsx_health_plan\functions\get_option( 'endpoint_exercise_single', 'exercise' ), |
|
25 | - \lsx_health_plan\functions\get_option( 'endpoint_recipe_single', 'recipe' ), |
|
26 | - \lsx_health_plan\functions\get_option( 'endpoint_workout', 'workout' ), |
|
27 | - \lsx_health_plan\functions\get_option( 'endpoint_plan', 'plan' ), |
|
28 | - ); |
|
29 | - add_action( 'wp_enqueue_scripts', array( $this, 'assets' ), 5 ); |
|
30 | - add_action( 'cmb2_admin_init', array( $this, 'related_team_metabox' ) ); |
|
31 | - add_action( 'cmb2_admin_init', array( $this, 'additional_single_team_metabox' ) ); |
|
32 | - add_action( 'lsx_entry_bottom', array( $this, 'hp_team_member_tabs' ) ); |
|
33 | - add_action( 'wp_head', array( $this, 'remove_archive_original_team_header' ), 99 ); |
|
34 | - } |
|
18 | + /** |
|
19 | + * Constructor. |
|
20 | + */ |
|
21 | + public function __construct() { |
|
22 | + $this->default_types = array( |
|
23 | + \lsx_health_plan\functions\get_option( 'endpoint_meal', 'meal' ), |
|
24 | + \lsx_health_plan\functions\get_option( 'endpoint_exercise_single', 'exercise' ), |
|
25 | + \lsx_health_plan\functions\get_option( 'endpoint_recipe_single', 'recipe' ), |
|
26 | + \lsx_health_plan\functions\get_option( 'endpoint_workout', 'workout' ), |
|
27 | + \lsx_health_plan\functions\get_option( 'endpoint_plan', 'plan' ), |
|
28 | + ); |
|
29 | + add_action( 'wp_enqueue_scripts', array( $this, 'assets' ), 5 ); |
|
30 | + add_action( 'cmb2_admin_init', array( $this, 'related_team_metabox' ) ); |
|
31 | + add_action( 'cmb2_admin_init', array( $this, 'additional_single_team_metabox' ) ); |
|
32 | + add_action( 'lsx_entry_bottom', array( $this, 'hp_team_member_tabs' ) ); |
|
33 | + add_action( 'wp_head', array( $this, 'remove_archive_original_team_header' ), 99 ); |
|
34 | + } |
|
35 | 35 | |
36 | - /** |
|
37 | - * Return an instance of this class. |
|
38 | - * |
|
39 | - * @since 1.0.0 |
|
40 | - * |
|
41 | - * @return object \lsx_health_plan\classes\LSX_Team() A single instance of this class. |
|
42 | - */ |
|
43 | - public static function get_instance() { |
|
44 | - // If the single instance hasn't been set, set it now. |
|
45 | - if ( null === self::$instance ) { |
|
46 | - self::$instance = new self(); |
|
47 | - } |
|
48 | - return self::$instance; |
|
49 | - } |
|
36 | + /** |
|
37 | + * Return an instance of this class. |
|
38 | + * |
|
39 | + * @since 1.0.0 |
|
40 | + * |
|
41 | + * @return object \lsx_health_plan\classes\LSX_Team() A single instance of this class. |
|
42 | + */ |
|
43 | + public static function get_instance() { |
|
44 | + // If the single instance hasn't been set, set it now. |
|
45 | + if ( null === self::$instance ) { |
|
46 | + self::$instance = new self(); |
|
47 | + } |
|
48 | + return self::$instance; |
|
49 | + } |
|
50 | 50 | |
51 | - /** |
|
52 | - * Load lsx team related css. |
|
53 | - * |
|
54 | - * @package lsx |
|
55 | - * @subpackage lsx-health-plan |
|
56 | - * |
|
57 | - */ |
|
58 | - public function assets() { |
|
59 | - wp_enqueue_style( 'lsx-health-plan-team', LSX_HEALTH_PLAN_URL . 'assets/css/lsx-health-plan-team.css', array(), LSX_HEALTH_PLAN_VER ); |
|
60 | - } |
|
51 | + /** |
|
52 | + * Load lsx team related css. |
|
53 | + * |
|
54 | + * @package lsx |
|
55 | + * @subpackage lsx-health-plan |
|
56 | + * |
|
57 | + */ |
|
58 | + public function assets() { |
|
59 | + wp_enqueue_style( 'lsx-health-plan-team', LSX_HEALTH_PLAN_URL . 'assets/css/lsx-health-plan-team.css', array(), LSX_HEALTH_PLAN_VER ); |
|
60 | + } |
|
61 | 61 | |
62 | - /** |
|
63 | - * Define the related team member metabox and field configurations. |
|
64 | - */ |
|
65 | - public function related_team_metabox() { |
|
66 | - foreach ( $this->default_types as $type => $default_type ) { |
|
67 | - $cmb = new_cmb2_box( |
|
68 | - array( |
|
69 | - 'id' => $default_type . '_related_team_member__metabox', |
|
70 | - 'title' => __( 'Related Team Member', 'lsx-health-plan' ), |
|
71 | - 'object_types' => array( $default_type ), // Post type. |
|
72 | - 'context' => 'normal', |
|
73 | - 'priority' => 'low', |
|
74 | - 'show_names' => true, |
|
75 | - ) |
|
76 | - ); |
|
62 | + /** |
|
63 | + * Define the related team member metabox and field configurations. |
|
64 | + */ |
|
65 | + public function related_team_metabox() { |
|
66 | + foreach ( $this->default_types as $type => $default_type ) { |
|
67 | + $cmb = new_cmb2_box( |
|
68 | + array( |
|
69 | + 'id' => $default_type . '_related_team_member__metabox', |
|
70 | + 'title' => __( 'Related Team Member', 'lsx-health-plan' ), |
|
71 | + 'object_types' => array( $default_type ), // Post type. |
|
72 | + 'context' => 'normal', |
|
73 | + 'priority' => 'low', |
|
74 | + 'show_names' => true, |
|
75 | + ) |
|
76 | + ); |
|
77 | 77 | |
78 | - $cmb->add_field( |
|
79 | - array( |
|
80 | - 'name' => __( 'Related Team Member', 'lsx-health-plan' ), |
|
81 | - 'desc' => __( 'Connect the related team member that applies to this ', 'lsx-health-plan' ) . $default_type, |
|
82 | - 'id' => $default_type . '_connected_team_member', |
|
83 | - 'type' => 'post_search_ajax', |
|
84 | - 'limit' => 4, // Limit selection to X items only (default 1). |
|
85 | - 'sortable' => true, // Allow selected items to be sortable (default false). |
|
86 | - 'query_args' => array( |
|
87 | - 'post_type' => array( 'team' ), |
|
88 | - 'post_status' => array( 'publish' ), |
|
89 | - 'posts_per_page' => -1, |
|
90 | - ), |
|
91 | - ) |
|
92 | - ); |
|
93 | - } |
|
78 | + $cmb->add_field( |
|
79 | + array( |
|
80 | + 'name' => __( 'Related Team Member', 'lsx-health-plan' ), |
|
81 | + 'desc' => __( 'Connect the related team member that applies to this ', 'lsx-health-plan' ) . $default_type, |
|
82 | + 'id' => $default_type . '_connected_team_member', |
|
83 | + 'type' => 'post_search_ajax', |
|
84 | + 'limit' => 4, // Limit selection to X items only (default 1). |
|
85 | + 'sortable' => true, // Allow selected items to be sortable (default false). |
|
86 | + 'query_args' => array( |
|
87 | + 'post_type' => array( 'team' ), |
|
88 | + 'post_status' => array( 'publish' ), |
|
89 | + 'posts_per_page' => -1, |
|
90 | + ), |
|
91 | + ) |
|
92 | + ); |
|
93 | + } |
|
94 | 94 | |
95 | - } |
|
95 | + } |
|
96 | 96 | |
97 | - /** |
|
98 | - * Adding additional custom fields to the single members, related with Health Plan. |
|
99 | - */ |
|
100 | - public function additional_single_team_metabox() { |
|
101 | - $cmb = new_cmb2_box( |
|
102 | - array( |
|
103 | - 'id' => 'lsx__team', |
|
104 | - 'title' => '', |
|
105 | - 'object_types' => array( 'team' ), // Post type. |
|
106 | - 'context' => 'normal', |
|
107 | - 'priority' => 'high', |
|
108 | - 'show_names' => true, |
|
109 | - ) |
|
110 | - ); |
|
97 | + /** |
|
98 | + * Adding additional custom fields to the single members, related with Health Plan. |
|
99 | + */ |
|
100 | + public function additional_single_team_metabox() { |
|
101 | + $cmb = new_cmb2_box( |
|
102 | + array( |
|
103 | + 'id' => 'lsx__team', |
|
104 | + 'title' => '', |
|
105 | + 'object_types' => array( 'team' ), // Post type. |
|
106 | + 'context' => 'normal', |
|
107 | + 'priority' => 'high', |
|
108 | + 'show_names' => true, |
|
109 | + ) |
|
110 | + ); |
|
111 | 111 | |
112 | - $cmb->add_field( |
|
113 | - array( |
|
114 | - 'name' => __( 'Team Member Experience', 'lsx-health-plan' ), |
|
115 | - 'desc' => __( 'Add additional experience to this team member', 'lsx-health-plan' ), |
|
116 | - 'id' => 'team_member_experience', |
|
117 | - 'type' => 'wysiwyg', |
|
118 | - ) |
|
119 | - ); |
|
112 | + $cmb->add_field( |
|
113 | + array( |
|
114 | + 'name' => __( 'Team Member Experience', 'lsx-health-plan' ), |
|
115 | + 'desc' => __( 'Add additional experience to this team member', 'lsx-health-plan' ), |
|
116 | + 'id' => 'team_member_experience', |
|
117 | + 'type' => 'wysiwyg', |
|
118 | + ) |
|
119 | + ); |
|
120 | 120 | |
121 | - $cmb->add_field( |
|
122 | - array( |
|
123 | - 'name' => __( 'Featured Plans', 'lsx-health-plan' ), |
|
124 | - 'desc' => __( 'Connect the related plans to this team member', 'lsx-health-plan' ), |
|
125 | - 'id' => 'connected_team_member_plan', |
|
126 | - 'type' => 'post_search_ajax', |
|
127 | - 'limit' => 3, |
|
128 | - 'sortable' => true, |
|
129 | - 'query_args' => array( |
|
130 | - 'post_type' => array( 'plan' ), |
|
131 | - 'post_status' => array( 'publish' ), |
|
132 | - 'posts_per_page' => -1, |
|
133 | - ), |
|
134 | - ) |
|
135 | - ); |
|
121 | + $cmb->add_field( |
|
122 | + array( |
|
123 | + 'name' => __( 'Featured Plans', 'lsx-health-plan' ), |
|
124 | + 'desc' => __( 'Connect the related plans to this team member', 'lsx-health-plan' ), |
|
125 | + 'id' => 'connected_team_member_plan', |
|
126 | + 'type' => 'post_search_ajax', |
|
127 | + 'limit' => 3, |
|
128 | + 'sortable' => true, |
|
129 | + 'query_args' => array( |
|
130 | + 'post_type' => array( 'plan' ), |
|
131 | + 'post_status' => array( 'publish' ), |
|
132 | + 'posts_per_page' => -1, |
|
133 | + ), |
|
134 | + ) |
|
135 | + ); |
|
136 | 136 | |
137 | - } |
|
137 | + } |
|
138 | 138 | |
139 | - /** |
|
140 | - * Adds custom tabs to the team member single pages. |
|
141 | - * |
|
142 | - * @return void |
|
143 | - */ |
|
144 | - public function hp_team_member_tabs() { |
|
145 | - if ( is_single() && is_singular( 'team' ) ) { |
|
146 | - require_once LSX_HEALTH_PLAN_PATH . '/includes/template-tags/team.php'; |
|
147 | - } |
|
148 | - } |
|
139 | + /** |
|
140 | + * Adds custom tabs to the team member single pages. |
|
141 | + * |
|
142 | + * @return void |
|
143 | + */ |
|
144 | + public function hp_team_member_tabs() { |
|
145 | + if ( is_single() && is_singular( 'team' ) ) { |
|
146 | + require_once LSX_HEALTH_PLAN_PATH . '/includes/template-tags/team.php'; |
|
147 | + } |
|
148 | + } |
|
149 | 149 | |
150 | - public function remove_archive_original_team_header() { |
|
151 | - if ( is_single() && is_singular( 'team' ) ) { |
|
152 | - remove_action( 'lsx_content_wrap_before', 'lsx_global_header' ); |
|
153 | - } |
|
154 | - } |
|
150 | + public function remove_archive_original_team_header() { |
|
151 | + if ( is_single() && is_singular( 'team' ) ) { |
|
152 | + remove_action( 'lsx_content_wrap_before', 'lsx_global_header' ); |
|
153 | + } |
|
154 | + } |
|
155 | 155 | } |
@@ -20,17 +20,17 @@ discard block |
||
20 | 20 | */ |
21 | 21 | public function __construct() { |
22 | 22 | $this->default_types = array( |
23 | - \lsx_health_plan\functions\get_option( 'endpoint_meal', 'meal' ), |
|
24 | - \lsx_health_plan\functions\get_option( 'endpoint_exercise_single', 'exercise' ), |
|
25 | - \lsx_health_plan\functions\get_option( 'endpoint_recipe_single', 'recipe' ), |
|
26 | - \lsx_health_plan\functions\get_option( 'endpoint_workout', 'workout' ), |
|
27 | - \lsx_health_plan\functions\get_option( 'endpoint_plan', 'plan' ), |
|
23 | + \lsx_health_plan\functions\get_option('endpoint_meal', 'meal'), |
|
24 | + \lsx_health_plan\functions\get_option('endpoint_exercise_single', 'exercise'), |
|
25 | + \lsx_health_plan\functions\get_option('endpoint_recipe_single', 'recipe'), |
|
26 | + \lsx_health_plan\functions\get_option('endpoint_workout', 'workout'), |
|
27 | + \lsx_health_plan\functions\get_option('endpoint_plan', 'plan'), |
|
28 | 28 | ); |
29 | - add_action( 'wp_enqueue_scripts', array( $this, 'assets' ), 5 ); |
|
30 | - add_action( 'cmb2_admin_init', array( $this, 'related_team_metabox' ) ); |
|
31 | - add_action( 'cmb2_admin_init', array( $this, 'additional_single_team_metabox' ) ); |
|
32 | - add_action( 'lsx_entry_bottom', array( $this, 'hp_team_member_tabs' ) ); |
|
33 | - add_action( 'wp_head', array( $this, 'remove_archive_original_team_header' ), 99 ); |
|
29 | + add_action('wp_enqueue_scripts', array($this, 'assets'), 5); |
|
30 | + add_action('cmb2_admin_init', array($this, 'related_team_metabox')); |
|
31 | + add_action('cmb2_admin_init', array($this, 'additional_single_team_metabox')); |
|
32 | + add_action('lsx_entry_bottom', array($this, 'hp_team_member_tabs')); |
|
33 | + add_action('wp_head', array($this, 'remove_archive_original_team_header'), 99); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | /** |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | */ |
43 | 43 | public static function get_instance() { |
44 | 44 | // If the single instance hasn't been set, set it now. |
45 | - if ( null === self::$instance ) { |
|
45 | + if (null === self::$instance) { |
|
46 | 46 | self::$instance = new self(); |
47 | 47 | } |
48 | 48 | return self::$instance; |
@@ -56,19 +56,19 @@ discard block |
||
56 | 56 | * |
57 | 57 | */ |
58 | 58 | public function assets() { |
59 | - wp_enqueue_style( 'lsx-health-plan-team', LSX_HEALTH_PLAN_URL . 'assets/css/lsx-health-plan-team.css', array(), LSX_HEALTH_PLAN_VER ); |
|
59 | + wp_enqueue_style('lsx-health-plan-team', LSX_HEALTH_PLAN_URL . 'assets/css/lsx-health-plan-team.css', array(), LSX_HEALTH_PLAN_VER); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
63 | 63 | * Define the related team member metabox and field configurations. |
64 | 64 | */ |
65 | 65 | public function related_team_metabox() { |
66 | - foreach ( $this->default_types as $type => $default_type ) { |
|
66 | + foreach ($this->default_types as $type => $default_type) { |
|
67 | 67 | $cmb = new_cmb2_box( |
68 | 68 | array( |
69 | 69 | 'id' => $default_type . '_related_team_member__metabox', |
70 | - 'title' => __( 'Related Team Member', 'lsx-health-plan' ), |
|
71 | - 'object_types' => array( $default_type ), // Post type. |
|
70 | + 'title' => __('Related Team Member', 'lsx-health-plan'), |
|
71 | + 'object_types' => array($default_type), // Post type. |
|
72 | 72 | 'context' => 'normal', |
73 | 73 | 'priority' => 'low', |
74 | 74 | 'show_names' => true, |
@@ -77,15 +77,15 @@ discard block |
||
77 | 77 | |
78 | 78 | $cmb->add_field( |
79 | 79 | array( |
80 | - 'name' => __( 'Related Team Member', 'lsx-health-plan' ), |
|
81 | - 'desc' => __( 'Connect the related team member that applies to this ', 'lsx-health-plan' ) . $default_type, |
|
80 | + 'name' => __('Related Team Member', 'lsx-health-plan'), |
|
81 | + 'desc' => __('Connect the related team member that applies to this ', 'lsx-health-plan') . $default_type, |
|
82 | 82 | 'id' => $default_type . '_connected_team_member', |
83 | 83 | 'type' => 'post_search_ajax', |
84 | - 'limit' => 4, // Limit selection to X items only (default 1). |
|
84 | + 'limit' => 4, // Limit selection to X items only (default 1). |
|
85 | 85 | 'sortable' => true, // Allow selected items to be sortable (default false). |
86 | 86 | 'query_args' => array( |
87 | - 'post_type' => array( 'team' ), |
|
88 | - 'post_status' => array( 'publish' ), |
|
87 | + 'post_type' => array('team'), |
|
88 | + 'post_status' => array('publish'), |
|
89 | 89 | 'posts_per_page' => -1, |
90 | 90 | ), |
91 | 91 | ) |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | array( |
103 | 103 | 'id' => 'lsx__team', |
104 | 104 | 'title' => '', |
105 | - 'object_types' => array( 'team' ), // Post type. |
|
105 | + 'object_types' => array('team'), // Post type. |
|
106 | 106 | 'context' => 'normal', |
107 | 107 | 'priority' => 'high', |
108 | 108 | 'show_names' => true, |
@@ -111,8 +111,8 @@ discard block |
||
111 | 111 | |
112 | 112 | $cmb->add_field( |
113 | 113 | array( |
114 | - 'name' => __( 'Team Member Experience', 'lsx-health-plan' ), |
|
115 | - 'desc' => __( 'Add additional experience to this team member', 'lsx-health-plan' ), |
|
114 | + 'name' => __('Team Member Experience', 'lsx-health-plan'), |
|
115 | + 'desc' => __('Add additional experience to this team member', 'lsx-health-plan'), |
|
116 | 116 | 'id' => 'team_member_experience', |
117 | 117 | 'type' => 'wysiwyg', |
118 | 118 | ) |
@@ -120,15 +120,15 @@ discard block |
||
120 | 120 | |
121 | 121 | $cmb->add_field( |
122 | 122 | array( |
123 | - 'name' => __( 'Featured Plans', 'lsx-health-plan' ), |
|
124 | - 'desc' => __( 'Connect the related plans to this team member', 'lsx-health-plan' ), |
|
123 | + 'name' => __('Featured Plans', 'lsx-health-plan'), |
|
124 | + 'desc' => __('Connect the related plans to this team member', 'lsx-health-plan'), |
|
125 | 125 | 'id' => 'connected_team_member_plan', |
126 | 126 | 'type' => 'post_search_ajax', |
127 | 127 | 'limit' => 3, |
128 | 128 | 'sortable' => true, |
129 | 129 | 'query_args' => array( |
130 | - 'post_type' => array( 'plan' ), |
|
131 | - 'post_status' => array( 'publish' ), |
|
130 | + 'post_type' => array('plan'), |
|
131 | + 'post_status' => array('publish'), |
|
132 | 132 | 'posts_per_page' => -1, |
133 | 133 | ), |
134 | 134 | ) |
@@ -142,14 +142,14 @@ discard block |
||
142 | 142 | * @return void |
143 | 143 | */ |
144 | 144 | public function hp_team_member_tabs() { |
145 | - if ( is_single() && is_singular( 'team' ) ) { |
|
145 | + if (is_single() && is_singular('team')) { |
|
146 | 146 | require_once LSX_HEALTH_PLAN_PATH . '/includes/template-tags/team.php'; |
147 | 147 | } |
148 | 148 | } |
149 | 149 | |
150 | 150 | public function remove_archive_original_team_header() { |
151 | - if ( is_single() && is_singular( 'team' ) ) { |
|
152 | - remove_action( 'lsx_content_wrap_before', 'lsx_global_header' ); |
|
151 | + if (is_single() && is_singular('team')) { |
|
152 | + remove_action('lsx_content_wrap_before', 'lsx_global_header'); |
|
153 | 153 | } |
154 | 154 | } |
155 | 155 | } |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | * Constructor |
26 | 26 | */ |
27 | 27 | public function __construct() { |
28 | - add_action( 'lsx_hp_settings_page_meal_top', array( $this, 'settings' ), 1, 1 ); |
|
28 | + add_action('lsx_hp_settings_page_meal_top', array($this, 'settings'), 1, 1); |
|
29 | 29 | } |
30 | 30 | |
31 | 31 | /** |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | */ |
38 | 38 | public static function get_instance() { |
39 | 39 | // If the single instance hasn't been set, set it now. |
40 | - if ( null === self::$instance ) { |
|
40 | + if (null === self::$instance) { |
|
41 | 41 | self::$instance = new self(); |
42 | 42 | } |
43 | 43 | return self::$instance; |
@@ -49,15 +49,15 @@ discard block |
||
49 | 49 | * @param object $cmb new_cmb2_box(). |
50 | 50 | * @return void |
51 | 51 | */ |
52 | - public function settings( $cmb ) { |
|
52 | + public function settings($cmb) { |
|
53 | 53 | $cmb->add_field( |
54 | 54 | array( |
55 | - 'name' => __( 'Disable Meals', 'lsx-health-plan' ), |
|
55 | + 'name' => __('Disable Meals', 'lsx-health-plan'), |
|
56 | 56 | 'id' => 'meal_disabled', |
57 | 57 | 'type' => 'checkbox', |
58 | 58 | 'value' => 1, |
59 | 59 | 'default' => 0, |
60 | - 'description' => __( 'Disable meal post type if you are wanting a minimal site.', 'lsx-health-plan' ), |
|
60 | + 'description' => __('Disable meal post type if you are wanting a minimal site.', 'lsx-health-plan'), |
|
61 | 61 | ) |
62 | 62 | ); |
63 | 63 | |
@@ -65,8 +65,8 @@ discard block |
||
65 | 65 | array( |
66 | 66 | 'id' => 'meal_archive_description', |
67 | 67 | 'type' => 'wysiwyg', |
68 | - 'name' => __( 'Archive Description', 'lsx-health-plan' ), |
|
69 | - 'description' => __( 'This will show up on the post type archive.', 'lsx-health-plan' ), |
|
68 | + 'name' => __('Archive Description', 'lsx-health-plan'), |
|
69 | + 'description' => __('This will show up on the post type archive.', 'lsx-health-plan'), |
|
70 | 70 | 'options' => array( |
71 | 71 | 'textarea_rows' => get_option('default_post_edit_rows', 6), |
72 | 72 | ), |
@@ -75,18 +75,18 @@ discard block |
||
75 | 75 | |
76 | 76 | $cmb->add_field( |
77 | 77 | array( |
78 | - 'name' => __( 'Your Meal Plan Intro', 'lsx-health-plan' ), |
|
78 | + 'name' => __('Your Meal Plan Intro', 'lsx-health-plan'), |
|
79 | 79 | 'id' => 'meal_plan_intro', |
80 | 80 | 'type' => 'textarea_small', |
81 | 81 | 'value' => '', |
82 | - 'default' => __( 'Get the right mix of nutrients to keep muscles strong & healthy.', 'lsx-health-plan' ), |
|
82 | + 'default' => __('Get the right mix of nutrients to keep muscles strong & healthy.', 'lsx-health-plan'), |
|
83 | 83 | ) |
84 | 84 | ); |
85 | 85 | |
86 | 86 | $cmb->add_field( |
87 | 87 | array( |
88 | 88 | 'before_row' => '<h4><b><u>URL Slug Options</u></b></h4><p style="font-style: italic;">If you need to translate the custom slug for this custom post type, do so below.</p>', |
89 | - 'name' => __( 'Meal Slug', 'lsx-health-plan' ), |
|
89 | + 'name' => __('Meal Slug', 'lsx-health-plan'), |
|
90 | 90 | 'id' => 'endpoint_meal', |
91 | 91 | 'type' => 'input', |
92 | 92 | 'value' => '', |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | ); |
96 | 96 | $cmb->add_field( |
97 | 97 | array( |
98 | - 'name' => __( 'Meals Archive Slug', 'lsx-health-plan' ), |
|
98 | + 'name' => __('Meals Archive Slug', 'lsx-health-plan'), |
|
99 | 99 | 'id' => 'endpoint_meal_archive', |
100 | 100 | 'type' => 'input', |
101 | 101 | 'value' => '', |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | ); |
105 | 105 | $cmb->add_field( |
106 | 106 | array( |
107 | - 'name' => __( 'Single Meal Slug', 'lsx-health-plan' ), |
|
107 | + 'name' => __('Single Meal Slug', 'lsx-health-plan'), |
|
108 | 108 | 'id' => 'meal_single_slug', |
109 | 109 | 'type' => 'input', |
110 | 110 | 'value' => '', |
@@ -115,40 +115,40 @@ discard block |
||
115 | 115 | $cmb->add_field( |
116 | 116 | array( |
117 | 117 | 'before_row' => '<h4><b><u>Default Options</u></b></h4>', |
118 | - 'name' => __( 'Default Meal Plan', 'lsx-health-plan' ), |
|
119 | - 'description' => __( 'Set a default meal plan.', 'lsx-health-plan' ), |
|
118 | + 'name' => __('Default Meal Plan', 'lsx-health-plan'), |
|
119 | + 'description' => __('Set a default meal plan.', 'lsx-health-plan'), |
|
120 | 120 | 'limit' => 1, |
121 | 121 | 'id' => 'connected_meals', |
122 | 122 | 'type' => 'post_search_ajax', |
123 | 123 | 'query_args' => array( |
124 | 124 | 'post_type' => 'meal', |
125 | - 'post_status' => array( 'publish' ), |
|
125 | + 'post_status' => array('publish'), |
|
126 | 126 | 'posts_per_page' => -1, |
127 | 127 | ), |
128 | 128 | ) |
129 | 129 | ); |
130 | - if ( function_exists( 'download_monitor' ) ) { |
|
130 | + if (function_exists('download_monitor')) { |
|
131 | 131 | $page_url = 'https://wordpress.org/plugins/download-monitor/'; |
132 | 132 | $plugin_name = 'Download Monitor'; |
133 | 133 | $description = sprintf( |
134 | 134 | /* translators: %s: The subscription info */ |
135 | - __( 'If you are using <a target="_blank" href="%1$s">%2$s</a> you can set a default download file for your meal here.', 'lsx-search' ), |
|
135 | + __('If you are using <a target="_blank" href="%1$s">%2$s</a> you can set a default download file for your meal here.', 'lsx-search'), |
|
136 | 136 | $page_url, |
137 | 137 | $plugin_name |
138 | 138 | ); |
139 | 139 | $cmb->add_field( |
140 | 140 | array( |
141 | - 'name' => __( 'Default Meal Plan PDF', 'lsx-health-plan' ), |
|
141 | + 'name' => __('Default Meal Plan PDF', 'lsx-health-plan'), |
|
142 | 142 | 'description' => $description, |
143 | 143 | 'id' => 'download_meal', |
144 | 144 | 'type' => 'post_search_ajax', |
145 | 145 | 'limit' => 1, |
146 | 146 | 'query_args' => array( |
147 | - 'post_type' => array( 'dlm_download' ), |
|
148 | - 'post_status' => array( 'publish' ), |
|
147 | + 'post_type' => array('dlm_download'), |
|
148 | + 'post_status' => array('publish'), |
|
149 | 149 | 'posts_per_page' => -1, |
150 | 150 | ), |
151 | - 'after_row' => __( '<p style="font-style: italic;">If you have changed any URL slugs, please remember re-save your permalinks in Settings > Permalinks.</p>', 'lsx-health-plan' ), |
|
151 | + 'after_row' => __('<p style="font-style: italic;">If you have changed any URL slugs, please remember re-save your permalinks in Settings > Permalinks.</p>', 'lsx-health-plan'), |
|
152 | 152 | ) |
153 | 153 | ); |
154 | 154 | } |
@@ -12,146 +12,146 @@ |
||
12 | 12 | */ |
13 | 13 | class Meal { |
14 | 14 | |
15 | - /** |
|
16 | - * Holds class instance |
|
17 | - * |
|
18 | - * @since 1.0.0 |
|
19 | - * |
|
20 | - * @var object \lsx_health_plan\classes\admin\Meal() |
|
21 | - */ |
|
22 | - protected static $instance = null; |
|
15 | + /** |
|
16 | + * Holds class instance |
|
17 | + * |
|
18 | + * @since 1.0.0 |
|
19 | + * |
|
20 | + * @var object \lsx_health_plan\classes\admin\Meal() |
|
21 | + */ |
|
22 | + protected static $instance = null; |
|
23 | 23 | |
24 | - /** |
|
25 | - * Constructor |
|
26 | - */ |
|
27 | - public function __construct() { |
|
28 | - add_action( 'lsx_hp_settings_page_meal_top', array( $this, 'settings' ), 1, 1 ); |
|
29 | - } |
|
24 | + /** |
|
25 | + * Constructor |
|
26 | + */ |
|
27 | + public function __construct() { |
|
28 | + add_action( 'lsx_hp_settings_page_meal_top', array( $this, 'settings' ), 1, 1 ); |
|
29 | + } |
|
30 | 30 | |
31 | - /** |
|
32 | - * Return an instance of this class. |
|
33 | - * |
|
34 | - * @since 1.0.0 |
|
35 | - * |
|
36 | - * @return object \lsx_health_plan\classes\admin\Meal() A single instance of this class. |
|
37 | - */ |
|
38 | - public static function get_instance() { |
|
39 | - // If the single instance hasn't been set, set it now. |
|
40 | - if ( null === self::$instance ) { |
|
41 | - self::$instance = new self(); |
|
42 | - } |
|
43 | - return self::$instance; |
|
44 | - } |
|
31 | + /** |
|
32 | + * Return an instance of this class. |
|
33 | + * |
|
34 | + * @since 1.0.0 |
|
35 | + * |
|
36 | + * @return object \lsx_health_plan\classes\admin\Meal() A single instance of this class. |
|
37 | + */ |
|
38 | + public static function get_instance() { |
|
39 | + // If the single instance hasn't been set, set it now. |
|
40 | + if ( null === self::$instance ) { |
|
41 | + self::$instance = new self(); |
|
42 | + } |
|
43 | + return self::$instance; |
|
44 | + } |
|
45 | 45 | |
46 | - /** |
|
47 | - * Registers the general settings. |
|
48 | - * |
|
49 | - * @param object $cmb new_cmb2_box(). |
|
50 | - * @return void |
|
51 | - */ |
|
52 | - public function settings( $cmb ) { |
|
53 | - $cmb->add_field( |
|
54 | - array( |
|
55 | - 'name' => __( 'Disable Meals', 'lsx-health-plan' ), |
|
56 | - 'id' => 'meal_disabled', |
|
57 | - 'type' => 'checkbox', |
|
58 | - 'value' => 1, |
|
59 | - 'default' => 0, |
|
60 | - 'description' => __( 'Disable meal post type if you are wanting a minimal site.', 'lsx-health-plan' ), |
|
61 | - ) |
|
62 | - ); |
|
46 | + /** |
|
47 | + * Registers the general settings. |
|
48 | + * |
|
49 | + * @param object $cmb new_cmb2_box(). |
|
50 | + * @return void |
|
51 | + */ |
|
52 | + public function settings( $cmb ) { |
|
53 | + $cmb->add_field( |
|
54 | + array( |
|
55 | + 'name' => __( 'Disable Meals', 'lsx-health-plan' ), |
|
56 | + 'id' => 'meal_disabled', |
|
57 | + 'type' => 'checkbox', |
|
58 | + 'value' => 1, |
|
59 | + 'default' => 0, |
|
60 | + 'description' => __( 'Disable meal post type if you are wanting a minimal site.', 'lsx-health-plan' ), |
|
61 | + ) |
|
62 | + ); |
|
63 | 63 | |
64 | - $cmb->add_field( |
|
65 | - array( |
|
66 | - 'id' => 'meal_archive_description', |
|
67 | - 'type' => 'wysiwyg', |
|
68 | - 'name' => __( 'Archive Description', 'lsx-health-plan' ), |
|
69 | - 'description' => __( 'This will show up on the post type archive.', 'lsx-health-plan' ), |
|
70 | - 'options' => array( |
|
71 | - 'textarea_rows' => get_option('default_post_edit_rows', 6), |
|
72 | - ), |
|
73 | - ) |
|
74 | - ); |
|
64 | + $cmb->add_field( |
|
65 | + array( |
|
66 | + 'id' => 'meal_archive_description', |
|
67 | + 'type' => 'wysiwyg', |
|
68 | + 'name' => __( 'Archive Description', 'lsx-health-plan' ), |
|
69 | + 'description' => __( 'This will show up on the post type archive.', 'lsx-health-plan' ), |
|
70 | + 'options' => array( |
|
71 | + 'textarea_rows' => get_option('default_post_edit_rows', 6), |
|
72 | + ), |
|
73 | + ) |
|
74 | + ); |
|
75 | 75 | |
76 | - $cmb->add_field( |
|
77 | - array( |
|
78 | - 'name' => __( 'Your Meal Plan Intro', 'lsx-health-plan' ), |
|
79 | - 'id' => 'meal_plan_intro', |
|
80 | - 'type' => 'textarea_small', |
|
81 | - 'value' => '', |
|
82 | - 'default' => __( 'Get the right mix of nutrients to keep muscles strong & healthy.', 'lsx-health-plan' ), |
|
83 | - ) |
|
84 | - ); |
|
76 | + $cmb->add_field( |
|
77 | + array( |
|
78 | + 'name' => __( 'Your Meal Plan Intro', 'lsx-health-plan' ), |
|
79 | + 'id' => 'meal_plan_intro', |
|
80 | + 'type' => 'textarea_small', |
|
81 | + 'value' => '', |
|
82 | + 'default' => __( 'Get the right mix of nutrients to keep muscles strong & healthy.', 'lsx-health-plan' ), |
|
83 | + ) |
|
84 | + ); |
|
85 | 85 | |
86 | - $cmb->add_field( |
|
87 | - array( |
|
88 | - 'before_row' => '<h4><b><u>URL Slug Options</u></b></h4><p style="font-style: italic;">If you need to translate the custom slug for this custom post type, do so below.</p>', |
|
89 | - 'name' => __( 'Meal Slug', 'lsx-health-plan' ), |
|
90 | - 'id' => 'endpoint_meal', |
|
91 | - 'type' => 'input', |
|
92 | - 'value' => '', |
|
93 | - 'default' => 'meal', |
|
94 | - ) |
|
95 | - ); |
|
96 | - $cmb->add_field( |
|
97 | - array( |
|
98 | - 'name' => __( 'Meals Archive Slug', 'lsx-health-plan' ), |
|
99 | - 'id' => 'endpoint_meal_archive', |
|
100 | - 'type' => 'input', |
|
101 | - 'value' => '', |
|
102 | - 'default' => 'meals', |
|
103 | - ) |
|
104 | - ); |
|
105 | - $cmb->add_field( |
|
106 | - array( |
|
107 | - 'name' => __( 'Single Meal Slug', 'lsx-health-plan' ), |
|
108 | - 'id' => 'meal_single_slug', |
|
109 | - 'type' => 'input', |
|
110 | - 'value' => '', |
|
111 | - 'default' => 'meal', |
|
112 | - ) |
|
113 | - ); |
|
86 | + $cmb->add_field( |
|
87 | + array( |
|
88 | + 'before_row' => '<h4><b><u>URL Slug Options</u></b></h4><p style="font-style: italic;">If you need to translate the custom slug for this custom post type, do so below.</p>', |
|
89 | + 'name' => __( 'Meal Slug', 'lsx-health-plan' ), |
|
90 | + 'id' => 'endpoint_meal', |
|
91 | + 'type' => 'input', |
|
92 | + 'value' => '', |
|
93 | + 'default' => 'meal', |
|
94 | + ) |
|
95 | + ); |
|
96 | + $cmb->add_field( |
|
97 | + array( |
|
98 | + 'name' => __( 'Meals Archive Slug', 'lsx-health-plan' ), |
|
99 | + 'id' => 'endpoint_meal_archive', |
|
100 | + 'type' => 'input', |
|
101 | + 'value' => '', |
|
102 | + 'default' => 'meals', |
|
103 | + ) |
|
104 | + ); |
|
105 | + $cmb->add_field( |
|
106 | + array( |
|
107 | + 'name' => __( 'Single Meal Slug', 'lsx-health-plan' ), |
|
108 | + 'id' => 'meal_single_slug', |
|
109 | + 'type' => 'input', |
|
110 | + 'value' => '', |
|
111 | + 'default' => 'meal', |
|
112 | + ) |
|
113 | + ); |
|
114 | 114 | |
115 | - $cmb->add_field( |
|
116 | - array( |
|
117 | - 'before_row' => '<h4><b><u>Default Options</u></b></h4>', |
|
118 | - 'name' => __( 'Default Meal Plan', 'lsx-health-plan' ), |
|
119 | - 'description' => __( 'Set a default meal plan.', 'lsx-health-plan' ), |
|
120 | - 'limit' => 1, |
|
121 | - 'id' => 'connected_meals', |
|
122 | - 'type' => 'post_search_ajax', |
|
123 | - 'query_args' => array( |
|
124 | - 'post_type' => 'meal', |
|
125 | - 'post_status' => array( 'publish' ), |
|
126 | - 'posts_per_page' => -1, |
|
127 | - ), |
|
128 | - ) |
|
129 | - ); |
|
130 | - if ( function_exists( 'download_monitor' ) ) { |
|
131 | - $page_url = 'https://wordpress.org/plugins/download-monitor/'; |
|
132 | - $plugin_name = 'Download Monitor'; |
|
133 | - $description = sprintf( |
|
134 | - /* translators: %s: The subscription info */ |
|
135 | - __( 'If you are using <a target="_blank" href="%1$s">%2$s</a> you can set a default download file for your meal here.', 'lsx-search' ), |
|
136 | - $page_url, |
|
137 | - $plugin_name |
|
138 | - ); |
|
139 | - $cmb->add_field( |
|
140 | - array( |
|
141 | - 'name' => __( 'Default Meal Plan PDF', 'lsx-health-plan' ), |
|
142 | - 'description' => $description, |
|
143 | - 'id' => 'download_meal', |
|
144 | - 'type' => 'post_search_ajax', |
|
145 | - 'limit' => 1, |
|
146 | - 'query_args' => array( |
|
147 | - 'post_type' => array( 'dlm_download' ), |
|
148 | - 'post_status' => array( 'publish' ), |
|
149 | - 'posts_per_page' => -1, |
|
150 | - ), |
|
151 | - 'after_row' => __( '<p style="font-style: italic;">If you have changed any URL slugs, please remember re-save your permalinks in Settings > Permalinks.</p>', 'lsx-health-plan' ), |
|
152 | - ) |
|
153 | - ); |
|
154 | - } |
|
155 | - } |
|
115 | + $cmb->add_field( |
|
116 | + array( |
|
117 | + 'before_row' => '<h4><b><u>Default Options</u></b></h4>', |
|
118 | + 'name' => __( 'Default Meal Plan', 'lsx-health-plan' ), |
|
119 | + 'description' => __( 'Set a default meal plan.', 'lsx-health-plan' ), |
|
120 | + 'limit' => 1, |
|
121 | + 'id' => 'connected_meals', |
|
122 | + 'type' => 'post_search_ajax', |
|
123 | + 'query_args' => array( |
|
124 | + 'post_type' => 'meal', |
|
125 | + 'post_status' => array( 'publish' ), |
|
126 | + 'posts_per_page' => -1, |
|
127 | + ), |
|
128 | + ) |
|
129 | + ); |
|
130 | + if ( function_exists( 'download_monitor' ) ) { |
|
131 | + $page_url = 'https://wordpress.org/plugins/download-monitor/'; |
|
132 | + $plugin_name = 'Download Monitor'; |
|
133 | + $description = sprintf( |
|
134 | + /* translators: %s: The subscription info */ |
|
135 | + __( 'If you are using <a target="_blank" href="%1$s">%2$s</a> you can set a default download file for your meal here.', 'lsx-search' ), |
|
136 | + $page_url, |
|
137 | + $plugin_name |
|
138 | + ); |
|
139 | + $cmb->add_field( |
|
140 | + array( |
|
141 | + 'name' => __( 'Default Meal Plan PDF', 'lsx-health-plan' ), |
|
142 | + 'description' => $description, |
|
143 | + 'id' => 'download_meal', |
|
144 | + 'type' => 'post_search_ajax', |
|
145 | + 'limit' => 1, |
|
146 | + 'query_args' => array( |
|
147 | + 'post_type' => array( 'dlm_download' ), |
|
148 | + 'post_status' => array( 'publish' ), |
|
149 | + 'posts_per_page' => -1, |
|
150 | + ), |
|
151 | + 'after_row' => __( '<p style="font-style: italic;">If you have changed any URL slugs, please remember re-save your permalinks in Settings > Permalinks.</p>', 'lsx-health-plan' ), |
|
152 | + ) |
|
153 | + ); |
|
154 | + } |
|
155 | + } |
|
156 | 156 | } |
157 | 157 | Meal::get_instance(); |