@@ -6,11 +6,11 @@ discard block |
||
6 | 6 | */ |
7 | 7 | |
8 | 8 | global $group_name; |
9 | -$groups = get_post_meta( get_the_ID(), $group_name, true ); |
|
10 | -if ( is_singular( 'workout' ) ) { |
|
11 | - $groups = get_post_meta( get_queried_object_id(), $group_name, true ); |
|
9 | +$groups = get_post_meta(get_the_ID(), $group_name, true); |
|
10 | +if (is_singular('workout')) { |
|
11 | + $groups = get_post_meta(get_queried_object_id(), $group_name, true); |
|
12 | 12 | } |
13 | -if ( ! empty( $groups ) ) { |
|
13 | +if ( ! empty($groups)) { |
|
14 | 14 | ?> |
15 | 15 | <div class="set-table"> |
16 | 16 | <table class="workout-table"> |
@@ -18,99 +18,99 @@ discard block |
||
18 | 18 | $table_headers = array(); |
19 | 19 | $table_body = array(); |
20 | 20 | |
21 | - foreach ( $groups as $group ) { |
|
21 | + foreach ($groups as $group) { |
|
22 | 22 | $this_row = array(); |
23 | 23 | |
24 | 24 | $this_row[] = '<tr>'; |
25 | 25 | |
26 | 26 | // Getting the connected exercise. |
27 | - if ( post_type_exists( 'exercise' ) ) { |
|
28 | - if ( isset( $group['connected_exercises'] ) && '' !== $group['connected_exercises'] && ! empty( \lsx_health_plan\functions\check_posts_exist( array( $group['connected_exercises'] ) ) ) ) { |
|
27 | + if (post_type_exists('exercise')) { |
|
28 | + if (isset($group['connected_exercises']) && '' !== $group['connected_exercises'] && ! empty(\lsx_health_plan\functions\check_posts_exist(array($group['connected_exercises'])))) { |
|
29 | 29 | $exercise = $group['connected_exercises']; |
30 | - $exercise_id = get_post( $exercise ); |
|
30 | + $exercise_id = get_post($exercise); |
|
31 | 31 | } |
32 | 32 | } else { |
33 | 33 | $exercise = false; |
34 | 34 | $exercise_id = false; |
35 | 35 | } |
36 | 36 | |
37 | - if ( false !== $exercise && '' !== $exercise ) { |
|
38 | - $exercise_name = get_the_title( $exercise_id ); |
|
39 | - $this_row[] = '<td class="workout-title-item">' . esc_html( $exercise_name ) . '</td>'; |
|
37 | + if (false !== $exercise && '' !== $exercise) { |
|
38 | + $exercise_name = get_the_title($exercise_id); |
|
39 | + $this_row[] = '<td class="workout-title-item">' . esc_html($exercise_name) . '</td>'; |
|
40 | 40 | $table_headers['name'] = true; |
41 | 41 | } else { |
42 | - if ( isset( $group['name'] ) && '' !== $group['name'] ) { |
|
43 | - $this_row[] = '<td class="workout-title-item">' . esc_html( $group['name'] ) . '</td>'; |
|
42 | + if (isset($group['name']) && '' !== $group['name']) { |
|
43 | + $this_row[] = '<td class="workout-title-item">' . esc_html($group['name']) . '</td>'; |
|
44 | 44 | $table_headers['name'] = true; |
45 | 45 | } |
46 | 46 | } |
47 | 47 | // Only display this is exercise is disabled. |
48 | - if ( false === $exercise && isset( $group['description'] ) && '' !== $group['description'] ) { |
|
49 | - $this_row[] = '<td class="workout-desc-item"><p>' . esc_html( $group['description'] ) . '</td>'; |
|
48 | + if (false === $exercise && isset($group['description']) && '' !== $group['description']) { |
|
49 | + $this_row[] = '<td class="workout-desc-item"><p>' . esc_html($group['description']) . '</td>'; |
|
50 | 50 | $table_headers['description'] = true; |
51 | 51 | } |
52 | 52 | |
53 | - if ( isset( $group['reps'] ) && '' !== $group['reps'] ) { |
|
54 | - $this_row[] = '<td class="reps-field-item center-mobile">' . esc_html( $group['reps'] ) . '</td>'; |
|
53 | + if (isset($group['reps']) && '' !== $group['reps']) { |
|
54 | + $this_row[] = '<td class="reps-field-item center-mobile">' . esc_html($group['reps']) . '</td>'; |
|
55 | 55 | $table_headers['reps'] = true; |
56 | 56 | } |
57 | 57 | |
58 | 58 | // Only display this is exercise is disabled. |
59 | - if ( false === $exercise ) { |
|
60 | - if ( isset( $group['equipment'] ) && '' !== $group['equipment'] ) { |
|
61 | - $this_row[] = '<td class="equipment-field-item center-mobile">' . esc_html( $group['equipment'] ) . '</td>'; |
|
59 | + if (false === $exercise) { |
|
60 | + if (isset($group['equipment']) && '' !== $group['equipment']) { |
|
61 | + $this_row[] = '<td class="equipment-field-item center-mobile">' . esc_html($group['equipment']) . '</td>'; |
|
62 | 62 | $table_headers['equipment'] = true; |
63 | 63 | } |
64 | - if ( isset( $group['muscle'] ) && '' !== $group['muscle'] ) { |
|
65 | - $this_row[] = '<td class="muscle-field-item center-mobile">' . esc_html( $group['muscle'] ) . '</td>'; |
|
64 | + if (isset($group['muscle']) && '' !== $group['muscle']) { |
|
65 | + $this_row[] = '<td class="muscle-field-item center-mobile">' . esc_html($group['muscle']) . '</td>'; |
|
66 | 66 | $table_headers['muscle'] = true; |
67 | 67 | } |
68 | 68 | } |
69 | - if ( post_type_exists( 'video' ) && isset( $group['connected_videos'] ) && '' !== $group['connected_videos'] && ! empty( \lsx_health_plan\functions\check_posts_exist( array( $group['connected_videos'] ) ) ) ) { |
|
70 | - $this_row[] = '<td class="video-button-item center-mobile">' . lsx_health_plan_workout_video_play_button( $m, $group, false ) . '</td>'; |
|
69 | + if (post_type_exists('video') && isset($group['connected_videos']) && '' !== $group['connected_videos'] && ! empty(\lsx_health_plan\functions\check_posts_exist(array($group['connected_videos'])))) { |
|
70 | + $this_row[] = '<td class="video-button-item center-mobile">' . lsx_health_plan_workout_video_play_button($m, $group, false) . '</td>'; |
|
71 | 71 | $table_headers['video'] = true; |
72 | 72 | } |
73 | - if ( post_type_exists( 'exercise' ) && isset( $group['connected_exercises'] ) && '' !== $group['connected_exercises'] && ! empty( \lsx_health_plan\functions\check_posts_exist( array( $group['connected_exercises'] ) ) ) ) { |
|
74 | - $this_row[] = '<td class="video-button-item center-mobile">' . lsx_health_plan_workout_exercise_button( $m, $group, false ) . '</td>'; |
|
73 | + if (post_type_exists('exercise') && isset($group['connected_exercises']) && '' !== $group['connected_exercises'] && ! empty(\lsx_health_plan\functions\check_posts_exist(array($group['connected_exercises'])))) { |
|
74 | + $this_row[] = '<td class="video-button-item center-mobile">' . lsx_health_plan_workout_exercise_button($m, $group, false) . '</td>'; |
|
75 | 75 | $table_headers['exercise'] = true; |
76 | 76 | } |
77 | 77 | $this_row[] = '</tr>'; |
78 | 78 | |
79 | - $table_body[] = implode( '', $this_row ); |
|
79 | + $table_body[] = implode('', $this_row); |
|
80 | 80 | $m++; |
81 | 81 | } |
82 | 82 | |
83 | 83 | // Now we build the table header. |
84 | 84 | $table_header = array(); |
85 | 85 | $table_header[] = '<tr>'; |
86 | - if ( isset( $table_headers['name'] ) ) { |
|
87 | - $table_header[] = '<th class="center-mobile">' . __( 'Workout', 'lsx-health-plan' ) . '</th>'; |
|
86 | + if (isset($table_headers['name'])) { |
|
87 | + $table_header[] = '<th class="center-mobile">' . __('Workout', 'lsx-health-plan') . '</th>'; |
|
88 | 88 | } |
89 | - if ( isset( $table_headers['description'] ) ) { |
|
90 | - $table_header[] = '<th class="center-mobile">' . __( 'Description', 'lsx-health-plan' ) . '</th>'; |
|
89 | + if (isset($table_headers['description'])) { |
|
90 | + $table_header[] = '<th class="center-mobile">' . __('Description', 'lsx-health-plan') . '</th>'; |
|
91 | 91 | } |
92 | - if ( isset( $table_headers['reps'] ) ) { |
|
93 | - $table_header[] = '<th class="center-mobile">' . __( 'Reps / Time / Distance', 'lsx-health-plan' ) . '</th>'; |
|
92 | + if (isset($table_headers['reps'])) { |
|
93 | + $table_header[] = '<th class="center-mobile">' . __('Reps / Time / Distance', 'lsx-health-plan') . '</th>'; |
|
94 | 94 | } |
95 | - if ( isset( $table_headers['equipment'] ) ) { |
|
96 | - $table_header[] = '<th class="center-mobile">' . __( 'Equipment', 'lsx-health-plan' ) . '</th>'; |
|
95 | + if (isset($table_headers['equipment'])) { |
|
96 | + $table_header[] = '<th class="center-mobile">' . __('Equipment', 'lsx-health-plan') . '</th>'; |
|
97 | 97 | } |
98 | - if ( isset( $table_headers['muscle'] ) ) { |
|
99 | - $table_header[] = '<th class="center-mobile">' . __( 'Muscle', 'lsx-health-plan' ) . '</th>'; |
|
98 | + if (isset($table_headers['muscle'])) { |
|
99 | + $table_header[] = '<th class="center-mobile">' . __('Muscle', 'lsx-health-plan') . '</th>'; |
|
100 | 100 | } |
101 | - if ( isset( $table_headers['video'] ) ) { |
|
102 | - $table_header[] = '<th class="center-mobile">' . __( 'How To', 'lsx-health-plan' ) . '</th>'; |
|
101 | + if (isset($table_headers['video'])) { |
|
102 | + $table_header[] = '<th class="center-mobile">' . __('How To', 'lsx-health-plan') . '</th>'; |
|
103 | 103 | } |
104 | - if ( isset( $table_headers['exercise'] ) ) { |
|
105 | - $table_header[] = '<th class="center-mobile">' . __( 'How To', 'lsx-health-plan' ) . '</th>'; |
|
104 | + if (isset($table_headers['exercise'])) { |
|
105 | + $table_header[] = '<th class="center-mobile">' . __('How To', 'lsx-health-plan') . '</th>'; |
|
106 | 106 | } |
107 | 107 | $table_header[] = '</tr>'; |
108 | 108 | ?> |
109 | 109 | <thead> |
110 | - <?php echo wp_kses_post( implode( '', $table_header ) ); ?> |
|
110 | + <?php echo wp_kses_post(implode('', $table_header)); ?> |
|
111 | 111 | </thead> |
112 | 112 | <tbody> |
113 | - <?php echo wp_kses_post( implode( '', $table_body ) ); ?> |
|
113 | + <?php echo wp_kses_post(implode('', $table_body)); ?> |
|
114 | 114 | </tbody> |
115 | 115 | </table> |
116 | 116 | </div> |