Passed
Push — add/multiplan ( 15cba9...22afe1 )
by Virginia
04:24
created
templates/partials/workout-grid.php 2 patches
Indentation   +119 added lines, -119 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 global $group_name,$shortcode_args;
9 9
 $groups = get_post_meta( get_the_ID(), $group_name, true );
10 10
 if ( is_singular( 'workout' ) ) {
11
-	$groups = get_post_meta( get_queried_object_id(), $group_name, true );
11
+     $groups = get_post_meta( get_queried_object_id(), $group_name, true );
12 12
 }
13 13
 
14 14
 $link_setting          = \lsx_health_plan\functions\get_option( 'workout_tab_link', 'single' );
@@ -18,167 +18,167 @@  discard block
 block discarded – undo
18 18
 
19 19
 // Check for shortcode overrides.
20 20
 if ( null !== $shortcode_args ) {
21
-	if ( isset( $shortcode_args['link'] ) ) {
22
-		$link_setting = $shortcode_args['link'];
23
-	}
24
-	if ( isset( $shortcode_args['description'] ) ) {
25
-		$content_setting = $shortcode_args['description'];
26
-	}
27
-	if ( isset( $shortcode_args['columns'] ) ) {
28
-		$column_setting = $shortcode_args['columns'];
29
-		$column_setting = \lsx_health_plan\functions\column_class( $column_setting );
30
-	}
31
-	if ( isset( $shortcode_args['modal_content'] ) ) {
32
-		$modal_content_setting = $shortcode_args['modal_content'];
33
-	}
21
+     if ( isset( $shortcode_args['link'] ) ) {
22
+          $link_setting = $shortcode_args['link'];
23
+     }
24
+     if ( isset( $shortcode_args['description'] ) ) {
25
+          $content_setting = $shortcode_args['description'];
26
+     }
27
+     if ( isset( $shortcode_args['columns'] ) ) {
28
+          $column_setting = $shortcode_args['columns'];
29
+          $column_setting = \lsx_health_plan\functions\column_class( $column_setting );
30
+     }
31
+     if ( isset( $shortcode_args['modal_content'] ) ) {
32
+          $modal_content_setting = $shortcode_args['modal_content'];
33
+     }
34 34
 }
35 35
 
36 36
 $modal_args = array(
37
-	'modal_content' => $modal_content_setting,
37
+     'modal_content' => $modal_content_setting,
38 38
 );
39 39
 
40 40
 $counter = 1;
41 41
 
42 42
 if ( ! empty( $groups ) ) {
43
-	?>
43
+     ?>
44 44
 	<div class="set-grid">
45 45
 		<div class="workout-grid row">
46 46
 			<?php
47
-			foreach ( $groups as $group ) {
48
-				$connected_exercise = false;
49
-				if ( isset( $group['connected_exercises'] ) && '' !== $group['connected_exercises'] ) {
50
-					$connected_exercise = true;
51
-				}
47
+               foreach ( $groups as $group ) {
48
+                    $connected_exercise = false;
49
+                    if ( isset( $group['connected_exercises'] ) && '' !== $group['connected_exercises'] ) {
50
+                         $connected_exercise = true;
51
+                    }
52 52
 
53
-				if ( ! $connected_exercise ) {
54
-					$group['connected_exercises'] = '';
55
-				}
56
-				$alt_title_value = $group['alt_title'] ?? '';
57
-				if ( ( $connected_exercise ) || ( ( ! $connected_exercise ) && $alt_title_value ) ) {
53
+                    if ( ! $connected_exercise ) {
54
+                         $group['connected_exercises'] = '';
55
+                    }
56
+                    $alt_title_value = $group['alt_title'] ?? '';
57
+                    if ( ( $connected_exercise ) || ( ( ! $connected_exercise ) && $alt_title_value ) ) {
58 58
 
59
-					$alt_title = '';
60
-					if ( isset( $group['alt_title'] ) && '' !== $group['alt_title'] ) {
61
-						$alt_title = '<span class="alt-title">' . esc_html( $group['alt_title'] ) . '</span>';
62
-					}
59
+                         $alt_title = '';
60
+                         if ( isset( $group['alt_title'] ) && '' !== $group['alt_title'] ) {
61
+                              $alt_title = '<span class="alt-title">' . esc_html( $group['alt_title'] ) . '</span>';
62
+                         }
63 63
 
64
-					$alt_description = '';
65
-					if ( isset( $group['alt_description'] ) && '' !== $group['alt_description'] ) {
66
-						$alt_description = '<span class="alt-description">' . esc_html( $group['alt_description'] ) . '</span>';
67
-					}
64
+                         $alt_description = '';
65
+                         if ( isset( $group['alt_description'] ) && '' !== $group['alt_description'] ) {
66
+                              $alt_description = '<span class="alt-description">' . esc_html( $group['alt_description'] ) . '</span>';
67
+                         }
68 68
 
69
-					$alt_image = '';
70
-					if ( isset( $group['exercise_alt_thumbnail'] ) && '' !== $group['exercise_alt_thumbnail'] ) {
71
-						$alt_image = $group['exercise_alt_thumbnail'];
72
-					}
69
+                         $alt_image = '';
70
+                         if ( isset( $group['exercise_alt_thumbnail'] ) && '' !== $group['exercise_alt_thumbnail'] ) {
71
+                              $alt_image = $group['exercise_alt_thumbnail'];
72
+                         }
73 73
 
74
-					$reps = '';
75
-					if ( isset( $group['reps'] ) && '' !== $group['reps'] ) {
76
-						$reps = '<span class="reps">' . esc_html( $group['reps'] ) . '</span>';
77
-					}
78
-					$class_excerpt = 'no-excerpt';
79
-					if ( 'excerpt' === $content_setting ) {
80
-						$class_excerpt = 'has-excerpt';
81
-					}
82
-					// Setup our link and content.
83
-					switch ( $link_setting ) {
84
-						case 'single':
85
-							$link_html  = '<a href="' . get_permalink( $group['connected_exercises'] ) . '">';
86
-							$link_close = '</a>';
87
-							break;
74
+                         $reps = '';
75
+                         if ( isset( $group['reps'] ) && '' !== $group['reps'] ) {
76
+                              $reps = '<span class="reps">' . esc_html( $group['reps'] ) . '</span>';
77
+                         }
78
+                         $class_excerpt = 'no-excerpt';
79
+                         if ( 'excerpt' === $content_setting ) {
80
+                              $class_excerpt = 'has-excerpt';
81
+                         }
82
+                         // Setup our link and content.
83
+                         switch ( $link_setting ) {
84
+                              case 'single':
85
+                                   $link_html  = '<a href="' . get_permalink( $group['connected_exercises'] ) . '">';
86
+                                   $link_close = '</a>';
87
+                                   break;
88 88
 
89
-						case 'modal':
90
-							if ( ( '' !== $alt_title ) || ( '' !== $alt_description ) || ( '' !== $alt_image ) ) {
91
-								$link_html  = '<a class="alt-modal" data-toggle="modal" href="#workout-alt-exercise-modal-' . $group['connected_exercises'] . '">';
92
-								$link_close = '</a>';
93
-								// We call the button to register the alt modal, but we do not output it.
94
-								lsx_health_plan_workout_exercise_alt_button( $group['connected_exercises'], $group, false, $modal_args, $alt_title, $alt_description, $alt_image );
95
-							} else {
96
-								$link_html  = '<a data-toggle="modal" href="#workout-exercise-modal-' . $group['connected_exercises'] . '">';
97
-								$link_close = '</a>';
98
-								// We call the button to register the modal, but we do not output it.
99
-								lsx_health_plan_workout_exercise_button( $group['connected_exercises'], $group, false, $modal_args );
100
-							}
89
+                              case 'modal':
90
+                                   if ( ( '' !== $alt_title ) || ( '' !== $alt_description ) || ( '' !== $alt_image ) ) {
91
+                                        $link_html  = '<a class="alt-modal" data-toggle="modal" href="#workout-alt-exercise-modal-' . $group['connected_exercises'] . '">';
92
+                                        $link_close = '</a>';
93
+                                        // We call the button to register the alt modal, but we do not output it.
94
+                                        lsx_health_plan_workout_exercise_alt_button( $group['connected_exercises'], $group, false, $modal_args, $alt_title, $alt_description, $alt_image );
95
+                                   } else {
96
+                                        $link_html  = '<a data-toggle="modal" href="#workout-exercise-modal-' . $group['connected_exercises'] . '">';
97
+                                        $link_close = '</a>';
98
+                                        // We call the button to register the modal, but we do not output it.
99
+                                        lsx_health_plan_workout_exercise_button( $group['connected_exercises'], $group, false, $modal_args );
100
+                                   }
101 101
 
102
-							break;
102
+                                   break;
103 103
 
104
-						case 'none':
105
-						default:
106
-							$link_html  = '';
107
-							$link_close = '';
108
-							break;
109
-					}
110
-					?>
104
+                              case 'none':
105
+                              default:
106
+                                   $link_html  = '';
107
+                                   $link_close = '';
108
+                                   break;
109
+                         }
110
+                         ?>
111 111
 					<div class="col-xs-12 col-sm-6 col-md-<?php echo esc_attr( $column_setting ); ?>">
112 112
 						<article class="lsx-slot box-shadow">
113 113
 							<div class="exercise-feature-img">
114 114
 								<span class="exercise-counter"><?php echo esc_html( $counter ); ?>.</span>
115 115
 								<?php echo wp_kses_post( $link_html ); ?>
116 116
 									<?php
117
-									$thumbnail_args = array(
118
-										'class' => 'aligncenter',
119
-									);
120
-									$featured_image = get_the_post_thumbnail( $group['connected_exercises'], 'medium', $thumbnail_args );
121
-									if ( $alt_image ) {
122
-										$featured_image = '<img alt="thumbnail" loading="lazy" class="aligncenter wp-post-image" src="' . $alt_image . '">';
123
-									}
124
-									if ( ! empty( $featured_image ) && '' !== $featured_image ) {
125
-										echo wp_kses_post( $featured_image );
126
-									} else {
127
-										?>
117
+                                             $thumbnail_args = array(
118
+                                                  'class' => 'aligncenter',
119
+                                             );
120
+                                             $featured_image = get_the_post_thumbnail( $group['connected_exercises'], 'medium', $thumbnail_args );
121
+                                             if ( $alt_image ) {
122
+                                                  $featured_image = '<img alt="thumbnail" loading="lazy" class="aligncenter wp-post-image" src="' . $alt_image . '">';
123
+                                             }
124
+                                             if ( ! empty( $featured_image ) && '' !== $featured_image ) {
125
+                                                  echo wp_kses_post( $featured_image );
126
+                                             } else {
127
+                                                  ?>
128 128
 										<img loading="lazy" src="<?php echo esc_attr( plugin_dir_url( __DIR__ ) . '../assets/images/placeholder.jpg' ); ?>">
129 129
 										<?php
130
-									}
131
-									?>
130
+                                             }
131
+                                             ?>
132 132
 								<?php echo wp_kses_post( $link_close ); ?>
133 133
 							</div>
134 134
 							<div class="content-box exercise-content-box white-bg">
135 135
 								<h3 class="content-box-title <?php echo esc_html( $class_excerpt ); ?>">
136 136
 									<?php echo wp_kses_post( $link_html ); ?>
137 137
 											<?php
138
-											$exercise_title = lsx_health_plan_exercise_title( '', '', false, $group['connected_exercises'] );
139
-											if ( '' !== $alt_title ) {
140
-												$exercise_title = $alt_title;
141
-											}
142
-											echo wp_kses_post( $exercise_title );
143
-											?>
138
+                                                       $exercise_title = lsx_health_plan_exercise_title( '', '', false, $group['connected_exercises'] );
139
+                                                       if ( '' !== $alt_title ) {
140
+                                                            $exercise_title = $alt_title;
141
+                                                       }
142
+                                                       echo wp_kses_post( $exercise_title );
143
+                                                       ?>
144 144
 										</a>
145 145
 									<?php echo wp_kses_post( $link_close ); ?>
146 146
 								</h3>
147 147
 								<?php
148
-								if ( '' !== $content_setting ) {
149
-									?>
148
+                                        if ( '' !== $content_setting ) {
149
+                                             ?>
150 150
 									<p class="lsx-exercises-excerpt">
151 151
 										<?php
152
-										if ( 'excerpt' === $content_setting ) {
153
-											$excerpt = \lsx_health_plan\functions\hp_excerpt( $group['connected_exercises'] );
152
+                                                  if ( 'excerpt' === $content_setting ) {
153
+                                                       $excerpt = \lsx_health_plan\functions\hp_excerpt( $group['connected_exercises'] );
154 154
 
155
-											if ( '' !== $alt_description ) {
156
-												$excerpt = $alt_description;
157
-											}
158
-											echo wp_kses_post( $excerpt );
159
-										}
160
-										if ( 'full' === $content_setting ) {
161
-											echo wp_kses_post( get_the_content( null, null, $group['connected_exercises'] ) );
162
-										}
163
-										?>
155
+                                                       if ( '' !== $alt_description ) {
156
+                                                            $excerpt = $alt_description;
157
+                                                       }
158
+                                                       echo wp_kses_post( $excerpt );
159
+                                                  }
160
+                                                  if ( 'full' === $content_setting ) {
161
+                                                       echo wp_kses_post( get_the_content( null, null, $group['connected_exercises'] ) );
162
+                                                  }
163
+                                                  ?>
164 164
 									</p>
165 165
 									<?php
166
-								}
167
-								?>
166
+                                        }
167
+                                        ?>
168 168
 								<?php
169
-								$repsclass = '';
170
-								if ( '' !== $reps ) {
171
-									$repsclass = 'have-reps';
172
-								}
173
-								?>
169
+                                        $repsclass = '';
170
+                                        if ( '' !== $reps ) {
171
+                                             $repsclass = 'have-reps';
172
+                                        }
173
+                                        ?>
174 174
 								<div class="reps-container <?php echo esc_html( $repsclass ); ?>">
175 175
 									<?php
176
-									if ( '' !== $reps ) {
177
-									?>
176
+                                             if ( '' !== $reps ) {
177
+                                             ?>
178 178
 										<?php echo wp_kses_post( $reps ); ?>
179 179
 									<?php
180
-									}
181
-									?>
180
+                                             }
181
+                                             ?>
182 182
 									<?php if ( ( '' !== $link_html ) && ( $connected_exercise ) ) { ?>
183 183
 										<?php echo wp_kses_post( str_replace( '<a', '<a class="btn-simple" ', $link_html ) ); ?>
184 184
 										<?php echo wp_kses_post( $link_close ); ?>
@@ -188,10 +188,10 @@  discard block
 block discarded – undo
188 188
 						</article>
189 189
 					</div>
190 190
 					<?php
191
-					$counter ++;
192
-				}
193
-			}
194
-			?>
191
+                         $counter ++;
192
+                    }
193
+               }
194
+               ?>
195 195
 		</div>
196 196
 	</div>
197 197
 	<?php
Please login to merge, or discard this patch.
Spacing   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -5,30 +5,30 @@  discard block
 block discarded – undo
5 5
  * @package lsx-health-plan
6 6
  */
7 7
 
8
-global $group_name,$shortcode_args;
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 );
8
+global $group_name, $shortcode_args;
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 13
 
14
-$link_setting          = \lsx_health_plan\functions\get_option( 'workout_tab_link', 'single' );
15
-$modal_content_setting = \lsx_health_plan\functions\get_option( 'workout_tab_modal_content', 'excerpt' );
16
-$content_setting       = \lsx_health_plan\functions\get_option( 'workout_tab_content', '' );
17
-$column_setting        = \lsx_health_plan\functions\get_option( 'workout_tab_columns', '4' );
14
+$link_setting          = \lsx_health_plan\functions\get_option('workout_tab_link', 'single');
15
+$modal_content_setting = \lsx_health_plan\functions\get_option('workout_tab_modal_content', 'excerpt');
16
+$content_setting       = \lsx_health_plan\functions\get_option('workout_tab_content', '');
17
+$column_setting        = \lsx_health_plan\functions\get_option('workout_tab_columns', '4');
18 18
 
19 19
 // Check for shortcode overrides.
20
-if ( null !== $shortcode_args ) {
21
-	if ( isset( $shortcode_args['link'] ) ) {
20
+if (null !== $shortcode_args) {
21
+	if (isset($shortcode_args['link'])) {
22 22
 		$link_setting = $shortcode_args['link'];
23 23
 	}
24
-	if ( isset( $shortcode_args['description'] ) ) {
24
+	if (isset($shortcode_args['description'])) {
25 25
 		$content_setting = $shortcode_args['description'];
26 26
 	}
27
-	if ( isset( $shortcode_args['columns'] ) ) {
27
+	if (isset($shortcode_args['columns'])) {
28 28
 		$column_setting = $shortcode_args['columns'];
29
-		$column_setting = \lsx_health_plan\functions\column_class( $column_setting );
29
+		$column_setting = \lsx_health_plan\functions\column_class($column_setting);
30 30
 	}
31
-	if ( isset( $shortcode_args['modal_content'] ) ) {
31
+	if (isset($shortcode_args['modal_content'])) {
32 32
 		$modal_content_setting = $shortcode_args['modal_content'];
33 33
 	}
34 34
 }
@@ -39,64 +39,64 @@  discard block
 block discarded – undo
39 39
 
40 40
 $counter = 1;
41 41
 
42
-if ( ! empty( $groups ) ) {
42
+if ( ! empty($groups)) {
43 43
 	?>
44 44
 	<div class="set-grid">
45 45
 		<div class="workout-grid row">
46 46
 			<?php
47
-			foreach ( $groups as $group ) {
47
+			foreach ($groups as $group) {
48 48
 				$connected_exercise = false;
49
-				if ( isset( $group['connected_exercises'] ) && '' !== $group['connected_exercises'] ) {
49
+				if (isset($group['connected_exercises']) && '' !== $group['connected_exercises']) {
50 50
 					$connected_exercise = true;
51 51
 				}
52 52
 
53
-				if ( ! $connected_exercise ) {
53
+				if ( ! $connected_exercise) {
54 54
 					$group['connected_exercises'] = '';
55 55
 				}
56 56
 				$alt_title_value = $group['alt_title'] ?? '';
57
-				if ( ( $connected_exercise ) || ( ( ! $connected_exercise ) && $alt_title_value ) ) {
57
+				if (($connected_exercise) || (( ! $connected_exercise) && $alt_title_value)) {
58 58
 
59 59
 					$alt_title = '';
60
-					if ( isset( $group['alt_title'] ) && '' !== $group['alt_title'] ) {
61
-						$alt_title = '<span class="alt-title">' . esc_html( $group['alt_title'] ) . '</span>';
60
+					if (isset($group['alt_title']) && '' !== $group['alt_title']) {
61
+						$alt_title = '<span class="alt-title">' . esc_html($group['alt_title']) . '</span>';
62 62
 					}
63 63
 
64 64
 					$alt_description = '';
65
-					if ( isset( $group['alt_description'] ) && '' !== $group['alt_description'] ) {
66
-						$alt_description = '<span class="alt-description">' . esc_html( $group['alt_description'] ) . '</span>';
65
+					if (isset($group['alt_description']) && '' !== $group['alt_description']) {
66
+						$alt_description = '<span class="alt-description">' . esc_html($group['alt_description']) . '</span>';
67 67
 					}
68 68
 
69 69
 					$alt_image = '';
70
-					if ( isset( $group['exercise_alt_thumbnail'] ) && '' !== $group['exercise_alt_thumbnail'] ) {
70
+					if (isset($group['exercise_alt_thumbnail']) && '' !== $group['exercise_alt_thumbnail']) {
71 71
 						$alt_image = $group['exercise_alt_thumbnail'];
72 72
 					}
73 73
 
74 74
 					$reps = '';
75
-					if ( isset( $group['reps'] ) && '' !== $group['reps'] ) {
76
-						$reps = '<span class="reps">' . esc_html( $group['reps'] ) . '</span>';
75
+					if (isset($group['reps']) && '' !== $group['reps']) {
76
+						$reps = '<span class="reps">' . esc_html($group['reps']) . '</span>';
77 77
 					}
78 78
 					$class_excerpt = 'no-excerpt';
79
-					if ( 'excerpt' === $content_setting ) {
79
+					if ('excerpt' === $content_setting) {
80 80
 						$class_excerpt = 'has-excerpt';
81 81
 					}
82 82
 					// Setup our link and content.
83
-					switch ( $link_setting ) {
83
+					switch ($link_setting) {
84 84
 						case 'single':
85
-							$link_html  = '<a href="' . get_permalink( $group['connected_exercises'] ) . '">';
85
+							$link_html  = '<a href="' . get_permalink($group['connected_exercises']) . '">';
86 86
 							$link_close = '</a>';
87 87
 							break;
88 88
 
89 89
 						case 'modal':
90
-							if ( ( '' !== $alt_title ) || ( '' !== $alt_description ) || ( '' !== $alt_image ) ) {
90
+							if (('' !== $alt_title) || ('' !== $alt_description) || ('' !== $alt_image)) {
91 91
 								$link_html  = '<a class="alt-modal" data-toggle="modal" href="#workout-alt-exercise-modal-' . $group['connected_exercises'] . '">';
92 92
 								$link_close = '</a>';
93 93
 								// We call the button to register the alt modal, but we do not output it.
94
-								lsx_health_plan_workout_exercise_alt_button( $group['connected_exercises'], $group, false, $modal_args, $alt_title, $alt_description, $alt_image );
94
+								lsx_health_plan_workout_exercise_alt_button($group['connected_exercises'], $group, false, $modal_args, $alt_title, $alt_description, $alt_image);
95 95
 							} else {
96 96
 								$link_html  = '<a data-toggle="modal" href="#workout-exercise-modal-' . $group['connected_exercises'] . '">';
97 97
 								$link_close = '</a>';
98 98
 								// We call the button to register the modal, but we do not output it.
99
-								lsx_health_plan_workout_exercise_button( $group['connected_exercises'], $group, false, $modal_args );
99
+								lsx_health_plan_workout_exercise_button($group['connected_exercises'], $group, false, $modal_args);
100 100
 							}
101 101
 
102 102
 							break;
@@ -108,57 +108,57 @@  discard block
 block discarded – undo
108 108
 							break;
109 109
 					}
110 110
 					?>
111
-					<div class="col-xs-12 col-sm-6 col-md-<?php echo esc_attr( $column_setting ); ?>">
111
+					<div class="col-xs-12 col-sm-6 col-md-<?php echo esc_attr($column_setting); ?>">
112 112
 						<article class="lsx-slot box-shadow">
113 113
 							<div class="exercise-feature-img">
114
-								<span class="exercise-counter"><?php echo esc_html( $counter ); ?>.</span>
115
-								<?php echo wp_kses_post( $link_html ); ?>
114
+								<span class="exercise-counter"><?php echo esc_html($counter); ?>.</span>
115
+								<?php echo wp_kses_post($link_html); ?>
116 116
 									<?php
117 117
 									$thumbnail_args = array(
118 118
 										'class' => 'aligncenter',
119 119
 									);
120
-									$featured_image = get_the_post_thumbnail( $group['connected_exercises'], 'medium', $thumbnail_args );
121
-									if ( $alt_image ) {
120
+									$featured_image = get_the_post_thumbnail($group['connected_exercises'], 'medium', $thumbnail_args);
121
+									if ($alt_image) {
122 122
 										$featured_image = '<img alt="thumbnail" loading="lazy" class="aligncenter wp-post-image" src="' . $alt_image . '">';
123 123
 									}
124
-									if ( ! empty( $featured_image ) && '' !== $featured_image ) {
125
-										echo wp_kses_post( $featured_image );
124
+									if ( ! empty($featured_image) && '' !== $featured_image) {
125
+										echo wp_kses_post($featured_image);
126 126
 									} else {
127 127
 										?>
128
-										<img loading="lazy" src="<?php echo esc_attr( plugin_dir_url( __DIR__ ) . '../assets/images/placeholder.jpg' ); ?>">
128
+										<img loading="lazy" src="<?php echo esc_attr(plugin_dir_url(__DIR__) . '../assets/images/placeholder.jpg'); ?>">
129 129
 										<?php
130 130
 									}
131 131
 									?>
132
-								<?php echo wp_kses_post( $link_close ); ?>
132
+								<?php echo wp_kses_post($link_close); ?>
133 133
 							</div>
134 134
 							<div class="content-box exercise-content-box white-bg">
135
-								<h3 class="content-box-title <?php echo esc_html( $class_excerpt ); ?>">
136
-									<?php echo wp_kses_post( $link_html ); ?>
135
+								<h3 class="content-box-title <?php echo esc_html($class_excerpt); ?>">
136
+									<?php echo wp_kses_post($link_html); ?>
137 137
 											<?php
138
-											$exercise_title = lsx_health_plan_exercise_title( '', '', false, $group['connected_exercises'] );
139
-											if ( '' !== $alt_title ) {
138
+											$exercise_title = lsx_health_plan_exercise_title('', '', false, $group['connected_exercises']);
139
+											if ('' !== $alt_title) {
140 140
 												$exercise_title = $alt_title;
141 141
 											}
142
-											echo wp_kses_post( $exercise_title );
142
+											echo wp_kses_post($exercise_title);
143 143
 											?>
144 144
 										</a>
145
-									<?php echo wp_kses_post( $link_close ); ?>
145
+									<?php echo wp_kses_post($link_close); ?>
146 146
 								</h3>
147 147
 								<?php
148
-								if ( '' !== $content_setting ) {
148
+								if ('' !== $content_setting) {
149 149
 									?>
150 150
 									<p class="lsx-exercises-excerpt">
151 151
 										<?php
152
-										if ( 'excerpt' === $content_setting ) {
153
-											$excerpt = \lsx_health_plan\functions\hp_excerpt( $group['connected_exercises'] );
152
+										if ('excerpt' === $content_setting) {
153
+											$excerpt = \lsx_health_plan\functions\hp_excerpt($group['connected_exercises']);
154 154
 
155
-											if ( '' !== $alt_description ) {
155
+											if ('' !== $alt_description) {
156 156
 												$excerpt = $alt_description;
157 157
 											}
158
-											echo wp_kses_post( $excerpt );
158
+											echo wp_kses_post($excerpt);
159 159
 										}
160
-										if ( 'full' === $content_setting ) {
161
-											echo wp_kses_post( get_the_content( null, null, $group['connected_exercises'] ) );
160
+										if ('full' === $content_setting) {
161
+											echo wp_kses_post(get_the_content(null, null, $group['connected_exercises']));
162 162
 										}
163 163
 										?>
164 164
 									</p>
@@ -167,28 +167,28 @@  discard block
 block discarded – undo
167 167
 								?>
168 168
 								<?php
169 169
 								$repsclass = '';
170
-								if ( '' !== $reps ) {
170
+								if ('' !== $reps) {
171 171
 									$repsclass = 'have-reps';
172 172
 								}
173 173
 								?>
174
-								<div class="reps-container <?php echo esc_html( $repsclass ); ?>">
174
+								<div class="reps-container <?php echo esc_html($repsclass); ?>">
175 175
 									<?php
176
-									if ( '' !== $reps ) {
176
+									if ('' !== $reps) {
177 177
 									?>
178
-										<?php echo wp_kses_post( $reps ); ?>
178
+										<?php echo wp_kses_post($reps); ?>
179 179
 									<?php
180 180
 									}
181 181
 									?>
182
-									<?php if ( ( '' !== $link_html ) && ( $connected_exercise ) ) { ?>
183
-										<?php echo wp_kses_post( str_replace( '<a', '<a class="btn-simple" ', $link_html ) ); ?>
184
-										<?php echo wp_kses_post( $link_close ); ?>
182
+									<?php if (('' !== $link_html) && ($connected_exercise)) { ?>
183
+										<?php echo wp_kses_post(str_replace('<a', '<a class="btn-simple" ', $link_html)); ?>
184
+										<?php echo wp_kses_post($link_close); ?>
185 185
 									<?php } ?>
186 186
 								</div>
187 187
 							</div>
188 188
 						</article>
189 189
 					</div>
190 190
 					<?php
191
-					$counter ++;
191
+					$counter++;
192 192
 				}
193 193
 			}
194 194
 			?>
Please login to merge, or discard this patch.
templates/partials/shortcode-loop.php 2 patches
Indentation   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -16,40 +16,40 @@  discard block
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -23,26 +23,26 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 	}
Please login to merge, or discard this patch.
templates/table-recipe-data.php 2 patches
Indentation   +57 added lines, -57 removed lines patch added patch discarded remove patch
@@ -20,63 +20,63 @@  discard block
 block discarded – undo
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' ); ?>&nbsp;</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' ); ?>&nbsp;</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' ); ?>&nbsp;</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' ); ?>&nbsp;</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
 block discarded – undo
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' ); ?>&nbsp;</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' ); ?>&nbsp;</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' ); ?>&nbsp;</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' ); ?>&nbsp;</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' ); ?>&nbsp;</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 } ?>
Please login to merge, or discard this patch.
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -1,17 +1,17 @@  discard block
 block discarded – undo
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
 block discarded – undo
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' ); ?>&nbsp;</td>
31
+			<td><?php esc_html_e('Serves:', 'lsx-health-plan'); ?>&nbsp;</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' ); ?>&nbsp;</td>
42
+		<td><?php esc_html_e('Prep time: ', 'lsx-health-plan'); ?>&nbsp;</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
 block discarded – undo
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' ); ?>&nbsp;</td>
56
+			<td><?php esc_html_e('Cooking time: ', 'lsx-health-plan'); ?>&nbsp;</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
 block discarded – undo
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' ); ?>&nbsp;</td>
70
+			<td><?php esc_html_e('Portion size: ', 'lsx-health-plan'); ?>&nbsp;</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
 block discarded – undo
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
 block discarded – undo
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' ); ?>&nbsp;</td>
95
+			<td><?php esc_html_e('Energy: ', 'lsx-health-plan'); ?>&nbsp;</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
 block discarded – undo
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' ); ?>&nbsp;</td>
109
+			<td><?php esc_html_e('Protein: ', 'lsx-health-plan'); ?>&nbsp;</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
 block discarded – undo
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' ); ?>&nbsp;</td>
123
+			<td><?php esc_html_e('Carbohydrates: ', 'lsx-health-plan'); ?>&nbsp;</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
 block discarded – undo
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' ); ?>&nbsp;</td>
137
+			<td><?php esc_html_e('Fibre: ', 'lsx-health-plan'); ?>&nbsp;</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
 block discarded – undo
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' ); ?>&nbsp;</td>
151
+			<td><?php esc_html_e('Fat: ', 'lsx-health-plan'); ?>&nbsp;</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>
Please login to merge, or discard this patch.
classes/post-types/class-exercise.php 2 patches
Indentation   +419 added lines, -419 removed lines patch added patch discarded remove patch
@@ -8,424 +8,424 @@
 block discarded – undo
8 8
  */
9 9
 class Exercise {
10 10
 
11
-	/**
12
-	 * Holds class instance
13
-	 *
14
-	 * @since 1.0.0
15
-	 *
16
-	 * @var      object \lsx_health_plan\classes\Exercise()
17
-	 */
18
-	protected static $instance = null;
19
-
20
-	/**
21
-	 * Holds post_type slug used as an index
22
-	 *
23
-	 * @since 1.0.0
24
-	 *
25
-	 * @var      string
26
-	 */
27
-	public $slug = 'exercise';
28
-
29
-	/**
30
-	 * Constructor
31
-	 */
32
-	public function __construct() {
33
-
34
-		if ( false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) {
35
-			// Post Type and Taxonomies.
36
-			add_action( 'init', array( $this, 'register_post_type' ) );
37
-			add_action( 'init', array( $this, 'exercise_type_taxonomy_setup' ) );
38
-			add_action( 'init', array( $this, 'equipment_taxonomy_setup' ) );
39
-			add_action( 'init', array( $this, 'muscle_group_taxonomy_setup' ) );
40
-			add_action( 'admin_menu', array( $this, 'register_menus' ) );
41
-
42
-			// Custom Fields.
43
-			add_action( 'cmb2_admin_init', array( $this, 'exercise_details' ), 8 );
44
-			add_action( 'cmb2_admin_init', array( $this, 'gallery_metabox' ), 9 );
45
-			add_filter( 'lsx_health_plan_connections', array( $this, 'enable_connections' ), 10, 1 );
46
-
47
-			// Template Redirects.
48
-			add_filter( 'lsx_health_plan_archive_template', array( $this, 'enable_post_type' ), 10, 1 );
49
-			add_filter( 'lsx_health_plan_single_template', array( $this, 'enable_post_type' ), 10, 1 );
50
-
51
-			//Breadcrumbs
52
-			add_filter( 'woocommerce_get_breadcrumb', array( $this, 'exercise_breadcrumb_filter' ), 30, 1 );
53
-
54
-		}
55
-
56
-	}
57
-
58
-
59
-	/**
60
-	 * Return an instance of this class.
61
-	 *
62
-	 * @since 1.0.0
63
-	 *
64
-	 * @return    object \lsx_health_plan\classes\Exercise()    A single instance of this class.
65
-	 */
66
-	public static function get_instance() {
67
-		// If the single instance hasn't been set, set it now.
68
-		if ( null === self::$instance ) {
69
-			self::$instance = new self();
70
-		}
71
-		return self::$instance;
72
-	}
73
-	/**
74
-	 * Register the post type.
75
-	 */
76
-	public function register_post_type() {
77
-		$labels = array(
78
-			'name'               => esc_html__( 'Exercises', 'lsx-health-plan' ),
79
-			'singular_name'      => esc_html__( 'Exercise', 'lsx-health-plan' ),
80
-			'add_new'            => esc_html_x( 'Add New', 'post type general name', 'lsx-health-plan' ),
81
-			'add_new_item'       => esc_html__( 'Add New', 'lsx-health-plan' ),
82
-			'edit_item'          => esc_html__( 'Edit', 'lsx-health-plan' ),
83
-			'new_item'           => esc_html__( 'New', 'lsx-health-plan' ),
84
-			'all_items'          => esc_html__( 'All Exercises', 'lsx-health-plan' ),
85
-			'view_item'          => esc_html__( 'View', 'lsx-health-plan' ),
86
-			'search_items'       => esc_html__( 'Search', 'lsx-health-plan' ),
87
-			'not_found'          => esc_html__( 'None found', 'lsx-health-plan' ),
88
-			'not_found_in_trash' => esc_html__( 'None found in Trash', 'lsx-health-plan' ),
89
-			'parent_item_colon'  => '',
90
-			'menu_name'          => esc_html__( 'Exercises', 'lsx-health-plan' ),
91
-		);
92
-		$args   = array(
93
-			'labels'             => $labels,
94
-			'public'             => true,
95
-			'publicly_queryable' => true,
96
-			'show_ui'            => true,
97
-			'show_in_menu'       => false,
98
-			'show_in_rest'       => true,
99
-			'menu_icon'          => 'dashicons-universal-access',
100
-			'query_var'          => true,
101
-			'rewrite'            => array(
102
-				'slug' => \lsx_health_plan\functions\get_option( 'endpoint_exercise_single', 'exercise' ),
103
-			),
104
-			'capability_type'    => 'page',
105
-			'has_archive'        => \lsx_health_plan\functions\get_option( 'endpoint_exercise_archive', 'exercises' ),
106
-			'hierarchical'       => false,
107
-			'menu_position'      => null,
108
-			'supports'           => array(
109
-				'title',
110
-				'thumbnail',
111
-				'editor',
112
-				'excerpt',
113
-				'custom-fields',
114
-			),
115
-		);
116
-		register_post_type( 'exercise', $args );
117
-	}
118
-
119
-	/**
120
-	 * Register the Exercise taxonomy.
121
-	 *
122
-	 * @return void
123
-	 */
124
-	public function exercise_type_taxonomy_setup() {
125
-		$labels = array(
126
-			'name'              => esc_html_x( 'Exercise Type', 'taxonomy general name', 'lsx-health-plan' ),
127
-			'singular_name'     => esc_html_x( 'Exercise Type', 'taxonomy singular name', 'lsx-health-plan' ),
128
-			'search_items'      => esc_html__( 'Search', 'lsx-health-plan' ),
129
-			'all_items'         => esc_html__( 'All', 'lsx-health-plan' ),
130
-			'parent_item'       => esc_html__( 'Parent', 'lsx-health-plan' ),
131
-			'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ),
132
-			'edit_item'         => esc_html__( 'Edit', 'lsx-health-plan' ),
133
-			'update_item'       => esc_html__( 'Update', 'lsx-health-plan' ),
134
-			'add_new_item'      => esc_html__( 'Add New', 'lsx-health-plan' ),
135
-			'new_item_name'     => esc_html__( 'New Name', 'lsx-health-plan' ),
136
-			'menu_name'         => esc_html__( 'Exercise Types', 'lsx-health-plan' ),
137
-		);
138
-
139
-		$args = array(
140
-			'hierarchical'      => true,
141
-			'labels'            => $labels,
142
-			'show_ui'           => true,
143
-			'show_admin_column' => true,
144
-			'query_var'         => true,
145
-			'rewrite'           => array(
146
-				'slug' => \lsx_health_plan\functions\get_option( 'endpoint_exercise_type', 'exercise-type' ),
147
-			),
148
-			'show_in_rest'      => true,
149
-		);
150
-
151
-		register_taxonomy( 'exercise-type', array( 'exercise' ), $args );
152
-	}
153
-
154
-	/**
155
-	 * Register the Exercise taxonomy.
156
-	 *
157
-	 * @return void
158
-	 */
159
-	public function equipment_taxonomy_setup() {
160
-		$labels = array(
161
-			'name'              => esc_html_x( 'Equipment', 'taxonomy general name', 'lsx-health-plan' ),
162
-			'singular_name'     => esc_html_x( 'Equipment', 'taxonomy singular name', 'lsx-health-plan' ),
163
-			'search_items'      => esc_html__( 'Search', 'lsx-health-plan' ),
164
-			'all_items'         => esc_html__( 'All', 'lsx-health-plan' ),
165
-			'parent_item'       => esc_html__( 'Parent', 'lsx-health-plan' ),
166
-			'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ),
167
-			'edit_item'         => esc_html__( 'Edit', 'lsx-health-plan' ),
168
-			'update_item'       => esc_html__( 'Update', 'lsx-health-plan' ),
169
-			'add_new_item'      => esc_html__( 'Add New', 'lsx-health-plan' ),
170
-			'new_item_name'     => esc_html__( 'New Name', 'lsx-health-plan' ),
171
-			'menu_name'         => esc_html__( 'Equipment', 'lsx-health-plan' ),
172
-		);
173
-
174
-		$args = array(
175
-			'hierarchical'      => true,
176
-			'labels'            => $labels,
177
-			'show_ui'           => true,
178
-			'show_admin_column' => true,
179
-			'query_var'         => true,
180
-			'rewrite'           => array(
181
-				'slug' => \lsx_health_plan\functions\get_option( 'endpoint_exercise_equipment', 'equipment' ),
182
-			),
183
-			'show_in_rest'      => true,
184
-		);
185
-
186
-		register_taxonomy( 'equipment', array( 'exercise' ), $args );
187
-	}
188
-
189
-	/**
190
-	 * Register the Muscle Group taxonomy.
191
-	 *
192
-	 * @return void
193
-	 */
194
-	public function muscle_group_taxonomy_setup() {
195
-		$labels = array(
196
-			'name'              => esc_html_x( 'Muscle Groups', 'taxonomy general name', 'lsx-health-plan' ),
197
-			'singular_name'     => esc_html_x( 'Muscle Group', 'taxonomy singular name', 'lsx-health-plan' ),
198
-			'search_items'      => esc_html__( 'Search', 'lsx-health-plan' ),
199
-			'all_items'         => esc_html__( 'All', 'lsx-health-plan' ),
200
-			'parent_item'       => esc_html__( 'Parent', 'lsx-health-plan' ),
201
-			'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ),
202
-			'edit_item'         => esc_html__( 'Edit', 'lsx-health-plan' ),
203
-			'update_item'       => esc_html__( 'Update', 'lsx-health-plan' ),
204
-			'add_new_item'      => esc_html__( 'Add New', 'lsx-health-plan' ),
205
-			'new_item_name'     => esc_html__( 'New Name', 'lsx-health-plan' ),
206
-			'menu_name'         => esc_html__( 'Muscle Groups', 'lsx-health-plan' ),
207
-		);
208
-
209
-		$args = array(
210
-			'hierarchical'      => true,
211
-			'labels'            => $labels,
212
-			'show_ui'           => true,
213
-			'show_admin_column' => true,
214
-			'query_var'         => true,
215
-			'rewrite'           => array(
216
-				'slug' => \lsx_health_plan\functions\get_option( 'endpoint_exercise_muscle_group', 'muscle-group' ),
217
-			),
218
-			'show_in_rest'      => true,
219
-		);
220
-
221
-		register_taxonomy( 'muscle-group', array( 'exercise' ), $args );
222
-	}
223
-
224
-	/**
225
-	 * Registers the Recipes under the Meals Post type menu.
226
-	 *
227
-	 * @return void
228
-	 */
229
-	public function register_menus() {
230
-		add_submenu_page( 'edit.php?post_type=workout', esc_html__( 'Exercises', 'lsx-health-plan' ), esc_html__( 'Exercises', 'lsx-health-plan' ), 'edit_posts', 'edit.php?post_type=exercise' );
231
-		add_submenu_page( 'edit.php?post_type=workout', esc_html__( 'Exercise Types', 'lsx-health-plan' ), esc_html__( 'Exercise Types', 'lsx-health-plan' ), 'edit_posts', 'edit-tags.php?taxonomy=exercise-type&post_type=exercise' );
232
-		add_submenu_page( 'edit.php?post_type=workout', esc_html__( 'Equipment', 'lsx-health-plan' ), esc_html__( 'Equipment', 'lsx-health-plan' ), 'edit_posts', 'edit-tags.php?taxonomy=equipment&post_type=exercise' );
233
-		add_submenu_page( 'edit.php?post_type=workout', esc_html__( 'Muscle Groups', 'lsx-health-plan' ), esc_html__( 'Muscle Groups', 'lsx-health-plan' ), 'edit_posts', 'edit-tags.php?taxonomy=muscle-group&post_type=exercise' );
234
-	}
235
-
236
-	/**
237
-	 * Adds the post type to the different arrays.
238
-	 *
239
-	 * @param array $post_types
240
-	 * @return array
241
-	 */
242
-	public function enable_post_type( $post_types = array() ) {
243
-		$post_types[] = $this->slug;
244
-		return $post_types;
245
-	}
246
-
247
-	/**
248
-	 * Enables the Bi Directional relationships
249
-	 *
250
-	 * @param array $connections
251
-	 * @return void
252
-	 */
253
-	public function enable_connections( $connections = array() ) {
254
-		$connections['exercise']['connected_workouts'] = 'connected_exercises';
255
-		$connections['workout']['connected_exercises'] = 'connected_workouts';
256
-		return $connections;
257
-	}
258
-
259
-	/**
260
-	 * Define the metabox and field configurations.
261
-	 */
262
-	public function gallery_metabox() {
263
-		$cmb = new_cmb2_box(
264
-			array(
265
-				'id'           => $this->slug . '_gallery_details_metabox',
266
-				'title'        => __( 'Exercise Gallery', 'lsx-health-plan' ),
267
-				'object_types' => array( $this->slug ),
268
-				'context'      => 'normal',
269
-				'priority'     => 'low',
270
-				'show_names'   => true,
271
-			)
272
-		);
273
-
274
-		$cmb->add_field(
275
-			array(
276
-				'name'    => __( 'Layout', 'lsx-health-plan' ),
277
-				'id'      => $this->slug . '_gallery_layout',
278
-				'type'    => 'radio',
279
-				'options' => array(
280
-					'slider' => __( 'Slider', 'lsx-health-plan' ) . ' {#}', // {#} gets replaced by row number
281
-					'grid'   => __( 'Grid', 'lsx-health-plan' ),
282
-				),
283
-				'default' => 'grid',
284
-			)
285
-		);
286
-
287
-		$cmb->add_field(
288
-			array(
289
-				'name'    => __( 'Grid Columns', 'lsx-health-plan' ),
290
-				'id'      => $this->slug . '_gallery_columns',
291
-				'type'    => 'text',
292
-				'default' => '1',
293
-			)
294
-		);
295
-
296
-		// Repeatable group.
297
-		$gallery_group = $cmb->add_field(
298
-			array(
299
-				'id'      => $this->slug . '_gallery',
300
-				'type'    => 'group',
301
-				'options' => array(
302
-					'group_title'   => __( 'Gallery', 'lsx-health-plan' ) . ' {#}', // {#} gets replaced by row number
303
-					'add_button'    => __( 'Add Item', 'lsx-health-plan' ),
304
-					'remove_button' => __( 'Remove Item', 'lsx-health-plan' ),
305
-					'sortable'      => true,
306
-				),
307
-				'classes' => 'lsx-admin-row',
308
-			)
309
-		);
310
-
311
-		// Title.
312
-		$cmb->add_group_field(
313
-			$gallery_group,
314
-			array(
315
-				'name'       => __( 'Image', 'lsx-health-plan' ),
316
-				'id'         => $this->slug . '_gallery_image',
317
-				'type'       => 'file',
318
-				'text'       => array(
319
-					'add_upload_file_text' => __( 'Add File', 'lsx-health-plan' ),
320
-				),
321
-				'desc'       => __( 'Upload an image a minimum of 800px x 600px in size.', 'lsx-health-plan' ),
322
-				'query_args' => array(
323
-					'type' => array(
324
-						'image/gif',
325
-						'image/jpeg',
326
-						'image/png',
327
-					),
328
-				),
329
-				'preview_size' => 'lsx-thumbnail-wide',
330
-			)
331
-		);
332
-
333
-		// Title.
334
-		$cmb->add_group_field(
335
-			$gallery_group,
336
-			array(
337
-				'name'         => __( 'oEmbed', 'lsx-health-plan' ),
338
-				'id'           => $this->slug . '_gallery_embed',
339
-				'type'         => 'text',
340
-				'desc'         => __( 'Drop in the embed url for your video from YouTube, Vimeo or DailyMotion, e.g: "https://www.youtube.com/watch?v=9xwazD5SyVg". A full list of supports formats can be found at <a href="https://make.wordpress.org/support/user-manual/content/media/adding-media-to-your-pages-and-posts/embedding-media-from-other-sites/">WordPress</a>', 'lsx-health-plan' ),
341
-			)
342
-		);
343
-
344
-		$cmb->add_group_field(
345
-			$gallery_group,
346
-			array(
347
-				'name'         => __( 'External Media', 'lsx-health-plan' ),
348
-				'id'           => $this->slug . '_gallery_external',
349
-				'type'         => 'textarea_code',
350
-				'desc'         => __( 'Drop in the iFrame embed code from Giphy in this field, i.e: &lt;iframe src="https://giphy.com/embed/3o7527Rn1HxXWqgxuo" width="480" height="270" frameborder="0" class="giphy-embed" allowfullscreen&gt;&lt;/iframe&gt;', 'lsx-health-plan' ),
351
-			)
352
-		);
353
-	}
354
-
355
-	/**
356
-	 * Registers the general settings for the exercise.
357
-	 *
358
-	 * @return void
359
-	 */
360
-	public function exercise_details() {
361
-		$cmb = new_cmb2_box(
362
-			array(
363
-				'id'           => $this->slug . '_general_details_metabox',
364
-				'title'        => __( 'Details', 'lsx-health-plan' ),
365
-				'object_types' => array( $this->slug ),
366
-				'context'      => 'normal',
367
-				'priority'     => 'high',
368
-				'show_names'   => true,
369
-			)
370
-		);
371
-
372
-		$cmb->add_field(
373
-			array(
374
-				'name'    => __( 'Side', 'lsx-health-plan' ),
375
-				'id'      => $this->slug . '_side',
376
-				'type'    => 'select',
377
-				'options' => array(
378
-					''      => __( 'Select', 'lsx-health-plan' ),
379
-					'left'  => __( 'Left', 'lsx-health-plan' ),
380
-					'right' => __( 'Right', 'lsx-health-plan' ),
381
-				),
382
-				'desc'    => __( 'Select which side this exercise uses. ', 'lsx-health-plan' ),
383
-			)
384
-		);
385
-	}
386
-
387
-	/**
388
-	 * Holds the array for the single exercise breadcrumbs.
389
-	 *
390
-	 * @var array $crumbs
391
-	 * @return array
392
-	 */
393
-	public function exercise_breadcrumb_filter( $crumbs ) {
394
-		$exercise  = \lsx_health_plan\functions\get_option( 'endpoint_exercise', 'exercise' );
395
-		$exercises = \lsx_health_plan\functions\get_option( 'endpoint_exercise_archive', 'exercise' );
396
-		$url       = get_post_type_archive_link( $exercise );
397
-
398
-		if ( is_singular( 'exercise' ) ) {
399
-			$exercise_name     = get_the_title();	
400
-			$term_obj_list     = get_the_terms( get_the_ID(), 'exercise-type' );
401
-			$exercise_type     = $term_obj_list[0]->name;
402
-			$exercise_type_url = get_term_link( $term_obj_list[0]->term_id );
11
+     /**
12
+      * Holds class instance
13
+      *
14
+      * @since 1.0.0
15
+      *
16
+      * @var      object \lsx_health_plan\classes\Exercise()
17
+      */
18
+     protected static $instance = null;
19
+
20
+     /**
21
+      * Holds post_type slug used as an index
22
+      *
23
+      * @since 1.0.0
24
+      *
25
+      * @var      string
26
+      */
27
+     public $slug = 'exercise';
28
+
29
+     /**
30
+      * Constructor
31
+      */
32
+     public function __construct() {
33
+
34
+          if ( false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) {
35
+               // Post Type and Taxonomies.
36
+               add_action( 'init', array( $this, 'register_post_type' ) );
37
+               add_action( 'init', array( $this, 'exercise_type_taxonomy_setup' ) );
38
+               add_action( 'init', array( $this, 'equipment_taxonomy_setup' ) );
39
+               add_action( 'init', array( $this, 'muscle_group_taxonomy_setup' ) );
40
+               add_action( 'admin_menu', array( $this, 'register_menus' ) );
41
+
42
+               // Custom Fields.
43
+               add_action( 'cmb2_admin_init', array( $this, 'exercise_details' ), 8 );
44
+               add_action( 'cmb2_admin_init', array( $this, 'gallery_metabox' ), 9 );
45
+               add_filter( 'lsx_health_plan_connections', array( $this, 'enable_connections' ), 10, 1 );
46
+
47
+               // Template Redirects.
48
+               add_filter( 'lsx_health_plan_archive_template', array( $this, 'enable_post_type' ), 10, 1 );
49
+               add_filter( 'lsx_health_plan_single_template', array( $this, 'enable_post_type' ), 10, 1 );
50
+
51
+               //Breadcrumbs
52
+               add_filter( 'woocommerce_get_breadcrumb', array( $this, 'exercise_breadcrumb_filter' ), 30, 1 );
53
+
54
+          }
55
+
56
+     }
57
+
58
+
59
+     /**
60
+      * Return an instance of this class.
61
+      *
62
+      * @since 1.0.0
63
+      *
64
+      * @return    object \lsx_health_plan\classes\Exercise()    A single instance of this class.
65
+      */
66
+     public static function get_instance() {
67
+          // If the single instance hasn't been set, set it now.
68
+          if ( null === self::$instance ) {
69
+               self::$instance = new self();
70
+          }
71
+          return self::$instance;
72
+     }
73
+     /**
74
+      * Register the post type.
75
+      */
76
+     public function register_post_type() {
77
+          $labels = array(
78
+               'name'               => esc_html__( 'Exercises', 'lsx-health-plan' ),
79
+               'singular_name'      => esc_html__( 'Exercise', 'lsx-health-plan' ),
80
+               'add_new'            => esc_html_x( 'Add New', 'post type general name', 'lsx-health-plan' ),
81
+               'add_new_item'       => esc_html__( 'Add New', 'lsx-health-plan' ),
82
+               'edit_item'          => esc_html__( 'Edit', 'lsx-health-plan' ),
83
+               'new_item'           => esc_html__( 'New', 'lsx-health-plan' ),
84
+               'all_items'          => esc_html__( 'All Exercises', 'lsx-health-plan' ),
85
+               'view_item'          => esc_html__( 'View', 'lsx-health-plan' ),
86
+               'search_items'       => esc_html__( 'Search', 'lsx-health-plan' ),
87
+               'not_found'          => esc_html__( 'None found', 'lsx-health-plan' ),
88
+               'not_found_in_trash' => esc_html__( 'None found in Trash', 'lsx-health-plan' ),
89
+               'parent_item_colon'  => '',
90
+               'menu_name'          => esc_html__( 'Exercises', 'lsx-health-plan' ),
91
+          );
92
+          $args   = array(
93
+               'labels'             => $labels,
94
+               'public'             => true,
95
+               'publicly_queryable' => true,
96
+               'show_ui'            => true,
97
+               'show_in_menu'       => false,
98
+               'show_in_rest'       => true,
99
+               'menu_icon'          => 'dashicons-universal-access',
100
+               'query_var'          => true,
101
+               'rewrite'            => array(
102
+                    'slug' => \lsx_health_plan\functions\get_option( 'endpoint_exercise_single', 'exercise' ),
103
+               ),
104
+               'capability_type'    => 'page',
105
+               'has_archive'        => \lsx_health_plan\functions\get_option( 'endpoint_exercise_archive', 'exercises' ),
106
+               'hierarchical'       => false,
107
+               'menu_position'      => null,
108
+               'supports'           => array(
109
+                    'title',
110
+                    'thumbnail',
111
+                    'editor',
112
+                    'excerpt',
113
+                    'custom-fields',
114
+               ),
115
+          );
116
+          register_post_type( 'exercise', $args );
117
+     }
118
+
119
+     /**
120
+      * Register the Exercise taxonomy.
121
+      *
122
+      * @return void
123
+      */
124
+     public function exercise_type_taxonomy_setup() {
125
+          $labels = array(
126
+               'name'              => esc_html_x( 'Exercise Type', 'taxonomy general name', 'lsx-health-plan' ),
127
+               'singular_name'     => esc_html_x( 'Exercise Type', 'taxonomy singular name', 'lsx-health-plan' ),
128
+               'search_items'      => esc_html__( 'Search', 'lsx-health-plan' ),
129
+               'all_items'         => esc_html__( 'All', 'lsx-health-plan' ),
130
+               'parent_item'       => esc_html__( 'Parent', 'lsx-health-plan' ),
131
+               'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ),
132
+               'edit_item'         => esc_html__( 'Edit', 'lsx-health-plan' ),
133
+               'update_item'       => esc_html__( 'Update', 'lsx-health-plan' ),
134
+               'add_new_item'      => esc_html__( 'Add New', 'lsx-health-plan' ),
135
+               'new_item_name'     => esc_html__( 'New Name', 'lsx-health-plan' ),
136
+               'menu_name'         => esc_html__( 'Exercise Types', 'lsx-health-plan' ),
137
+          );
138
+
139
+          $args = array(
140
+               'hierarchical'      => true,
141
+               'labels'            => $labels,
142
+               'show_ui'           => true,
143
+               'show_admin_column' => true,
144
+               'query_var'         => true,
145
+               'rewrite'           => array(
146
+                    'slug' => \lsx_health_plan\functions\get_option( 'endpoint_exercise_type', 'exercise-type' ),
147
+               ),
148
+               'show_in_rest'      => true,
149
+          );
150
+
151
+          register_taxonomy( 'exercise-type', array( 'exercise' ), $args );
152
+     }
153
+
154
+     /**
155
+      * Register the Exercise taxonomy.
156
+      *
157
+      * @return void
158
+      */
159
+     public function equipment_taxonomy_setup() {
160
+          $labels = array(
161
+               'name'              => esc_html_x( 'Equipment', 'taxonomy general name', 'lsx-health-plan' ),
162
+               'singular_name'     => esc_html_x( 'Equipment', 'taxonomy singular name', 'lsx-health-plan' ),
163
+               'search_items'      => esc_html__( 'Search', 'lsx-health-plan' ),
164
+               'all_items'         => esc_html__( 'All', 'lsx-health-plan' ),
165
+               'parent_item'       => esc_html__( 'Parent', 'lsx-health-plan' ),
166
+               'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ),
167
+               'edit_item'         => esc_html__( 'Edit', 'lsx-health-plan' ),
168
+               'update_item'       => esc_html__( 'Update', 'lsx-health-plan' ),
169
+               'add_new_item'      => esc_html__( 'Add New', 'lsx-health-plan' ),
170
+               'new_item_name'     => esc_html__( 'New Name', 'lsx-health-plan' ),
171
+               'menu_name'         => esc_html__( 'Equipment', 'lsx-health-plan' ),
172
+          );
173
+
174
+          $args = array(
175
+               'hierarchical'      => true,
176
+               'labels'            => $labels,
177
+               'show_ui'           => true,
178
+               'show_admin_column' => true,
179
+               'query_var'         => true,
180
+               'rewrite'           => array(
181
+                    'slug' => \lsx_health_plan\functions\get_option( 'endpoint_exercise_equipment', 'equipment' ),
182
+               ),
183
+               'show_in_rest'      => true,
184
+          );
185
+
186
+          register_taxonomy( 'equipment', array( 'exercise' ), $args );
187
+     }
188
+
189
+     /**
190
+      * Register the Muscle Group taxonomy.
191
+      *
192
+      * @return void
193
+      */
194
+     public function muscle_group_taxonomy_setup() {
195
+          $labels = array(
196
+               'name'              => esc_html_x( 'Muscle Groups', 'taxonomy general name', 'lsx-health-plan' ),
197
+               'singular_name'     => esc_html_x( 'Muscle Group', 'taxonomy singular name', 'lsx-health-plan' ),
198
+               'search_items'      => esc_html__( 'Search', 'lsx-health-plan' ),
199
+               'all_items'         => esc_html__( 'All', 'lsx-health-plan' ),
200
+               'parent_item'       => esc_html__( 'Parent', 'lsx-health-plan' ),
201
+               'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ),
202
+               'edit_item'         => esc_html__( 'Edit', 'lsx-health-plan' ),
203
+               'update_item'       => esc_html__( 'Update', 'lsx-health-plan' ),
204
+               'add_new_item'      => esc_html__( 'Add New', 'lsx-health-plan' ),
205
+               'new_item_name'     => esc_html__( 'New Name', 'lsx-health-plan' ),
206
+               'menu_name'         => esc_html__( 'Muscle Groups', 'lsx-health-plan' ),
207
+          );
208
+
209
+          $args = array(
210
+               'hierarchical'      => true,
211
+               'labels'            => $labels,
212
+               'show_ui'           => true,
213
+               'show_admin_column' => true,
214
+               'query_var'         => true,
215
+               'rewrite'           => array(
216
+                    'slug' => \lsx_health_plan\functions\get_option( 'endpoint_exercise_muscle_group', 'muscle-group' ),
217
+               ),
218
+               'show_in_rest'      => true,
219
+          );
220
+
221
+          register_taxonomy( 'muscle-group', array( 'exercise' ), $args );
222
+     }
223
+
224
+     /**
225
+      * Registers the Recipes under the Meals Post type menu.
226
+      *
227
+      * @return void
228
+      */
229
+     public function register_menus() {
230
+          add_submenu_page( 'edit.php?post_type=workout', esc_html__( 'Exercises', 'lsx-health-plan' ), esc_html__( 'Exercises', 'lsx-health-plan' ), 'edit_posts', 'edit.php?post_type=exercise' );
231
+          add_submenu_page( 'edit.php?post_type=workout', esc_html__( 'Exercise Types', 'lsx-health-plan' ), esc_html__( 'Exercise Types', 'lsx-health-plan' ), 'edit_posts', 'edit-tags.php?taxonomy=exercise-type&post_type=exercise' );
232
+          add_submenu_page( 'edit.php?post_type=workout', esc_html__( 'Equipment', 'lsx-health-plan' ), esc_html__( 'Equipment', 'lsx-health-plan' ), 'edit_posts', 'edit-tags.php?taxonomy=equipment&post_type=exercise' );
233
+          add_submenu_page( 'edit.php?post_type=workout', esc_html__( 'Muscle Groups', 'lsx-health-plan' ), esc_html__( 'Muscle Groups', 'lsx-health-plan' ), 'edit_posts', 'edit-tags.php?taxonomy=muscle-group&post_type=exercise' );
234
+     }
235
+
236
+     /**
237
+      * Adds the post type to the different arrays.
238
+      *
239
+      * @param array $post_types
240
+      * @return array
241
+      */
242
+     public function enable_post_type( $post_types = array() ) {
243
+          $post_types[] = $this->slug;
244
+          return $post_types;
245
+     }
246
+
247
+     /**
248
+      * Enables the Bi Directional relationships
249
+      *
250
+      * @param array $connections
251
+      * @return void
252
+      */
253
+     public function enable_connections( $connections = array() ) {
254
+          $connections['exercise']['connected_workouts'] = 'connected_exercises';
255
+          $connections['workout']['connected_exercises'] = 'connected_workouts';
256
+          return $connections;
257
+     }
258
+
259
+     /**
260
+      * Define the metabox and field configurations.
261
+      */
262
+     public function gallery_metabox() {
263
+          $cmb = new_cmb2_box(
264
+               array(
265
+                    'id'           => $this->slug . '_gallery_details_metabox',
266
+                    'title'        => __( 'Exercise Gallery', 'lsx-health-plan' ),
267
+                    'object_types' => array( $this->slug ),
268
+                    'context'      => 'normal',
269
+                    'priority'     => 'low',
270
+                    'show_names'   => true,
271
+               )
272
+          );
273
+
274
+          $cmb->add_field(
275
+               array(
276
+                    'name'    => __( 'Layout', 'lsx-health-plan' ),
277
+                    'id'      => $this->slug . '_gallery_layout',
278
+                    'type'    => 'radio',
279
+                    'options' => array(
280
+                         'slider' => __( 'Slider', 'lsx-health-plan' ) . ' {#}', // {#} gets replaced by row number
281
+                         'grid'   => __( 'Grid', 'lsx-health-plan' ),
282
+                    ),
283
+                    'default' => 'grid',
284
+               )
285
+          );
286
+
287
+          $cmb->add_field(
288
+               array(
289
+                    'name'    => __( 'Grid Columns', 'lsx-health-plan' ),
290
+                    'id'      => $this->slug . '_gallery_columns',
291
+                    'type'    => 'text',
292
+                    'default' => '1',
293
+               )
294
+          );
295
+
296
+          // Repeatable group.
297
+          $gallery_group = $cmb->add_field(
298
+               array(
299
+                    'id'      => $this->slug . '_gallery',
300
+                    'type'    => 'group',
301
+                    'options' => array(
302
+                         'group_title'   => __( 'Gallery', 'lsx-health-plan' ) . ' {#}', // {#} gets replaced by row number
303
+                         'add_button'    => __( 'Add Item', 'lsx-health-plan' ),
304
+                         'remove_button' => __( 'Remove Item', 'lsx-health-plan' ),
305
+                         'sortable'      => true,
306
+                    ),
307
+                    'classes' => 'lsx-admin-row',
308
+               )
309
+          );
310
+
311
+          // Title.
312
+          $cmb->add_group_field(
313
+               $gallery_group,
314
+               array(
315
+                    'name'       => __( 'Image', 'lsx-health-plan' ),
316
+                    'id'         => $this->slug . '_gallery_image',
317
+                    'type'       => 'file',
318
+                    'text'       => array(
319
+                         'add_upload_file_text' => __( 'Add File', 'lsx-health-plan' ),
320
+                    ),
321
+                    'desc'       => __( 'Upload an image a minimum of 800px x 600px in size.', 'lsx-health-plan' ),
322
+                    'query_args' => array(
323
+                         'type' => array(
324
+                              'image/gif',
325
+                              'image/jpeg',
326
+                              'image/png',
327
+                         ),
328
+                    ),
329
+                    'preview_size' => 'lsx-thumbnail-wide',
330
+               )
331
+          );
332
+
333
+          // Title.
334
+          $cmb->add_group_field(
335
+               $gallery_group,
336
+               array(
337
+                    'name'         => __( 'oEmbed', 'lsx-health-plan' ),
338
+                    'id'           => $this->slug . '_gallery_embed',
339
+                    'type'         => 'text',
340
+                    'desc'         => __( 'Drop in the embed url for your video from YouTube, Vimeo or DailyMotion, e.g: "https://www.youtube.com/watch?v=9xwazD5SyVg". A full list of supports formats can be found at <a href="https://make.wordpress.org/support/user-manual/content/media/adding-media-to-your-pages-and-posts/embedding-media-from-other-sites/">WordPress</a>', 'lsx-health-plan' ),
341
+               )
342
+          );
343
+
344
+          $cmb->add_group_field(
345
+               $gallery_group,
346
+               array(
347
+                    'name'         => __( 'External Media', 'lsx-health-plan' ),
348
+                    'id'           => $this->slug . '_gallery_external',
349
+                    'type'         => 'textarea_code',
350
+                    'desc'         => __( 'Drop in the iFrame embed code from Giphy in this field, i.e: &lt;iframe src="https://giphy.com/embed/3o7527Rn1HxXWqgxuo" width="480" height="270" frameborder="0" class="giphy-embed" allowfullscreen&gt;&lt;/iframe&gt;', 'lsx-health-plan' ),
351
+               )
352
+          );
353
+     }
354
+
355
+     /**
356
+      * Registers the general settings for the exercise.
357
+      *
358
+      * @return void
359
+      */
360
+     public function exercise_details() {
361
+          $cmb = new_cmb2_box(
362
+               array(
363
+                    'id'           => $this->slug . '_general_details_metabox',
364
+                    'title'        => __( 'Details', 'lsx-health-plan' ),
365
+                    'object_types' => array( $this->slug ),
366
+                    'context'      => 'normal',
367
+                    'priority'     => 'high',
368
+                    'show_names'   => true,
369
+               )
370
+          );
371
+
372
+          $cmb->add_field(
373
+               array(
374
+                    'name'    => __( 'Side', 'lsx-health-plan' ),
375
+                    'id'      => $this->slug . '_side',
376
+                    'type'    => 'select',
377
+                    'options' => array(
378
+                         ''      => __( 'Select', 'lsx-health-plan' ),
379
+                         'left'  => __( 'Left', 'lsx-health-plan' ),
380
+                         'right' => __( 'Right', 'lsx-health-plan' ),
381
+                    ),
382
+                    'desc'    => __( 'Select which side this exercise uses. ', 'lsx-health-plan' ),
383
+               )
384
+          );
385
+     }
386
+
387
+     /**
388
+      * Holds the array for the single exercise breadcrumbs.
389
+      *
390
+      * @var array $crumbs
391
+      * @return array
392
+      */
393
+     public function exercise_breadcrumb_filter( $crumbs ) {
394
+          $exercise  = \lsx_health_plan\functions\get_option( 'endpoint_exercise', 'exercise' );
395
+          $exercises = \lsx_health_plan\functions\get_option( 'endpoint_exercise_archive', 'exercise' );
396
+          $url       = get_post_type_archive_link( $exercise );
397
+
398
+          if ( is_singular( 'exercise' ) ) {
399
+               $exercise_name     = get_the_title();	
400
+               $term_obj_list     = get_the_terms( get_the_ID(), 'exercise-type' );
401
+               $exercise_type     = $term_obj_list[0]->name;
402
+               $exercise_type_url = get_term_link( $term_obj_list[0]->term_id );
403 403
 		
404
-			$crumbs[1] = array(
405
-				0 => $exercises,
406
-				1 => $url,
407
-			);
408
-			$crumbs[2] = array(
409
-				0 => $exercise_type,
410
-				1 => $exercise_type_url,
411
-			);
412
-			$crumbs[3] = array(
413
-				0 => $exercise_name,
414
-			);
415
-		}
416
-		if ( is_tax( 'exercise-type' ) || is_tax( 'muscle-group' ) || is_tax( 'equipment' ) ) {
417
-			$term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); 
418
-
419
-			$single_term_title = str_replace( '-', ' ', $term->taxonomy ) . ': ' . $term->name;
420
-
421
-			$crumbs[1] = array(
422
-				0 => $exercises,
423
-				1 => $url,
424
-			);
425
-			$crumbs[2] = array(
426
-				0 => $single_term_title,
427
-			);
428
-		}
429
-		return $crumbs;
430
-	}
404
+               $crumbs[1] = array(
405
+                    0 => $exercises,
406
+                    1 => $url,
407
+               );
408
+               $crumbs[2] = array(
409
+                    0 => $exercise_type,
410
+                    1 => $exercise_type_url,
411
+               );
412
+               $crumbs[3] = array(
413
+                    0 => $exercise_name,
414
+               );
415
+          }
416
+          if ( is_tax( 'exercise-type' ) || is_tax( 'muscle-group' ) || is_tax( 'equipment' ) ) {
417
+               $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); 
418
+
419
+               $single_term_title = str_replace( '-', ' ', $term->taxonomy ) . ': ' . $term->name;
420
+
421
+               $crumbs[1] = array(
422
+                    0 => $exercises,
423
+                    1 => $url,
424
+               );
425
+               $crumbs[2] = array(
426
+                    0 => $single_term_title,
427
+               );
428
+          }
429
+          return $crumbs;
430
+     }
431 431
 }
Please login to merge, or discard this patch.
Spacing   +107 added lines, -107 removed lines patch added patch discarded remove patch
@@ -31,25 +31,25 @@  discard block
 block discarded – undo
31 31
 	 */
32 32
 	public function __construct() {
33 33
 
34
-		if ( false !== \lsx_health_plan\functions\get_option( 'exercise_enabled', false ) ) {
34
+		if (false !== \lsx_health_plan\functions\get_option('exercise_enabled', false)) {
35 35
 			// Post Type and Taxonomies.
36
-			add_action( 'init', array( $this, 'register_post_type' ) );
37
-			add_action( 'init', array( $this, 'exercise_type_taxonomy_setup' ) );
38
-			add_action( 'init', array( $this, 'equipment_taxonomy_setup' ) );
39
-			add_action( 'init', array( $this, 'muscle_group_taxonomy_setup' ) );
40
-			add_action( 'admin_menu', array( $this, 'register_menus' ) );
36
+			add_action('init', array($this, 'register_post_type'));
37
+			add_action('init', array($this, 'exercise_type_taxonomy_setup'));
38
+			add_action('init', array($this, 'equipment_taxonomy_setup'));
39
+			add_action('init', array($this, 'muscle_group_taxonomy_setup'));
40
+			add_action('admin_menu', array($this, 'register_menus'));
41 41
 
42 42
 			// Custom Fields.
43
-			add_action( 'cmb2_admin_init', array( $this, 'exercise_details' ), 8 );
44
-			add_action( 'cmb2_admin_init', array( $this, 'gallery_metabox' ), 9 );
45
-			add_filter( 'lsx_health_plan_connections', array( $this, 'enable_connections' ), 10, 1 );
43
+			add_action('cmb2_admin_init', array($this, 'exercise_details'), 8);
44
+			add_action('cmb2_admin_init', array($this, 'gallery_metabox'), 9);
45
+			add_filter('lsx_health_plan_connections', array($this, 'enable_connections'), 10, 1);
46 46
 
47 47
 			// Template Redirects.
48
-			add_filter( 'lsx_health_plan_archive_template', array( $this, 'enable_post_type' ), 10, 1 );
49
-			add_filter( 'lsx_health_plan_single_template', array( $this, 'enable_post_type' ), 10, 1 );
48
+			add_filter('lsx_health_plan_archive_template', array($this, 'enable_post_type'), 10, 1);
49
+			add_filter('lsx_health_plan_single_template', array($this, 'enable_post_type'), 10, 1);
50 50
 
51 51
 			//Breadcrumbs
52
-			add_filter( 'woocommerce_get_breadcrumb', array( $this, 'exercise_breadcrumb_filter' ), 30, 1 );
52
+			add_filter('woocommerce_get_breadcrumb', array($this, 'exercise_breadcrumb_filter'), 30, 1);
53 53
 
54 54
 		}
55 55
 
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
 	 */
66 66
 	public static function get_instance() {
67 67
 		// If the single instance hasn't been set, set it now.
68
-		if ( null === self::$instance ) {
68
+		if (null === self::$instance) {
69 69
 			self::$instance = new self();
70 70
 		}
71 71
 		return self::$instance;
@@ -75,21 +75,21 @@  discard block
 block discarded – undo
75 75
 	 */
76 76
 	public function register_post_type() {
77 77
 		$labels = array(
78
-			'name'               => esc_html__( 'Exercises', 'lsx-health-plan' ),
79
-			'singular_name'      => esc_html__( 'Exercise', 'lsx-health-plan' ),
80
-			'add_new'            => esc_html_x( 'Add New', 'post type general name', 'lsx-health-plan' ),
81
-			'add_new_item'       => esc_html__( 'Add New', 'lsx-health-plan' ),
82
-			'edit_item'          => esc_html__( 'Edit', 'lsx-health-plan' ),
83
-			'new_item'           => esc_html__( 'New', 'lsx-health-plan' ),
84
-			'all_items'          => esc_html__( 'All Exercises', 'lsx-health-plan' ),
85
-			'view_item'          => esc_html__( 'View', 'lsx-health-plan' ),
86
-			'search_items'       => esc_html__( 'Search', 'lsx-health-plan' ),
87
-			'not_found'          => esc_html__( 'None found', 'lsx-health-plan' ),
88
-			'not_found_in_trash' => esc_html__( 'None found in Trash', 'lsx-health-plan' ),
78
+			'name'               => esc_html__('Exercises', 'lsx-health-plan'),
79
+			'singular_name'      => esc_html__('Exercise', 'lsx-health-plan'),
80
+			'add_new'            => esc_html_x('Add New', 'post type general name', 'lsx-health-plan'),
81
+			'add_new_item'       => esc_html__('Add New', 'lsx-health-plan'),
82
+			'edit_item'          => esc_html__('Edit', 'lsx-health-plan'),
83
+			'new_item'           => esc_html__('New', 'lsx-health-plan'),
84
+			'all_items'          => esc_html__('All Exercises', 'lsx-health-plan'),
85
+			'view_item'          => esc_html__('View', 'lsx-health-plan'),
86
+			'search_items'       => esc_html__('Search', 'lsx-health-plan'),
87
+			'not_found'          => esc_html__('None found', 'lsx-health-plan'),
88
+			'not_found_in_trash' => esc_html__('None found in Trash', 'lsx-health-plan'),
89 89
 			'parent_item_colon'  => '',
90
-			'menu_name'          => esc_html__( 'Exercises', 'lsx-health-plan' ),
90
+			'menu_name'          => esc_html__('Exercises', 'lsx-health-plan'),
91 91
 		);
92
-		$args   = array(
92
+		$args = array(
93 93
 			'labels'             => $labels,
94 94
 			'public'             => true,
95 95
 			'publicly_queryable' => true,
@@ -99,10 +99,10 @@  discard block
 block discarded – undo
99 99
 			'menu_icon'          => 'dashicons-universal-access',
100 100
 			'query_var'          => true,
101 101
 			'rewrite'            => array(
102
-				'slug' => \lsx_health_plan\functions\get_option( 'endpoint_exercise_single', 'exercise' ),
102
+				'slug' => \lsx_health_plan\functions\get_option('endpoint_exercise_single', 'exercise'),
103 103
 			),
104 104
 			'capability_type'    => 'page',
105
-			'has_archive'        => \lsx_health_plan\functions\get_option( 'endpoint_exercise_archive', 'exercises' ),
105
+			'has_archive'        => \lsx_health_plan\functions\get_option('endpoint_exercise_archive', 'exercises'),
106 106
 			'hierarchical'       => false,
107 107
 			'menu_position'      => null,
108 108
 			'supports'           => array(
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 				'custom-fields',
114 114
 			),
115 115
 		);
116
-		register_post_type( 'exercise', $args );
116
+		register_post_type('exercise', $args);
117 117
 	}
118 118
 
119 119
 	/**
@@ -123,17 +123,17 @@  discard block
 block discarded – undo
123 123
 	 */
124 124
 	public function exercise_type_taxonomy_setup() {
125 125
 		$labels = array(
126
-			'name'              => esc_html_x( 'Exercise Type', 'taxonomy general name', 'lsx-health-plan' ),
127
-			'singular_name'     => esc_html_x( 'Exercise Type', 'taxonomy singular name', 'lsx-health-plan' ),
128
-			'search_items'      => esc_html__( 'Search', 'lsx-health-plan' ),
129
-			'all_items'         => esc_html__( 'All', 'lsx-health-plan' ),
130
-			'parent_item'       => esc_html__( 'Parent', 'lsx-health-plan' ),
131
-			'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ),
132
-			'edit_item'         => esc_html__( 'Edit', 'lsx-health-plan' ),
133
-			'update_item'       => esc_html__( 'Update', 'lsx-health-plan' ),
134
-			'add_new_item'      => esc_html__( 'Add New', 'lsx-health-plan' ),
135
-			'new_item_name'     => esc_html__( 'New Name', 'lsx-health-plan' ),
136
-			'menu_name'         => esc_html__( 'Exercise Types', 'lsx-health-plan' ),
126
+			'name'              => esc_html_x('Exercise Type', 'taxonomy general name', 'lsx-health-plan'),
127
+			'singular_name'     => esc_html_x('Exercise Type', 'taxonomy singular name', 'lsx-health-plan'),
128
+			'search_items'      => esc_html__('Search', 'lsx-health-plan'),
129
+			'all_items'         => esc_html__('All', 'lsx-health-plan'),
130
+			'parent_item'       => esc_html__('Parent', 'lsx-health-plan'),
131
+			'parent_item_colon' => esc_html__('Parent:', 'lsx-health-plan'),
132
+			'edit_item'         => esc_html__('Edit', 'lsx-health-plan'),
133
+			'update_item'       => esc_html__('Update', 'lsx-health-plan'),
134
+			'add_new_item'      => esc_html__('Add New', 'lsx-health-plan'),
135
+			'new_item_name'     => esc_html__('New Name', 'lsx-health-plan'),
136
+			'menu_name'         => esc_html__('Exercise Types', 'lsx-health-plan'),
137 137
 		);
138 138
 
139 139
 		$args = array(
@@ -143,12 +143,12 @@  discard block
 block discarded – undo
143 143
 			'show_admin_column' => true,
144 144
 			'query_var'         => true,
145 145
 			'rewrite'           => array(
146
-				'slug' => \lsx_health_plan\functions\get_option( 'endpoint_exercise_type', 'exercise-type' ),
146
+				'slug' => \lsx_health_plan\functions\get_option('endpoint_exercise_type', 'exercise-type'),
147 147
 			),
148 148
 			'show_in_rest'      => true,
149 149
 		);
150 150
 
151
-		register_taxonomy( 'exercise-type', array( 'exercise' ), $args );
151
+		register_taxonomy('exercise-type', array('exercise'), $args);
152 152
 	}
153 153
 
154 154
 	/**
@@ -158,17 +158,17 @@  discard block
 block discarded – undo
158 158
 	 */
159 159
 	public function equipment_taxonomy_setup() {
160 160
 		$labels = array(
161
-			'name'              => esc_html_x( 'Equipment', 'taxonomy general name', 'lsx-health-plan' ),
162
-			'singular_name'     => esc_html_x( 'Equipment', 'taxonomy singular name', 'lsx-health-plan' ),
163
-			'search_items'      => esc_html__( 'Search', 'lsx-health-plan' ),
164
-			'all_items'         => esc_html__( 'All', 'lsx-health-plan' ),
165
-			'parent_item'       => esc_html__( 'Parent', 'lsx-health-plan' ),
166
-			'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ),
167
-			'edit_item'         => esc_html__( 'Edit', 'lsx-health-plan' ),
168
-			'update_item'       => esc_html__( 'Update', 'lsx-health-plan' ),
169
-			'add_new_item'      => esc_html__( 'Add New', 'lsx-health-plan' ),
170
-			'new_item_name'     => esc_html__( 'New Name', 'lsx-health-plan' ),
171
-			'menu_name'         => esc_html__( 'Equipment', 'lsx-health-plan' ),
161
+			'name'              => esc_html_x('Equipment', 'taxonomy general name', 'lsx-health-plan'),
162
+			'singular_name'     => esc_html_x('Equipment', 'taxonomy singular name', 'lsx-health-plan'),
163
+			'search_items'      => esc_html__('Search', 'lsx-health-plan'),
164
+			'all_items'         => esc_html__('All', 'lsx-health-plan'),
165
+			'parent_item'       => esc_html__('Parent', 'lsx-health-plan'),
166
+			'parent_item_colon' => esc_html__('Parent:', 'lsx-health-plan'),
167
+			'edit_item'         => esc_html__('Edit', 'lsx-health-plan'),
168
+			'update_item'       => esc_html__('Update', 'lsx-health-plan'),
169
+			'add_new_item'      => esc_html__('Add New', 'lsx-health-plan'),
170
+			'new_item_name'     => esc_html__('New Name', 'lsx-health-plan'),
171
+			'menu_name'         => esc_html__('Equipment', 'lsx-health-plan'),
172 172
 		);
173 173
 
174 174
 		$args = array(
@@ -178,12 +178,12 @@  discard block
 block discarded – undo
178 178
 			'show_admin_column' => true,
179 179
 			'query_var'         => true,
180 180
 			'rewrite'           => array(
181
-				'slug' => \lsx_health_plan\functions\get_option( 'endpoint_exercise_equipment', 'equipment' ),
181
+				'slug' => \lsx_health_plan\functions\get_option('endpoint_exercise_equipment', 'equipment'),
182 182
 			),
183 183
 			'show_in_rest'      => true,
184 184
 		);
185 185
 
186
-		register_taxonomy( 'equipment', array( 'exercise' ), $args );
186
+		register_taxonomy('equipment', array('exercise'), $args);
187 187
 	}
188 188
 
189 189
 	/**
@@ -193,17 +193,17 @@  discard block
 block discarded – undo
193 193
 	 */
194 194
 	public function muscle_group_taxonomy_setup() {
195 195
 		$labels = array(
196
-			'name'              => esc_html_x( 'Muscle Groups', 'taxonomy general name', 'lsx-health-plan' ),
197
-			'singular_name'     => esc_html_x( 'Muscle Group', 'taxonomy singular name', 'lsx-health-plan' ),
198
-			'search_items'      => esc_html__( 'Search', 'lsx-health-plan' ),
199
-			'all_items'         => esc_html__( 'All', 'lsx-health-plan' ),
200
-			'parent_item'       => esc_html__( 'Parent', 'lsx-health-plan' ),
201
-			'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ),
202
-			'edit_item'         => esc_html__( 'Edit', 'lsx-health-plan' ),
203
-			'update_item'       => esc_html__( 'Update', 'lsx-health-plan' ),
204
-			'add_new_item'      => esc_html__( 'Add New', 'lsx-health-plan' ),
205
-			'new_item_name'     => esc_html__( 'New Name', 'lsx-health-plan' ),
206
-			'menu_name'         => esc_html__( 'Muscle Groups', 'lsx-health-plan' ),
196
+			'name'              => esc_html_x('Muscle Groups', 'taxonomy general name', 'lsx-health-plan'),
197
+			'singular_name'     => esc_html_x('Muscle Group', 'taxonomy singular name', 'lsx-health-plan'),
198
+			'search_items'      => esc_html__('Search', 'lsx-health-plan'),
199
+			'all_items'         => esc_html__('All', 'lsx-health-plan'),
200
+			'parent_item'       => esc_html__('Parent', 'lsx-health-plan'),
201
+			'parent_item_colon' => esc_html__('Parent:', 'lsx-health-plan'),
202
+			'edit_item'         => esc_html__('Edit', 'lsx-health-plan'),
203
+			'update_item'       => esc_html__('Update', 'lsx-health-plan'),
204
+			'add_new_item'      => esc_html__('Add New', 'lsx-health-plan'),
205
+			'new_item_name'     => esc_html__('New Name', 'lsx-health-plan'),
206
+			'menu_name'         => esc_html__('Muscle Groups', 'lsx-health-plan'),
207 207
 		);
208 208
 
209 209
 		$args = array(
@@ -213,12 +213,12 @@  discard block
 block discarded – undo
213 213
 			'show_admin_column' => true,
214 214
 			'query_var'         => true,
215 215
 			'rewrite'           => array(
216
-				'slug' => \lsx_health_plan\functions\get_option( 'endpoint_exercise_muscle_group', 'muscle-group' ),
216
+				'slug' => \lsx_health_plan\functions\get_option('endpoint_exercise_muscle_group', 'muscle-group'),
217 217
 			),
218 218
 			'show_in_rest'      => true,
219 219
 		);
220 220
 
221
-		register_taxonomy( 'muscle-group', array( 'exercise' ), $args );
221
+		register_taxonomy('muscle-group', array('exercise'), $args);
222 222
 	}
223 223
 
224 224
 	/**
@@ -227,10 +227,10 @@  discard block
 block discarded – undo
227 227
 	 * @return void
228 228
 	 */
229 229
 	public function register_menus() {
230
-		add_submenu_page( 'edit.php?post_type=workout', esc_html__( 'Exercises', 'lsx-health-plan' ), esc_html__( 'Exercises', 'lsx-health-plan' ), 'edit_posts', 'edit.php?post_type=exercise' );
231
-		add_submenu_page( 'edit.php?post_type=workout', esc_html__( 'Exercise Types', 'lsx-health-plan' ), esc_html__( 'Exercise Types', 'lsx-health-plan' ), 'edit_posts', 'edit-tags.php?taxonomy=exercise-type&post_type=exercise' );
232
-		add_submenu_page( 'edit.php?post_type=workout', esc_html__( 'Equipment', 'lsx-health-plan' ), esc_html__( 'Equipment', 'lsx-health-plan' ), 'edit_posts', 'edit-tags.php?taxonomy=equipment&post_type=exercise' );
233
-		add_submenu_page( 'edit.php?post_type=workout', esc_html__( 'Muscle Groups', 'lsx-health-plan' ), esc_html__( 'Muscle Groups', 'lsx-health-plan' ), 'edit_posts', 'edit-tags.php?taxonomy=muscle-group&post_type=exercise' );
230
+		add_submenu_page('edit.php?post_type=workout', esc_html__('Exercises', 'lsx-health-plan'), esc_html__('Exercises', 'lsx-health-plan'), 'edit_posts', 'edit.php?post_type=exercise');
231
+		add_submenu_page('edit.php?post_type=workout', esc_html__('Exercise Types', 'lsx-health-plan'), esc_html__('Exercise Types', 'lsx-health-plan'), 'edit_posts', 'edit-tags.php?taxonomy=exercise-type&post_type=exercise');
232
+		add_submenu_page('edit.php?post_type=workout', esc_html__('Equipment', 'lsx-health-plan'), esc_html__('Equipment', 'lsx-health-plan'), 'edit_posts', 'edit-tags.php?taxonomy=equipment&post_type=exercise');
233
+		add_submenu_page('edit.php?post_type=workout', esc_html__('Muscle Groups', 'lsx-health-plan'), esc_html__('Muscle Groups', 'lsx-health-plan'), 'edit_posts', 'edit-tags.php?taxonomy=muscle-group&post_type=exercise');
234 234
 	}
235 235
 
236 236
 	/**
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 	 * @param array $post_types
240 240
 	 * @return array
241 241
 	 */
242
-	public function enable_post_type( $post_types = array() ) {
242
+	public function enable_post_type($post_types = array()) {
243 243
 		$post_types[] = $this->slug;
244 244
 		return $post_types;
245 245
 	}
@@ -250,7 +250,7 @@  discard block
 block discarded – undo
250 250
 	 * @param array $connections
251 251
 	 * @return void
252 252
 	 */
253
-	public function enable_connections( $connections = array() ) {
253
+	public function enable_connections($connections = array()) {
254 254
 		$connections['exercise']['connected_workouts'] = 'connected_exercises';
255 255
 		$connections['workout']['connected_exercises'] = 'connected_workouts';
256 256
 		return $connections;
@@ -263,8 +263,8 @@  discard block
 block discarded – undo
263 263
 		$cmb = new_cmb2_box(
264 264
 			array(
265 265
 				'id'           => $this->slug . '_gallery_details_metabox',
266
-				'title'        => __( 'Exercise Gallery', 'lsx-health-plan' ),
267
-				'object_types' => array( $this->slug ),
266
+				'title'        => __('Exercise Gallery', 'lsx-health-plan'),
267
+				'object_types' => array($this->slug),
268 268
 				'context'      => 'normal',
269 269
 				'priority'     => 'low',
270 270
 				'show_names'   => true,
@@ -273,12 +273,12 @@  discard block
 block discarded – undo
273 273
 
274 274
 		$cmb->add_field(
275 275
 			array(
276
-				'name'    => __( 'Layout', 'lsx-health-plan' ),
276
+				'name'    => __('Layout', 'lsx-health-plan'),
277 277
 				'id'      => $this->slug . '_gallery_layout',
278 278
 				'type'    => 'radio',
279 279
 				'options' => array(
280
-					'slider' => __( 'Slider', 'lsx-health-plan' ) . ' {#}', // {#} gets replaced by row number
281
-					'grid'   => __( 'Grid', 'lsx-health-plan' ),
280
+					'slider' => __('Slider', 'lsx-health-plan') . ' {#}', // {#} gets replaced by row number
281
+					'grid'   => __('Grid', 'lsx-health-plan'),
282 282
 				),
283 283
 				'default' => 'grid',
284 284
 			)
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
 
287 287
 		$cmb->add_field(
288 288
 			array(
289
-				'name'    => __( 'Grid Columns', 'lsx-health-plan' ),
289
+				'name'    => __('Grid Columns', 'lsx-health-plan'),
290 290
 				'id'      => $this->slug . '_gallery_columns',
291 291
 				'type'    => 'text',
292 292
 				'default' => '1',
@@ -299,9 +299,9 @@  discard block
 block discarded – undo
299 299
 				'id'      => $this->slug . '_gallery',
300 300
 				'type'    => 'group',
301 301
 				'options' => array(
302
-					'group_title'   => __( 'Gallery', 'lsx-health-plan' ) . ' {#}', // {#} gets replaced by row number
303
-					'add_button'    => __( 'Add Item', 'lsx-health-plan' ),
304
-					'remove_button' => __( 'Remove Item', 'lsx-health-plan' ),
302
+					'group_title'   => __('Gallery', 'lsx-health-plan') . ' {#}', // {#} gets replaced by row number
303
+					'add_button'    => __('Add Item', 'lsx-health-plan'),
304
+					'remove_button' => __('Remove Item', 'lsx-health-plan'),
305 305
 					'sortable'      => true,
306 306
 				),
307 307
 				'classes' => 'lsx-admin-row',
@@ -312,13 +312,13 @@  discard block
 block discarded – undo
312 312
 		$cmb->add_group_field(
313 313
 			$gallery_group,
314 314
 			array(
315
-				'name'       => __( 'Image', 'lsx-health-plan' ),
315
+				'name'       => __('Image', 'lsx-health-plan'),
316 316
 				'id'         => $this->slug . '_gallery_image',
317 317
 				'type'       => 'file',
318 318
 				'text'       => array(
319
-					'add_upload_file_text' => __( 'Add File', 'lsx-health-plan' ),
319
+					'add_upload_file_text' => __('Add File', 'lsx-health-plan'),
320 320
 				),
321
-				'desc'       => __( 'Upload an image a minimum of 800px x 600px in size.', 'lsx-health-plan' ),
321
+				'desc'       => __('Upload an image a minimum of 800px x 600px in size.', 'lsx-health-plan'),
322 322
 				'query_args' => array(
323 323
 					'type' => array(
324 324
 						'image/gif',
@@ -334,20 +334,20 @@  discard block
 block discarded – undo
334 334
 		$cmb->add_group_field(
335 335
 			$gallery_group,
336 336
 			array(
337
-				'name'         => __( 'oEmbed', 'lsx-health-plan' ),
337
+				'name'         => __('oEmbed', 'lsx-health-plan'),
338 338
 				'id'           => $this->slug . '_gallery_embed',
339 339
 				'type'         => 'text',
340
-				'desc'         => __( 'Drop in the embed url for your video from YouTube, Vimeo or DailyMotion, e.g: "https://www.youtube.com/watch?v=9xwazD5SyVg". A full list of supports formats can be found at <a href="https://make.wordpress.org/support/user-manual/content/media/adding-media-to-your-pages-and-posts/embedding-media-from-other-sites/">WordPress</a>', 'lsx-health-plan' ),
340
+				'desc'         => __('Drop in the embed url for your video from YouTube, Vimeo or DailyMotion, e.g: "https://www.youtube.com/watch?v=9xwazD5SyVg". A full list of supports formats can be found at <a href="https://make.wordpress.org/support/user-manual/content/media/adding-media-to-your-pages-and-posts/embedding-media-from-other-sites/">WordPress</a>', 'lsx-health-plan'),
341 341
 			)
342 342
 		);
343 343
 
344 344
 		$cmb->add_group_field(
345 345
 			$gallery_group,
346 346
 			array(
347
-				'name'         => __( 'External Media', 'lsx-health-plan' ),
347
+				'name'         => __('External Media', 'lsx-health-plan'),
348 348
 				'id'           => $this->slug . '_gallery_external',
349 349
 				'type'         => 'textarea_code',
350
-				'desc'         => __( 'Drop in the iFrame embed code from Giphy in this field, i.e: &lt;iframe src="https://giphy.com/embed/3o7527Rn1HxXWqgxuo" width="480" height="270" frameborder="0" class="giphy-embed" allowfullscreen&gt;&lt;/iframe&gt;', 'lsx-health-plan' ),
350
+				'desc'         => __('Drop in the iFrame embed code from Giphy in this field, i.e: &lt;iframe src="https://giphy.com/embed/3o7527Rn1HxXWqgxuo" width="480" height="270" frameborder="0" class="giphy-embed" allowfullscreen&gt;&lt;/iframe&gt;', 'lsx-health-plan'),
351 351
 			)
352 352
 		);
353 353
 	}
@@ -361,8 +361,8 @@  discard block
 block discarded – undo
361 361
 		$cmb = new_cmb2_box(
362 362
 			array(
363 363
 				'id'           => $this->slug . '_general_details_metabox',
364
-				'title'        => __( 'Details', 'lsx-health-plan' ),
365
-				'object_types' => array( $this->slug ),
364
+				'title'        => __('Details', 'lsx-health-plan'),
365
+				'object_types' => array($this->slug),
366 366
 				'context'      => 'normal',
367 367
 				'priority'     => 'high',
368 368
 				'show_names'   => true,
@@ -371,15 +371,15 @@  discard block
 block discarded – undo
371 371
 
372 372
 		$cmb->add_field(
373 373
 			array(
374
-				'name'    => __( 'Side', 'lsx-health-plan' ),
374
+				'name'    => __('Side', 'lsx-health-plan'),
375 375
 				'id'      => $this->slug . '_side',
376 376
 				'type'    => 'select',
377 377
 				'options' => array(
378
-					''      => __( 'Select', 'lsx-health-plan' ),
379
-					'left'  => __( 'Left', 'lsx-health-plan' ),
380
-					'right' => __( 'Right', 'lsx-health-plan' ),
378
+					''      => __('Select', 'lsx-health-plan'),
379
+					'left'  => __('Left', 'lsx-health-plan'),
380
+					'right' => __('Right', 'lsx-health-plan'),
381 381
 				),
382
-				'desc'    => __( 'Select which side this exercise uses. ', 'lsx-health-plan' ),
382
+				'desc'    => __('Select which side this exercise uses. ', 'lsx-health-plan'),
383 383
 			)
384 384
 		);
385 385
 	}
@@ -390,16 +390,16 @@  discard block
 block discarded – undo
390 390
 	 * @var array $crumbs
391 391
 	 * @return array
392 392
 	 */
393
-	public function exercise_breadcrumb_filter( $crumbs ) {
394
-		$exercise  = \lsx_health_plan\functions\get_option( 'endpoint_exercise', 'exercise' );
395
-		$exercises = \lsx_health_plan\functions\get_option( 'endpoint_exercise_archive', 'exercise' );
396
-		$url       = get_post_type_archive_link( $exercise );
393
+	public function exercise_breadcrumb_filter($crumbs) {
394
+		$exercise  = \lsx_health_plan\functions\get_option('endpoint_exercise', 'exercise');
395
+		$exercises = \lsx_health_plan\functions\get_option('endpoint_exercise_archive', 'exercise');
396
+		$url       = get_post_type_archive_link($exercise);
397 397
 
398
-		if ( is_singular( 'exercise' ) ) {
398
+		if (is_singular('exercise')) {
399 399
 			$exercise_name     = get_the_title();	
400
-			$term_obj_list     = get_the_terms( get_the_ID(), 'exercise-type' );
400
+			$term_obj_list     = get_the_terms(get_the_ID(), 'exercise-type');
401 401
 			$exercise_type     = $term_obj_list[0]->name;
402
-			$exercise_type_url = get_term_link( $term_obj_list[0]->term_id );
402
+			$exercise_type_url = get_term_link($term_obj_list[0]->term_id);
403 403
 		
404 404
 			$crumbs[1] = array(
405 405
 				0 => $exercises,
@@ -413,10 +413,10 @@  discard block
 block discarded – undo
413 413
 				0 => $exercise_name,
414 414
 			);
415 415
 		}
416
-		if ( is_tax( 'exercise-type' ) || is_tax( 'muscle-group' ) || is_tax( 'equipment' ) ) {
417
-			$term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); 
416
+		if (is_tax('exercise-type') || is_tax('muscle-group') || is_tax('equipment')) {
417
+			$term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy')); 
418 418
 
419
-			$single_term_title = str_replace( '-', ' ', $term->taxonomy ) . ': ' . $term->name;
419
+			$single_term_title = str_replace('-', ' ', $term->taxonomy) . ': ' . $term->name;
420 420
 
421 421
 			$crumbs[1] = array(
422 422
 				0 => $exercises,
Please login to merge, or discard this patch.
classes/post-types/class-recipe.php 2 patches
Spacing   +113 added lines, -113 removed lines patch added patch discarded remove patch
@@ -39,24 +39,24 @@  discard block
 block discarded – undo
39 39
 	 * Constructor
40 40
 	 */
41 41
 	public function __construct() {
42
-		add_action( 'init', array( $this, 'register_post_type' ) );
43
-		add_action( 'init', array( $this, 'taxonomy_setup' ) );
44
-		add_action( 'admin_menu', array( $this, 'register_menus' ) );
42
+		add_action('init', array($this, 'register_post_type'));
43
+		add_action('init', array($this, 'taxonomy_setup'));
44
+		add_action('admin_menu', array($this, 'register_menus'));
45 45
 
46 46
 		// Frontend Actions and Filters.
47
-		add_action( 'wp_head', array( $this, 'remove_archive_original_header' ), 99 );
48
-		add_action( 'lsx_content_wrap_before', array( $this, 'hp_lsx_archive_header' ) );
47
+		add_action('wp_head', array($this, 'remove_archive_original_header'), 99);
48
+		add_action('lsx_content_wrap_before', array($this, 'hp_lsx_archive_header'));
49 49
 
50
-		add_filter( 'lsx_health_plan_archive_template', array( $this, 'enable_post_type' ), 10, 1 );
51
-		add_filter( 'lsx_health_plan_single_template', array( $this, 'enable_post_type' ), 10, 1 );
52
-		add_filter( 'lsx_health_plan_connections', array( $this, 'enable_connections' ), 10, 1 );
53
-		add_filter( 'get_the_archive_title', array( $this, 'get_the_archive_title' ), 100 );
54
-		add_filter( 'lsx_display_global_header_description', array( $this, 'disable_global_header_description' ), 100 );
55
-		add_filter( 'woocommerce_get_breadcrumb', array( $this, 'recipes_breadcrumb_filter' ), 30, 1 );
50
+		add_filter('lsx_health_plan_archive_template', array($this, 'enable_post_type'), 10, 1);
51
+		add_filter('lsx_health_plan_single_template', array($this, 'enable_post_type'), 10, 1);
52
+		add_filter('lsx_health_plan_connections', array($this, 'enable_connections'), 10, 1);
53
+		add_filter('get_the_archive_title', array($this, 'get_the_archive_title'), 100);
54
+		add_filter('lsx_display_global_header_description', array($this, 'disable_global_header_description'), 100);
55
+		add_filter('woocommerce_get_breadcrumb', array($this, 'recipes_breadcrumb_filter'), 30, 1);
56 56
 
57 57
 		// Backend Actions and Filters.
58
-		add_action( 'cmb2_admin_init', array( $this, 'featured_metabox' ) );
59
-		add_action( 'cmb2_admin_init', array( $this, 'details_metaboxes' ) );
58
+		add_action('cmb2_admin_init', array($this, 'featured_metabox'));
59
+		add_action('cmb2_admin_init', array($this, 'details_metaboxes'));
60 60
 	}
61 61
 
62 62
 	/**
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 	public static function get_instance() {
70 70
 
71 71
 		// If the single instance hasn't been set, set it now.
72
-		if ( null === self::$instance ) {
72
+		if (null === self::$instance) {
73 73
 			self::$instance = new self();
74 74
 		}
75 75
 
@@ -82,21 +82,21 @@  discard block
 block discarded – undo
82 82
 	 */
83 83
 	public function register_post_type() {
84 84
 		$this->labels = array(
85
-			'name'               => esc_html__( 'Recipes', 'lsx-health-plan' ),
86
-			'singular_name'      => esc_html__( 'Recipe', 'lsx-health-plan' ),
87
-			'add_new'            => esc_html_x( 'Add New', 'post type general name', 'lsx-health-plan' ),
88
-			'add_new_item'       => esc_html__( 'Add New', 'lsx-health-plan' ),
89
-			'edit_item'          => esc_html__( 'Edit', 'lsx-health-plan' ),
90
-			'new_item'           => esc_html__( 'New', 'lsx-health-plan' ),
91
-			'all_items'          => esc_html__( 'All Recipes', 'lsx-health-plan' ),
92
-			'view_item'          => esc_html__( 'View', 'lsx-health-plan' ),
93
-			'search_items'       => esc_html__( 'Search', 'lsx-health-plan' ),
94
-			'not_found'          => esc_html__( 'None found', 'lsx-health-plan' ),
95
-			'not_found_in_trash' => esc_html__( 'None found in Trash', 'lsx-health-plan' ),
85
+			'name'               => esc_html__('Recipes', 'lsx-health-plan'),
86
+			'singular_name'      => esc_html__('Recipe', 'lsx-health-plan'),
87
+			'add_new'            => esc_html_x('Add New', 'post type general name', 'lsx-health-plan'),
88
+			'add_new_item'       => esc_html__('Add New', 'lsx-health-plan'),
89
+			'edit_item'          => esc_html__('Edit', 'lsx-health-plan'),
90
+			'new_item'           => esc_html__('New', 'lsx-health-plan'),
91
+			'all_items'          => esc_html__('All Recipes', 'lsx-health-plan'),
92
+			'view_item'          => esc_html__('View', 'lsx-health-plan'),
93
+			'search_items'       => esc_html__('Search', 'lsx-health-plan'),
94
+			'not_found'          => esc_html__('None found', 'lsx-health-plan'),
95
+			'not_found_in_trash' => esc_html__('None found in Trash', 'lsx-health-plan'),
96 96
 			'parent_item_colon'  => '',
97
-			'menu_name'          => esc_html__( 'Recipes', 'lsx-health-plan' ),
97
+			'menu_name'          => esc_html__('Recipes', 'lsx-health-plan'),
98 98
 		);
99
-		$args         = array(
99
+		$args = array(
100 100
 			'labels'             => $this->labels,
101 101
 			'public'             => true,
102 102
 			'publicly_queryable' => true,
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 				'custom-fields',
120 120
 			),
121 121
 		);
122
-		register_post_type( 'recipe', $args );
122
+		register_post_type('recipe', $args);
123 123
 	}
124 124
 
125 125
 	/**
@@ -128,9 +128,9 @@  discard block
 block discarded – undo
128 128
 	 * @return void
129 129
 	 */
130 130
 	public function register_menus() {
131
-		add_submenu_page( 'edit.php?post_type=meal', esc_html__( 'Recipes', 'lsx-health-plan' ), esc_html__( 'Recipes', 'lsx-health-plan' ), 'edit_posts', 'edit.php?post_type=recipe' );
132
-		add_submenu_page( 'edit.php?post_type=meal', esc_html__( 'Recipe Types', 'lsx-health-plan' ), esc_html__( 'Recipe Types', 'lsx-health-plan' ), 'edit_posts', 'edit-tags.php?taxonomy=recipe-type&post_type=recipe' );
133
-		add_submenu_page( 'edit.php?post_type=meal', esc_html__( 'Cuisines', 'lsx-health-plan' ), esc_html__( 'Cuisines', 'lsx-health-plan' ), 'edit_posts', 'edit-tags.php?taxonomy=recipe-cuisine&post_type=recipe' );
131
+		add_submenu_page('edit.php?post_type=meal', esc_html__('Recipes', 'lsx-health-plan'), esc_html__('Recipes', 'lsx-health-plan'), 'edit_posts', 'edit.php?post_type=recipe');
132
+		add_submenu_page('edit.php?post_type=meal', esc_html__('Recipe Types', 'lsx-health-plan'), esc_html__('Recipe Types', 'lsx-health-plan'), 'edit_posts', 'edit-tags.php?taxonomy=recipe-type&post_type=recipe');
133
+		add_submenu_page('edit.php?post_type=meal', esc_html__('Cuisines', 'lsx-health-plan'), esc_html__('Cuisines', 'lsx-health-plan'), 'edit_posts', 'edit-tags.php?taxonomy=recipe-cuisine&post_type=recipe');
134 134
 	}
135 135
 
136 136
 	/**
@@ -138,19 +138,19 @@  discard block
 block discarded – undo
138 138
 	 */
139 139
 	public function taxonomy_setup() {
140 140
 		$labels = array(
141
-			'name'              => esc_html_x( 'Cuisine', 'taxonomy general name', 'lsx-health-plan' ),
142
-			'singular_name'     => esc_html_x( 'Cuisines', 'taxonomy singular name', 'lsx-health-plan' ),
143
-			'search_items'      => esc_html__( 'Search', 'lsx-health-plan' ),
144
-			'all_items'         => esc_html__( 'All', 'lsx-health-plan' ),
145
-			'parent_item'       => esc_html__( 'Parent', 'lsx-health-plan' ),
146
-			'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ),
147
-			'edit_item'         => esc_html__( 'Edit', 'lsx-health-plan' ),
148
-			'update_item'       => esc_html__( 'Update', 'lsx-health-plan' ),
149
-			'add_new_item'      => esc_html__( 'Add New', 'lsx-health-plan' ),
150
-			'new_item_name'     => esc_html__( 'New Name', 'lsx-health-plan' ),
151
-			'menu_name'         => esc_html__( 'Cuisines', 'lsx-health-plan' ),
141
+			'name'              => esc_html_x('Cuisine', 'taxonomy general name', 'lsx-health-plan'),
142
+			'singular_name'     => esc_html_x('Cuisines', 'taxonomy singular name', 'lsx-health-plan'),
143
+			'search_items'      => esc_html__('Search', 'lsx-health-plan'),
144
+			'all_items'         => esc_html__('All', 'lsx-health-plan'),
145
+			'parent_item'       => esc_html__('Parent', 'lsx-health-plan'),
146
+			'parent_item_colon' => esc_html__('Parent:', 'lsx-health-plan'),
147
+			'edit_item'         => esc_html__('Edit', 'lsx-health-plan'),
148
+			'update_item'       => esc_html__('Update', 'lsx-health-plan'),
149
+			'add_new_item'      => esc_html__('Add New', 'lsx-health-plan'),
150
+			'new_item_name'     => esc_html__('New Name', 'lsx-health-plan'),
151
+			'menu_name'         => esc_html__('Cuisines', 'lsx-health-plan'),
152 152
 		);
153
-		$args   = array(
153
+		$args = array(
154 154
 			'hierarchical'      => true,
155 155
 			'labels'            => $labels,
156 156
 			'show_ui'           => true,
@@ -161,22 +161,22 @@  discard block
 block discarded – undo
161 161
 				'slug' => 'recipe-cuisine',
162 162
 			),
163 163
 		);
164
-		register_taxonomy( 'recipe-cuisine', array( $this->slug ), $args );
164
+		register_taxonomy('recipe-cuisine', array($this->slug), $args);
165 165
 
166 166
 		$labels = array(
167
-			'name'              => esc_html_x( 'Recipe Type', 'taxonomy general name', 'lsx-health-plan' ),
168
-			'singular_name'     => esc_html_x( 'Recipe Types', 'taxonomy singular name', 'lsx-health-plan' ),
169
-			'search_items'      => esc_html__( 'Search', 'lsx-health-plan' ),
170
-			'all_items'         => esc_html__( 'All', 'lsx-health-plan' ),
171
-			'parent_item'       => esc_html__( 'Parent', 'lsx-health-plan' ),
172
-			'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ),
173
-			'edit_item'         => esc_html__( 'Edit', 'lsx-health-plan' ),
174
-			'update_item'       => esc_html__( 'Update', 'lsx-health-plan' ),
175
-			'add_new_item'      => esc_html__( 'Add New', 'lsx-health-plan' ),
176
-			'new_item_name'     => esc_html__( 'New Name', 'lsx-health-plan' ),
177
-			'menu_name'         => esc_html__( 'Types', 'lsx-health-plan' ),
167
+			'name'              => esc_html_x('Recipe Type', 'taxonomy general name', 'lsx-health-plan'),
168
+			'singular_name'     => esc_html_x('Recipe Types', 'taxonomy singular name', 'lsx-health-plan'),
169
+			'search_items'      => esc_html__('Search', 'lsx-health-plan'),
170
+			'all_items'         => esc_html__('All', 'lsx-health-plan'),
171
+			'parent_item'       => esc_html__('Parent', 'lsx-health-plan'),
172
+			'parent_item_colon' => esc_html__('Parent:', 'lsx-health-plan'),
173
+			'edit_item'         => esc_html__('Edit', 'lsx-health-plan'),
174
+			'update_item'       => esc_html__('Update', 'lsx-health-plan'),
175
+			'add_new_item'      => esc_html__('Add New', 'lsx-health-plan'),
176
+			'new_item_name'     => esc_html__('New Name', 'lsx-health-plan'),
177
+			'menu_name'         => esc_html__('Types', 'lsx-health-plan'),
178 178
 		);
179
-		$args   = array(
179
+		$args = array(
180 180
 			'hierarchical'      => true,
181 181
 			'labels'            => $labels,
182 182
 			'show_ui'           => true,
@@ -187,7 +187,7 @@  discard block
 block discarded – undo
187 187
 				'slug' => 'recipe-type',
188 188
 			),
189 189
 		);
190
-		register_taxonomy( 'recipe-type', array( $this->slug ), $args );
190
+		register_taxonomy('recipe-type', array($this->slug), $args);
191 191
 	}
192 192
 
193 193
 	/**
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 	 * @param array $post_types
197 197
 	 * @return array
198 198
 	 */
199
-	public function enable_post_type( $post_types = array() ) {
199
+	public function enable_post_type($post_types = array()) {
200 200
 		$post_types[] = $this->slug;
201 201
 		return $post_types;
202 202
 	}
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 	 * @param array $connections
208 208
 	 * @return void
209 209
 	 */
210
-	public function enable_connections( $connections = array() ) {
210
+	public function enable_connections($connections = array()) {
211 211
 		$connections['recipe']['connected_plans'] = 'connected_recipes';
212 212
 		$connections['plan']['connected_recipes'] = 'connected_plans';
213 213
 		return $connections;
@@ -219,42 +219,42 @@  discard block
 block discarded – undo
219 219
 	 * @param string $title the term title.
220 220
 	 * @return string
221 221
 	 */
222
-	public function get_the_archive_title( $title ) {
223
-		if ( is_post_type_archive( 'recipe' ) ) {
224
-			$title = __( 'Recipes', 'lsx-health-plan' );
222
+	public function get_the_archive_title($title) {
223
+		if (is_post_type_archive('recipe')) {
224
+			$title = __('Recipes', 'lsx-health-plan');
225 225
 		}
226
-		if ( is_post_type_archive( 'exercise' ) ) {
227
-			$title = __( 'Exercises', 'lsx-health-plan' );
226
+		if (is_post_type_archive('exercise')) {
227
+			$title = __('Exercises', 'lsx-health-plan');
228 228
 		}
229
-		if ( is_tax( 'recipe-type' ) ) {
229
+		if (is_tax('recipe-type')) {
230 230
 			$queried_object = get_queried_object();
231
-			if ( isset( $queried_object->name ) ) {
232
-				$title = $queried_object->name . ' ' . __( 'Recipes', 'lsx-health-plan' );
231
+			if (isset($queried_object->name)) {
232
+				$title = $queried_object->name . ' ' . __('Recipes', 'lsx-health-plan');
233 233
 			}
234 234
 		}
235 235
 		return $title;
236 236
 	}
237 237
 
238 238
 	public function remove_archive_original_header() {
239
-		if ( is_post_type_archive( 'recipe' ) || is_post_type_archive( 'exercise' ) ) {
240
-			remove_action( 'lsx_content_wrap_before', 'lsx_global_header' );
239
+		if (is_post_type_archive('recipe') || is_post_type_archive('exercise')) {
240
+			remove_action('lsx_content_wrap_before', 'lsx_global_header');
241 241
 		}
242
-		if ( ! is_post_type_archive() ) {
243
-			add_action( 'lsx_content_wrap_before', 'lsx_health_plan_recipe_archive_description', 11 );
242
+		if ( ! is_post_type_archive()) {
243
+			add_action('lsx_content_wrap_before', 'lsx_health_plan_recipe_archive_description', 11);
244 244
 		}
245 245
 	}
246 246
 
247 247
 	public function hp_lsx_archive_header() {
248
-		if ( is_post_type_archive( 'recipe' ) || is_post_type_archive( 'exercise' ) ) {
248
+		if (is_post_type_archive('recipe') || is_post_type_archive('exercise')) {
249 249
 		?>
250 250
 			<div class="archive-header-wrapper banner-archive">
251 251
 				<?php lsx_global_header_inner_bottom(); ?>
252 252
 				<header class="archive-header">
253 253
 					<h1 class="archive-title">
254
-						<?php if ( has_post_format() && ! is_category() && ! is_tag() && ! is_date() && ! is_tax( 'post_format' ) ) { ?>
255
-							<?php the_archive_title( esc_html__( 'Type:', 'lsx' ) ); ?>
254
+						<?php if (has_post_format() && ! is_category() && ! is_tag() && ! is_date() && ! is_tax('post_format')) { ?>
255
+							<?php the_archive_title(esc_html__('Type:', 'lsx')); ?>
256 256
 						<?php } else { ?>
257
-							<?php echo wp_kses_post( apply_filters( 'lsx_global_header_title', get_the_archive_title() ) ); ?>
257
+							<?php echo wp_kses_post(apply_filters('lsx_global_header_title', get_the_archive_title())); ?>
258 258
 						<?php } ?>
259 259
 					</h1>
260 260
 
@@ -273,8 +273,8 @@  discard block
 block discarded – undo
273 273
 	 * @param boolean $disable
274 274
 	 * @return boolean
275 275
 	 */
276
-	public function disable_global_header_description( $disable ) {
277
-		if ( is_tax( 'recipe-type' ) ) {
276
+	public function disable_global_header_description($disable) {
277
+		if (is_tax('recipe-type')) {
278 278
 			$disable = true;
279 279
 		}
280 280
 		return $disable;
@@ -286,16 +286,16 @@  discard block
 block discarded – undo
286 286
 	 * @var array $crumbs
287 287
 	 * @return array
288 288
 	 */
289
-	public function recipes_breadcrumb_filter( $crumbs ) {
290
-		$recipe  = \lsx_health_plan\functions\get_option( 'endpoint_recipe', 'recipe' );
291
-		$recipes = \lsx_health_plan\functions\get_option( 'endpoint_recipe_archive', 'recipes' );
292
-		$url     = get_post_type_archive_link( 'recipe' );
289
+	public function recipes_breadcrumb_filter($crumbs) {
290
+		$recipe  = \lsx_health_plan\functions\get_option('endpoint_recipe', 'recipe');
291
+		$recipes = \lsx_health_plan\functions\get_option('endpoint_recipe_archive', 'recipes');
292
+		$url     = get_post_type_archive_link('recipe');
293 293
 
294
-		if ( is_singular( 'recipe' ) ) {
294
+		if (is_singular('recipe')) {
295 295
 			$recipe_name     = get_the_title();
296
-			$term_obj_list   = get_the_terms( get_the_ID(), 'recipe-type' );
296
+			$term_obj_list   = get_the_terms(get_the_ID(), 'recipe-type');
297 297
 			$recipe_type     = $term_obj_list[0]->name;
298
-			$recipe_type_url = get_term_link( $term_obj_list[0]->term_id );
298
+			$recipe_type_url = get_term_link($term_obj_list[0]->term_id);
299 299
 		
300 300
 			$crumbs[1] = array(
301 301
 				0 => $recipes,
@@ -309,10 +309,10 @@  discard block
 block discarded – undo
309 309
 				0 => $recipe_name,
310 310
 			);
311 311
 		}
312
-		if ( is_tax( 'recipe-type' ) || is_tax( 'recipe-cuisine' ) ) {
313
-			$term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); 
312
+		if (is_tax('recipe-type') || is_tax('recipe-cuisine')) {
313
+			$term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy')); 
314 314
 
315
-			$single_term_title = str_replace( '-', ' ', $term->taxonomy ) . ': ' . $term->name;
315
+			$single_term_title = str_replace('-', ' ', $term->taxonomy) . ': ' . $term->name;
316 316
 
317 317
 			$crumbs[1] = array(
318 318
 				0 => $recipes,
@@ -332,8 +332,8 @@  discard block
 block discarded – undo
332 332
 		$cmb = new_cmb2_box(
333 333
 			array(
334 334
 				'id'           => $this->slug . '_featured_metabox',
335
-				'title'        => __( 'Featured', 'lsx-health-plan' ),
336
-				'object_types' => array( $this->slug ),
335
+				'title'        => __('Featured', 'lsx-health-plan'),
336
+				'object_types' => array($this->slug),
337 337
 				'context'      => 'side',
338 338
 				'priority'     => 'high',
339 339
 				'show_names'   => true,
@@ -341,8 +341,8 @@  discard block
 block discarded – undo
341 341
 		);
342 342
 		$cmb->add_field(
343 343
 			array(
344
-				'name'       => __( 'Featured', 'lsx-health-plan' ),
345
-				'desc'       => __( 'Enable the checkbox to feature this recipe, featured recipes display in any page that has the recipe shortcode: [lsx_health_plan_featured_recipes_block]', 'lsx-health-plan' ),
344
+				'name'       => __('Featured', 'lsx-health-plan'),
345
+				'desc'       => __('Enable the checkbox to feature this recipe, featured recipes display in any page that has the recipe shortcode: [lsx_health_plan_featured_recipes_block]', 'lsx-health-plan'),
346 346
 				'id'         => $this->slug . '_featured',
347 347
 				'type'       => 'checkbox',
348 348
 				'show_on_cb' => 'cmb2_hide_if_no_cats',
@@ -357,8 +357,8 @@  discard block
 block discarded – undo
357 357
 		$cmb = new_cmb2_box(
358 358
 			array(
359 359
 				'id'           => $this->slug . '_details_metabox',
360
-				'title'        => __( 'Cooking Info', 'lsx-health-plan' ),
361
-				'object_types' => array( $this->slug ), // Post type
360
+				'title'        => __('Cooking Info', 'lsx-health-plan'),
361
+				'object_types' => array($this->slug), // Post type
362 362
 				'context'      => 'normal',
363 363
 				'priority'     => 'high',
364 364
 				'show_names'   => true,
@@ -366,27 +366,27 @@  discard block
 block discarded – undo
366 366
 		);
367 367
 		$cmb->add_field(
368 368
 			array(
369
-				'name'       => __( 'Prep Time', 'lsx-health-plan' ),
369
+				'name'       => __('Prep Time', 'lsx-health-plan'),
370 370
 				'id'         => $this->slug . '_prep_time',
371
-				'desc'       => __( 'Add the preparation time for the entire meal i.e: 25 mins', 'lsx-health-plan' ),
371
+				'desc'       => __('Add the preparation time for the entire meal i.e: 25 mins', 'lsx-health-plan'),
372 372
 				'type'       => 'text',
373 373
 				'show_on_cb' => 'cmb2_hide_if_no_cats',
374 374
 			)
375 375
 		);
376 376
 		$cmb->add_field(
377 377
 			array(
378
-				'name'       => __( 'Cooking Time', 'lsx-health-plan' ),
378
+				'name'       => __('Cooking Time', 'lsx-health-plan'),
379 379
 				'id'         => $this->slug . '_cooking_time',
380
-				'desc'       => __( 'Add the cooking time i.e: 15 mins', 'lsx-health-plan' ),
380
+				'desc'       => __('Add the cooking time i.e: 15 mins', 'lsx-health-plan'),
381 381
 				'type'       => 'text',
382 382
 				'show_on_cb' => 'cmb2_hide_if_no_cats',
383 383
 			)
384 384
 		);
385 385
 		$cmb->add_field(
386 386
 			array(
387
-				'name'       => __( 'Serves', 'lsx-health-plan' ),
387
+				'name'       => __('Serves', 'lsx-health-plan'),
388 388
 				'id'         => $this->slug . '_serves',
389
-				'desc'       => __( 'Add the recommended serving size i.e: 6', 'lsx-health-plan' ),
389
+				'desc'       => __('Add the recommended serving size i.e: 6', 'lsx-health-plan'),
390 390
 				'type'       => 'text',
391 391
 				'show_on_cb' => 'cmb2_hide_if_no_cats',
392 392
 				'attributes' => array(
@@ -397,8 +397,8 @@  discard block
 block discarded – undo
397 397
 		);
398 398
 		$cmb->add_field(
399 399
 			array(
400
-				'name'       => __( 'Portion', 'lsx-health-plan' ),
401
-				'desc'       => __( 'Add the recommended portion size i.e: 200mg', 'lsx-health-plan' ),
400
+				'name'       => __('Portion', 'lsx-health-plan'),
401
+				'desc'       => __('Add the recommended portion size i.e: 200mg', 'lsx-health-plan'),
402 402
 				'id'         => $this->slug . '_portion',
403 403
 				'type'       => 'text',
404 404
 				'show_on_cb' => 'cmb2_hide_if_no_cats',
@@ -407,8 +407,8 @@  discard block
 block discarded – undo
407 407
 		$cmb = new_cmb2_box(
408 408
 			array(
409 409
 				'id'           => $this->slug . '_nutritional_metabox',
410
-				'title'        => __( 'Nutritional Info', 'lsx-health-plan' ),
411
-				'object_types' => array( $this->slug ), // Post type
410
+				'title'        => __('Nutritional Info', 'lsx-health-plan'),
411
+				'object_types' => array($this->slug), // Post type
412 412
 				'context'      => 'normal',
413 413
 				'priority'     => 'high',
414 414
 				'show_names'   => true,
@@ -416,45 +416,45 @@  discard block
 block discarded – undo
416 416
 		);
417 417
 		$cmb->add_field(
418 418
 			array(
419
-				'name'       => __( 'Energy', 'lsx-health-plan' ),
419
+				'name'       => __('Energy', 'lsx-health-plan'),
420 420
 				'id'         => $this->slug . '_energy',
421
-				'desc'       => __( 'Add the energy amount for the entire meal i.e: 700 kj', 'lsx-health-plan' ),
421
+				'desc'       => __('Add the energy amount for the entire meal i.e: 700 kj', 'lsx-health-plan'),
422 422
 				'type'       => 'text',
423 423
 				'show_on_cb' => 'cmb2_hide_if_no_cats',
424 424
 			)
425 425
 		);
426 426
 		$cmb->add_field(
427 427
 			array(
428
-				'name'       => __( 'Protein', 'lsx-health-plan' ),
428
+				'name'       => __('Protein', 'lsx-health-plan'),
429 429
 				'id'         => $this->slug . '_protein',
430
-				'desc'       => __( 'Add the protein amount for the entire meal i.e: 50 g', 'lsx-health-plan' ),
430
+				'desc'       => __('Add the protein amount for the entire meal i.e: 50 g', 'lsx-health-plan'),
431 431
 				'type'       => 'text',
432 432
 				'show_on_cb' => 'cmb2_hide_if_no_cats',
433 433
 			)
434 434
 		);
435 435
 		$cmb->add_field(
436 436
 			array(
437
-				'name'       => __( 'Carbohydrates', 'lsx-health-plan' ),
437
+				'name'       => __('Carbohydrates', 'lsx-health-plan'),
438 438
 				'id'         => $this->slug . '_carbohydrates',
439
-				'desc'       => __( 'Add the carbohydrates amount for the entire meal i.e: 5 g', 'lsx-health-plan' ),
439
+				'desc'       => __('Add the carbohydrates amount for the entire meal i.e: 5 g', 'lsx-health-plan'),
440 440
 				'type'       => 'text',
441 441
 				'show_on_cb' => 'cmb2_hide_if_no_cats',
442 442
 			)
443 443
 		);
444 444
 		$cmb->add_field(
445 445
 			array(
446
-				'name'       => __( 'Fibre', 'lsx-health-plan' ),
446
+				'name'       => __('Fibre', 'lsx-health-plan'),
447 447
 				'id'         => $this->slug . '_fibre',
448
-				'desc'       => __( 'Add the fibre amount for the entire meal i.e: 5 g', 'lsx-health-plan' ),
448
+				'desc'       => __('Add the fibre amount for the entire meal i.e: 5 g', 'lsx-health-plan'),
449 449
 				'type'       => 'text',
450 450
 				'show_on_cb' => 'cmb2_hide_if_no_cats',
451 451
 			)
452 452
 		);
453 453
 		$cmb->add_field(
454 454
 			array(
455
-				'name'       => __( 'Fat', 'lsx-health-plan' ),
455
+				'name'       => __('Fat', 'lsx-health-plan'),
456 456
 				'id'         => $this->slug . '_fat',
457
-				'desc'       => __( 'Add the fat amount for the entire meal i.e: 20 g', 'lsx-health-plan' ),
457
+				'desc'       => __('Add the fat amount for the entire meal i.e: 20 g', 'lsx-health-plan'),
458 458
 				'type'       => 'text',
459 459
 				'show_on_cb' => 'cmb2_hide_if_no_cats',
460 460
 			)
Please login to merge, or discard this patch.
Indentation   +410 added lines, -410 removed lines patch added patch discarded remove patch
@@ -8,245 +8,245 @@  discard block
 block discarded – undo
8 8
  */
9 9
 class Recipe {
10 10
 
11
-	/**
12
-	 * Holds class instance
13
-	 *
14
-	 * @since 1.0.0
15
-	 *
16
-	 * @var      object \lsx_health_plan\classes\Recipe()
17
-	 */
18
-	protected static $instance = null;
11
+     /**
12
+      * Holds class instance
13
+      *
14
+      * @since 1.0.0
15
+      *
16
+      * @var      object \lsx_health_plan\classes\Recipe()
17
+      */
18
+     protected static $instance = null;
19 19
 
20
-	/**
21
-	 * Holds post_type slug used as an index
22
-	 *
23
-	 * @since 1.0.0
24
-	 *
25
-	 * @var      string
26
-	 */
27
-	public $slug = 'recipe';
20
+     /**
21
+      * Holds post_type slug used as an index
22
+      *
23
+      * @since 1.0.0
24
+      *
25
+      * @var      string
26
+      */
27
+     public $slug = 'recipe';
28 28
 
29
-	/**
30
-	 * Holds post_type labels
31
-	 *
32
-	 * @since 1.0.0
33
-	 *
34
-	 * @var      string
35
-	 */
36
-	public $labels = array();
29
+     /**
30
+      * Holds post_type labels
31
+      *
32
+      * @since 1.0.0
33
+      *
34
+      * @var      string
35
+      */
36
+     public $labels = array();
37 37
 
38
-	/**
39
-	 * Constructor
40
-	 */
41
-	public function __construct() {
42
-		add_action( 'init', array( $this, 'register_post_type' ) );
43
-		add_action( 'init', array( $this, 'taxonomy_setup' ) );
44
-		add_action( 'admin_menu', array( $this, 'register_menus' ) );
38
+     /**
39
+      * Constructor
40
+      */
41
+     public function __construct() {
42
+          add_action( 'init', array( $this, 'register_post_type' ) );
43
+          add_action( 'init', array( $this, 'taxonomy_setup' ) );
44
+          add_action( 'admin_menu', array( $this, 'register_menus' ) );
45 45
 
46
-		// Frontend Actions and Filters.
47
-		add_action( 'wp_head', array( $this, 'remove_archive_original_header' ), 99 );
48
-		add_action( 'lsx_content_wrap_before', array( $this, 'hp_lsx_archive_header' ) );
46
+          // Frontend Actions and Filters.
47
+          add_action( 'wp_head', array( $this, 'remove_archive_original_header' ), 99 );
48
+          add_action( 'lsx_content_wrap_before', array( $this, 'hp_lsx_archive_header' ) );
49 49
 
50
-		add_filter( 'lsx_health_plan_archive_template', array( $this, 'enable_post_type' ), 10, 1 );
51
-		add_filter( 'lsx_health_plan_single_template', array( $this, 'enable_post_type' ), 10, 1 );
52
-		add_filter( 'lsx_health_plan_connections', array( $this, 'enable_connections' ), 10, 1 );
53
-		add_filter( 'get_the_archive_title', array( $this, 'get_the_archive_title' ), 100 );
54
-		add_filter( 'lsx_display_global_header_description', array( $this, 'disable_global_header_description' ), 100 );
55
-		add_filter( 'woocommerce_get_breadcrumb', array( $this, 'recipes_breadcrumb_filter' ), 30, 1 );
50
+          add_filter( 'lsx_health_plan_archive_template', array( $this, 'enable_post_type' ), 10, 1 );
51
+          add_filter( 'lsx_health_plan_single_template', array( $this, 'enable_post_type' ), 10, 1 );
52
+          add_filter( 'lsx_health_plan_connections', array( $this, 'enable_connections' ), 10, 1 );
53
+          add_filter( 'get_the_archive_title', array( $this, 'get_the_archive_title' ), 100 );
54
+          add_filter( 'lsx_display_global_header_description', array( $this, 'disable_global_header_description' ), 100 );
55
+          add_filter( 'woocommerce_get_breadcrumb', array( $this, 'recipes_breadcrumb_filter' ), 30, 1 );
56 56
 
57
-		// Backend Actions and Filters.
58
-		add_action( 'cmb2_admin_init', array( $this, 'featured_metabox' ) );
59
-		add_action( 'cmb2_admin_init', array( $this, 'details_metaboxes' ) );
60
-	}
57
+          // Backend Actions and Filters.
58
+          add_action( 'cmb2_admin_init', array( $this, 'featured_metabox' ) );
59
+          add_action( 'cmb2_admin_init', array( $this, 'details_metaboxes' ) );
60
+     }
61 61
 
62
-	/**
63
-	 * Return an instance of this class.
64
-	 *
65
-	 * @since 1.0.0
66
-	 *
67
-	 * @return    object \lsx_health_plan\classes\Recipe()    A single instance of this class.
68
-	 */
69
-	public static function get_instance() {
62
+     /**
63
+      * Return an instance of this class.
64
+      *
65
+      * @since 1.0.0
66
+      *
67
+      * @return    object \lsx_health_plan\classes\Recipe()    A single instance of this class.
68
+      */
69
+     public static function get_instance() {
70 70
 
71
-		// If the single instance hasn't been set, set it now.
72
-		if ( null === self::$instance ) {
73
-			self::$instance = new self();
74
-		}
71
+          // If the single instance hasn't been set, set it now.
72
+          if ( null === self::$instance ) {
73
+               self::$instance = new self();
74
+          }
75 75
 
76
-		return self::$instance;
76
+          return self::$instance;
77 77
 
78
-	}
78
+     }
79 79
 
80
-	/**
81
-	 * Register the post type.
82
-	 */
83
-	public function register_post_type() {
84
-		$this->labels = array(
85
-			'name'               => esc_html__( 'Recipes', 'lsx-health-plan' ),
86
-			'singular_name'      => esc_html__( 'Recipe', 'lsx-health-plan' ),
87
-			'add_new'            => esc_html_x( 'Add New', 'post type general name', 'lsx-health-plan' ),
88
-			'add_new_item'       => esc_html__( 'Add New', 'lsx-health-plan' ),
89
-			'edit_item'          => esc_html__( 'Edit', 'lsx-health-plan' ),
90
-			'new_item'           => esc_html__( 'New', 'lsx-health-plan' ),
91
-			'all_items'          => esc_html__( 'All Recipes', 'lsx-health-plan' ),
92
-			'view_item'          => esc_html__( 'View', 'lsx-health-plan' ),
93
-			'search_items'       => esc_html__( 'Search', 'lsx-health-plan' ),
94
-			'not_found'          => esc_html__( 'None found', 'lsx-health-plan' ),
95
-			'not_found_in_trash' => esc_html__( 'None found in Trash', 'lsx-health-plan' ),
96
-			'parent_item_colon'  => '',
97
-			'menu_name'          => esc_html__( 'Recipes', 'lsx-health-plan' ),
98
-		);
99
-		$args         = array(
100
-			'labels'             => $this->labels,
101
-			'public'             => true,
102
-			'publicly_queryable' => true,
103
-			'show_ui'            => true,
104
-			'show_in_menu'       => false,
105
-			'show_in_rest'       => true,
106
-			'menu_icon'          => 'dashicons-editor-ul',
107
-			'query_var'          => true,
108
-			'rewrite'            => array(
109
-				'slug' => 'recipe',
110
-			),
111
-			'capability_type'    => 'post',
112
-			'has_archive'        => 'recipes',
113
-			'hierarchical'       => false,
114
-			'menu_position'      => null,
115
-			'supports'           => array(
116
-				'title',
117
-				'editor',
118
-				'thumbnail',
119
-				'custom-fields',
120
-			),
121
-		);
122
-		register_post_type( 'recipe', $args );
123
-	}
80
+     /**
81
+      * Register the post type.
82
+      */
83
+     public function register_post_type() {
84
+          $this->labels = array(
85
+               'name'               => esc_html__( 'Recipes', 'lsx-health-plan' ),
86
+               'singular_name'      => esc_html__( 'Recipe', 'lsx-health-plan' ),
87
+               'add_new'            => esc_html_x( 'Add New', 'post type general name', 'lsx-health-plan' ),
88
+               'add_new_item'       => esc_html__( 'Add New', 'lsx-health-plan' ),
89
+               'edit_item'          => esc_html__( 'Edit', 'lsx-health-plan' ),
90
+               'new_item'           => esc_html__( 'New', 'lsx-health-plan' ),
91
+               'all_items'          => esc_html__( 'All Recipes', 'lsx-health-plan' ),
92
+               'view_item'          => esc_html__( 'View', 'lsx-health-plan' ),
93
+               'search_items'       => esc_html__( 'Search', 'lsx-health-plan' ),
94
+               'not_found'          => esc_html__( 'None found', 'lsx-health-plan' ),
95
+               'not_found_in_trash' => esc_html__( 'None found in Trash', 'lsx-health-plan' ),
96
+               'parent_item_colon'  => '',
97
+               'menu_name'          => esc_html__( 'Recipes', 'lsx-health-plan' ),
98
+          );
99
+          $args         = array(
100
+               'labels'             => $this->labels,
101
+               'public'             => true,
102
+               'publicly_queryable' => true,
103
+               'show_ui'            => true,
104
+               'show_in_menu'       => false,
105
+               'show_in_rest'       => true,
106
+               'menu_icon'          => 'dashicons-editor-ul',
107
+               'query_var'          => true,
108
+               'rewrite'            => array(
109
+                    'slug' => 'recipe',
110
+               ),
111
+               'capability_type'    => 'post',
112
+               'has_archive'        => 'recipes',
113
+               'hierarchical'       => false,
114
+               'menu_position'      => null,
115
+               'supports'           => array(
116
+                    'title',
117
+                    'editor',
118
+                    'thumbnail',
119
+                    'custom-fields',
120
+               ),
121
+          );
122
+          register_post_type( 'recipe', $args );
123
+     }
124 124
 
125
-	/**
126
-	 * Registers the Recipes under the Meals Post type menu.
127
-	 *
128
-	 * @return void
129
-	 */
130
-	public function register_menus() {
131
-		add_submenu_page( 'edit.php?post_type=meal', esc_html__( 'Recipes', 'lsx-health-plan' ), esc_html__( 'Recipes', 'lsx-health-plan' ), 'edit_posts', 'edit.php?post_type=recipe' );
132
-		add_submenu_page( 'edit.php?post_type=meal', esc_html__( 'Recipe Types', 'lsx-health-plan' ), esc_html__( 'Recipe Types', 'lsx-health-plan' ), 'edit_posts', 'edit-tags.php?taxonomy=recipe-type&post_type=recipe' );
133
-		add_submenu_page( 'edit.php?post_type=meal', esc_html__( 'Cuisines', 'lsx-health-plan' ), esc_html__( 'Cuisines', 'lsx-health-plan' ), 'edit_posts', 'edit-tags.php?taxonomy=recipe-cuisine&post_type=recipe' );
134
-	}
125
+     /**
126
+      * Registers the Recipes under the Meals Post type menu.
127
+      *
128
+      * @return void
129
+      */
130
+     public function register_menus() {
131
+          add_submenu_page( 'edit.php?post_type=meal', esc_html__( 'Recipes', 'lsx-health-plan' ), esc_html__( 'Recipes', 'lsx-health-plan' ), 'edit_posts', 'edit.php?post_type=recipe' );
132
+          add_submenu_page( 'edit.php?post_type=meal', esc_html__( 'Recipe Types', 'lsx-health-plan' ), esc_html__( 'Recipe Types', 'lsx-health-plan' ), 'edit_posts', 'edit-tags.php?taxonomy=recipe-type&post_type=recipe' );
133
+          add_submenu_page( 'edit.php?post_type=meal', esc_html__( 'Cuisines', 'lsx-health-plan' ), esc_html__( 'Cuisines', 'lsx-health-plan' ), 'edit_posts', 'edit-tags.php?taxonomy=recipe-cuisine&post_type=recipe' );
134
+     }
135 135
 
136
-	/**
137
-	 * Register the Cuisine taxonomy.
138
-	 */
139
-	public function taxonomy_setup() {
140
-		$labels = array(
141
-			'name'              => esc_html_x( 'Cuisine', 'taxonomy general name', 'lsx-health-plan' ),
142
-			'singular_name'     => esc_html_x( 'Cuisines', 'taxonomy singular name', 'lsx-health-plan' ),
143
-			'search_items'      => esc_html__( 'Search', 'lsx-health-plan' ),
144
-			'all_items'         => esc_html__( 'All', 'lsx-health-plan' ),
145
-			'parent_item'       => esc_html__( 'Parent', 'lsx-health-plan' ),
146
-			'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ),
147
-			'edit_item'         => esc_html__( 'Edit', 'lsx-health-plan' ),
148
-			'update_item'       => esc_html__( 'Update', 'lsx-health-plan' ),
149
-			'add_new_item'      => esc_html__( 'Add New', 'lsx-health-plan' ),
150
-			'new_item_name'     => esc_html__( 'New Name', 'lsx-health-plan' ),
151
-			'menu_name'         => esc_html__( 'Cuisines', 'lsx-health-plan' ),
152
-		);
153
-		$args   = array(
154
-			'hierarchical'      => true,
155
-			'labels'            => $labels,
156
-			'show_ui'           => true,
157
-			'show_admin_column' => true,
158
-			'show_in_menu'      => 'edit.php?post_type=meal',
159
-			'query_var'         => true,
160
-			'rewrite'           => array(
161
-				'slug' => 'recipe-cuisine',
162
-			),
163
-		);
164
-		register_taxonomy( 'recipe-cuisine', array( $this->slug ), $args );
136
+     /**
137
+      * Register the Cuisine taxonomy.
138
+      */
139
+     public function taxonomy_setup() {
140
+          $labels = array(
141
+               'name'              => esc_html_x( 'Cuisine', 'taxonomy general name', 'lsx-health-plan' ),
142
+               'singular_name'     => esc_html_x( 'Cuisines', 'taxonomy singular name', 'lsx-health-plan' ),
143
+               'search_items'      => esc_html__( 'Search', 'lsx-health-plan' ),
144
+               'all_items'         => esc_html__( 'All', 'lsx-health-plan' ),
145
+               'parent_item'       => esc_html__( 'Parent', 'lsx-health-plan' ),
146
+               'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ),
147
+               'edit_item'         => esc_html__( 'Edit', 'lsx-health-plan' ),
148
+               'update_item'       => esc_html__( 'Update', 'lsx-health-plan' ),
149
+               'add_new_item'      => esc_html__( 'Add New', 'lsx-health-plan' ),
150
+               'new_item_name'     => esc_html__( 'New Name', 'lsx-health-plan' ),
151
+               'menu_name'         => esc_html__( 'Cuisines', 'lsx-health-plan' ),
152
+          );
153
+          $args   = array(
154
+               'hierarchical'      => true,
155
+               'labels'            => $labels,
156
+               'show_ui'           => true,
157
+               'show_admin_column' => true,
158
+               'show_in_menu'      => 'edit.php?post_type=meal',
159
+               'query_var'         => true,
160
+               'rewrite'           => array(
161
+                    'slug' => 'recipe-cuisine',
162
+               ),
163
+          );
164
+          register_taxonomy( 'recipe-cuisine', array( $this->slug ), $args );
165 165
 
166
-		$labels = array(
167
-			'name'              => esc_html_x( 'Recipe Type', 'taxonomy general name', 'lsx-health-plan' ),
168
-			'singular_name'     => esc_html_x( 'Recipe Types', 'taxonomy singular name', 'lsx-health-plan' ),
169
-			'search_items'      => esc_html__( 'Search', 'lsx-health-plan' ),
170
-			'all_items'         => esc_html__( 'All', 'lsx-health-plan' ),
171
-			'parent_item'       => esc_html__( 'Parent', 'lsx-health-plan' ),
172
-			'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ),
173
-			'edit_item'         => esc_html__( 'Edit', 'lsx-health-plan' ),
174
-			'update_item'       => esc_html__( 'Update', 'lsx-health-plan' ),
175
-			'add_new_item'      => esc_html__( 'Add New', 'lsx-health-plan' ),
176
-			'new_item_name'     => esc_html__( 'New Name', 'lsx-health-plan' ),
177
-			'menu_name'         => esc_html__( 'Types', 'lsx-health-plan' ),
178
-		);
179
-		$args   = array(
180
-			'hierarchical'      => true,
181
-			'labels'            => $labels,
182
-			'show_ui'           => true,
183
-			'show_in_menu'      => 'edit.php?post_type=meal',
184
-			'show_admin_column' => true,
185
-			'query_var'         => true,
186
-			'rewrite'           => array(
187
-				'slug' => 'recipe-type',
188
-			),
189
-		);
190
-		register_taxonomy( 'recipe-type', array( $this->slug ), $args );
191
-	}
166
+          $labels = array(
167
+               'name'              => esc_html_x( 'Recipe Type', 'taxonomy general name', 'lsx-health-plan' ),
168
+               'singular_name'     => esc_html_x( 'Recipe Types', 'taxonomy singular name', 'lsx-health-plan' ),
169
+               'search_items'      => esc_html__( 'Search', 'lsx-health-plan' ),
170
+               'all_items'         => esc_html__( 'All', 'lsx-health-plan' ),
171
+               'parent_item'       => esc_html__( 'Parent', 'lsx-health-plan' ),
172
+               'parent_item_colon' => esc_html__( 'Parent:', 'lsx-health-plan' ),
173
+               'edit_item'         => esc_html__( 'Edit', 'lsx-health-plan' ),
174
+               'update_item'       => esc_html__( 'Update', 'lsx-health-plan' ),
175
+               'add_new_item'      => esc_html__( 'Add New', 'lsx-health-plan' ),
176
+               'new_item_name'     => esc_html__( 'New Name', 'lsx-health-plan' ),
177
+               'menu_name'         => esc_html__( 'Types', 'lsx-health-plan' ),
178
+          );
179
+          $args   = array(
180
+               'hierarchical'      => true,
181
+               'labels'            => $labels,
182
+               'show_ui'           => true,
183
+               'show_in_menu'      => 'edit.php?post_type=meal',
184
+               'show_admin_column' => true,
185
+               'query_var'         => true,
186
+               'rewrite'           => array(
187
+                    'slug' => 'recipe-type',
188
+               ),
189
+          );
190
+          register_taxonomy( 'recipe-type', array( $this->slug ), $args );
191
+     }
192 192
 
193
-	/**
194
-	 * Adds the post type to the different arrays.
195
-	 *
196
-	 * @param array $post_types
197
-	 * @return array
198
-	 */
199
-	public function enable_post_type( $post_types = array() ) {
200
-		$post_types[] = $this->slug;
201
-		return $post_types;
202
-	}
193
+     /**
194
+      * Adds the post type to the different arrays.
195
+      *
196
+      * @param array $post_types
197
+      * @return array
198
+      */
199
+     public function enable_post_type( $post_types = array() ) {
200
+          $post_types[] = $this->slug;
201
+          return $post_types;
202
+     }
203 203
 
204
-	/**
205
-	 * Enables the Bi Directional relationships
206
-	 *
207
-	 * @param array $connections
208
-	 * @return void
209
-	 */
210
-	public function enable_connections( $connections = array() ) {
211
-		$connections['recipe']['connected_plans'] = 'connected_recipes';
212
-		$connections['plan']['connected_recipes'] = 'connected_plans';
213
-		return $connections;
214
-	}
204
+     /**
205
+      * Enables the Bi Directional relationships
206
+      *
207
+      * @param array $connections
208
+      * @return void
209
+      */
210
+     public function enable_connections( $connections = array() ) {
211
+          $connections['recipe']['connected_plans'] = 'connected_recipes';
212
+          $connections['plan']['connected_recipes'] = 'connected_plans';
213
+          return $connections;
214
+     }
215 215
 
216
-	/**
217
-	 * Remove the "Archives:" from the post type recipes.
218
-	 *
219
-	 * @param string $title the term title.
220
-	 * @return string
221
-	 */
222
-	public function get_the_archive_title( $title ) {
223
-		if ( is_post_type_archive( 'recipe' ) ) {
224
-			$title = __( 'Recipes', 'lsx-health-plan' );
225
-		}
226
-		if ( is_post_type_archive( 'exercise' ) ) {
227
-			$title = __( 'Exercises', 'lsx-health-plan' );
228
-		}
229
-		if ( is_tax( 'recipe-type' ) ) {
230
-			$queried_object = get_queried_object();
231
-			if ( isset( $queried_object->name ) ) {
232
-				$title = $queried_object->name . ' ' . __( 'Recipes', 'lsx-health-plan' );
233
-			}
234
-		}
235
-		return $title;
236
-	}
216
+     /**
217
+      * Remove the "Archives:" from the post type recipes.
218
+      *
219
+      * @param string $title the term title.
220
+      * @return string
221
+      */
222
+     public function get_the_archive_title( $title ) {
223
+          if ( is_post_type_archive( 'recipe' ) ) {
224
+               $title = __( 'Recipes', 'lsx-health-plan' );
225
+          }
226
+          if ( is_post_type_archive( 'exercise' ) ) {
227
+               $title = __( 'Exercises', 'lsx-health-plan' );
228
+          }
229
+          if ( is_tax( 'recipe-type' ) ) {
230
+               $queried_object = get_queried_object();
231
+               if ( isset( $queried_object->name ) ) {
232
+                    $title = $queried_object->name . ' ' . __( 'Recipes', 'lsx-health-plan' );
233
+               }
234
+          }
235
+          return $title;
236
+     }
237 237
 
238
-	public function remove_archive_original_header() {
239
-		if ( is_post_type_archive( 'recipe' ) || is_post_type_archive( 'exercise' ) ) {
240
-			remove_action( 'lsx_content_wrap_before', 'lsx_global_header' );
241
-		}
242
-		if ( ! is_post_type_archive() ) {
243
-			add_action( 'lsx_content_wrap_before', 'lsx_health_plan_recipe_archive_description', 11 );
244
-		}
245
-	}
238
+     public function remove_archive_original_header() {
239
+          if ( is_post_type_archive( 'recipe' ) || is_post_type_archive( 'exercise' ) ) {
240
+               remove_action( 'lsx_content_wrap_before', 'lsx_global_header' );
241
+          }
242
+          if ( ! is_post_type_archive() ) {
243
+               add_action( 'lsx_content_wrap_before', 'lsx_health_plan_recipe_archive_description', 11 );
244
+          }
245
+     }
246 246
 
247
-	public function hp_lsx_archive_header() {
248
-		if ( is_post_type_archive( 'recipe' ) || is_post_type_archive( 'exercise' ) ) {
249
-		?>
247
+     public function hp_lsx_archive_header() {
248
+          if ( is_post_type_archive( 'recipe' ) || is_post_type_archive( 'exercise' ) ) {
249
+          ?>
250 250
 			<div class="archive-header-wrapper banner-archive">
251 251
 				<?php lsx_global_header_inner_bottom(); ?>
252 252
 				<header class="archive-header">
@@ -259,205 +259,205 @@  discard block
 block discarded – undo
259 259
 					</h1>
260 260
 
261 261
 					<?php
262
-					lsx_health_plan_recipe_archive_description();
263
-					?>
262
+                         lsx_health_plan_recipe_archive_description();
263
+                         ?>
264 264
 				</header>
265 265
 			</div>
266 266
 		<?php
267
-		}
268
-	}
267
+          }
268
+     }
269 269
 
270
-	/**
271
-	 * Disables the global header description
272
-	 *
273
-	 * @param boolean $disable
274
-	 * @return boolean
275
-	 */
276
-	public function disable_global_header_description( $disable ) {
277
-		if ( is_tax( 'recipe-type' ) ) {
278
-			$disable = true;
279
-		}
280
-		return $disable;
281
-	}
270
+     /**
271
+      * Disables the global header description
272
+      *
273
+      * @param boolean $disable
274
+      * @return boolean
275
+      */
276
+     public function disable_global_header_description( $disable ) {
277
+          if ( is_tax( 'recipe-type' ) ) {
278
+               $disable = true;
279
+          }
280
+          return $disable;
281
+     }
282 282
 
283
-	/**
284
-	 * Holds the array for the breadcrumbs.
285
-	 *
286
-	 * @var array $crumbs
287
-	 * @return array
288
-	 */
289
-	public function recipes_breadcrumb_filter( $crumbs ) {
290
-		$recipe  = \lsx_health_plan\functions\get_option( 'endpoint_recipe', 'recipe' );
291
-		$recipes = \lsx_health_plan\functions\get_option( 'endpoint_recipe_archive', 'recipes' );
292
-		$url     = get_post_type_archive_link( 'recipe' );
283
+     /**
284
+      * Holds the array for the breadcrumbs.
285
+      *
286
+      * @var array $crumbs
287
+      * @return array
288
+      */
289
+     public function recipes_breadcrumb_filter( $crumbs ) {
290
+          $recipe  = \lsx_health_plan\functions\get_option( 'endpoint_recipe', 'recipe' );
291
+          $recipes = \lsx_health_plan\functions\get_option( 'endpoint_recipe_archive', 'recipes' );
292
+          $url     = get_post_type_archive_link( 'recipe' );
293 293
 
294
-		if ( is_singular( 'recipe' ) ) {
295
-			$recipe_name     = get_the_title();
296
-			$term_obj_list   = get_the_terms( get_the_ID(), 'recipe-type' );
297
-			$recipe_type     = $term_obj_list[0]->name;
298
-			$recipe_type_url = get_term_link( $term_obj_list[0]->term_id );
294
+          if ( is_singular( 'recipe' ) ) {
295
+               $recipe_name     = get_the_title();
296
+               $term_obj_list   = get_the_terms( get_the_ID(), 'recipe-type' );
297
+               $recipe_type     = $term_obj_list[0]->name;
298
+               $recipe_type_url = get_term_link( $term_obj_list[0]->term_id );
299 299
 		
300
-			$crumbs[1] = array(
301
-				0 => $recipes,
302
-				1 => $url,
303
-			);
304
-			$crumbs[2] = array(
305
-				0 => $recipe_type,
306
-				1 => $recipe_type_url,
307
-			);
308
-			$crumbs[3] = array(
309
-				0 => $recipe_name,
310
-			);
311
-		}
312
-		if ( is_tax( 'recipe-type' ) || is_tax( 'recipe-cuisine' ) ) {
313
-			$term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); 
300
+               $crumbs[1] = array(
301
+                    0 => $recipes,
302
+                    1 => $url,
303
+               );
304
+               $crumbs[2] = array(
305
+                    0 => $recipe_type,
306
+                    1 => $recipe_type_url,
307
+               );
308
+               $crumbs[3] = array(
309
+                    0 => $recipe_name,
310
+               );
311
+          }
312
+          if ( is_tax( 'recipe-type' ) || is_tax( 'recipe-cuisine' ) ) {
313
+               $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); 
314 314
 
315
-			$single_term_title = str_replace( '-', ' ', $term->taxonomy ) . ': ' . $term->name;
315
+               $single_term_title = str_replace( '-', ' ', $term->taxonomy ) . ': ' . $term->name;
316 316
 
317
-			$crumbs[1] = array(
318
-				0 => $recipes,
319
-				1 => $url,
320
-			);
321
-			$crumbs[2] = array(
322
-				0 => $single_term_title,
323
-			);
324
-		}
325
-		return $crumbs;
326
-	}
317
+               $crumbs[1] = array(
318
+                    0 => $recipes,
319
+                    1 => $url,
320
+               );
321
+               $crumbs[2] = array(
322
+                    0 => $single_term_title,
323
+               );
324
+          }
325
+          return $crumbs;
326
+     }
327 327
 
328
-	/**
329
-	 * Define the metabox and field configurations.
330
-	 */
331
-	public function featured_metabox() {
332
-		$cmb = new_cmb2_box(
333
-			array(
334
-				'id'           => $this->slug . '_featured_metabox',
335
-				'title'        => __( 'Featured', 'lsx-health-plan' ),
336
-				'object_types' => array( $this->slug ),
337
-				'context'      => 'side',
338
-				'priority'     => 'high',
339
-				'show_names'   => true,
340
-			)
341
-		);
342
-		$cmb->add_field(
343
-			array(
344
-				'name'       => __( 'Featured', 'lsx-health-plan' ),
345
-				'desc'       => __( 'Enable the checkbox to feature this recipe, featured recipes display in any page that has the recipe shortcode: [lsx_health_plan_featured_recipes_block]', 'lsx-health-plan' ),
346
-				'id'         => $this->slug . '_featured',
347
-				'type'       => 'checkbox',
348
-				'show_on_cb' => 'cmb2_hide_if_no_cats',
349
-			)
350
-		);
351
-	}
328
+     /**
329
+      * Define the metabox and field configurations.
330
+      */
331
+     public function featured_metabox() {
332
+          $cmb = new_cmb2_box(
333
+               array(
334
+                    'id'           => $this->slug . '_featured_metabox',
335
+                    'title'        => __( 'Featured', 'lsx-health-plan' ),
336
+                    'object_types' => array( $this->slug ),
337
+                    'context'      => 'side',
338
+                    'priority'     => 'high',
339
+                    'show_names'   => true,
340
+               )
341
+          );
342
+          $cmb->add_field(
343
+               array(
344
+                    'name'       => __( 'Featured', 'lsx-health-plan' ),
345
+                    'desc'       => __( 'Enable the checkbox to feature this recipe, featured recipes display in any page that has the recipe shortcode: [lsx_health_plan_featured_recipes_block]', 'lsx-health-plan' ),
346
+                    'id'         => $this->slug . '_featured',
347
+                    'type'       => 'checkbox',
348
+                    'show_on_cb' => 'cmb2_hide_if_no_cats',
349
+               )
350
+          );
351
+     }
352 352
 
353
-	/**
354
-	 * Define the metabox and field configurations.
355
-	 */
356
-	public function details_metaboxes() {
357
-		$cmb = new_cmb2_box(
358
-			array(
359
-				'id'           => $this->slug . '_details_metabox',
360
-				'title'        => __( 'Cooking Info', 'lsx-health-plan' ),
361
-				'object_types' => array( $this->slug ), // Post type
362
-				'context'      => 'normal',
363
-				'priority'     => 'high',
364
-				'show_names'   => true,
365
-			)
366
-		);
367
-		$cmb->add_field(
368
-			array(
369
-				'name'       => __( 'Prep Time', 'lsx-health-plan' ),
370
-				'id'         => $this->slug . '_prep_time',
371
-				'desc'       => __( 'Add the preparation time for the entire meal i.e: 25 mins', 'lsx-health-plan' ),
372
-				'type'       => 'text',
373
-				'show_on_cb' => 'cmb2_hide_if_no_cats',
374
-			)
375
-		);
376
-		$cmb->add_field(
377
-			array(
378
-				'name'       => __( 'Cooking Time', 'lsx-health-plan' ),
379
-				'id'         => $this->slug . '_cooking_time',
380
-				'desc'       => __( 'Add the cooking time i.e: 15 mins', 'lsx-health-plan' ),
381
-				'type'       => 'text',
382
-				'show_on_cb' => 'cmb2_hide_if_no_cats',
383
-			)
384
-		);
385
-		$cmb->add_field(
386
-			array(
387
-				'name'       => __( 'Serves', 'lsx-health-plan' ),
388
-				'id'         => $this->slug . '_serves',
389
-				'desc'       => __( 'Add the recommended serving size i.e: 6', 'lsx-health-plan' ),
390
-				'type'       => 'text',
391
-				'show_on_cb' => 'cmb2_hide_if_no_cats',
392
-				'attributes' => array(
393
-					'type'    => 'number',
394
-					'pattern' => '\d*',
395
-				),
396
-			)
397
-		);
398
-		$cmb->add_field(
399
-			array(
400
-				'name'       => __( 'Portion', 'lsx-health-plan' ),
401
-				'desc'       => __( 'Add the recommended portion size i.e: 200mg', 'lsx-health-plan' ),
402
-				'id'         => $this->slug . '_portion',
403
-				'type'       => 'text',
404
-				'show_on_cb' => 'cmb2_hide_if_no_cats',
405
-			)
406
-		);
407
-		$cmb = new_cmb2_box(
408
-			array(
409
-				'id'           => $this->slug . '_nutritional_metabox',
410
-				'title'        => __( 'Nutritional Info', 'lsx-health-plan' ),
411
-				'object_types' => array( $this->slug ), // Post type
412
-				'context'      => 'normal',
413
-				'priority'     => 'high',
414
-				'show_names'   => true,
415
-			)
416
-		);
417
-		$cmb->add_field(
418
-			array(
419
-				'name'       => __( 'Energy', 'lsx-health-plan' ),
420
-				'id'         => $this->slug . '_energy',
421
-				'desc'       => __( 'Add the energy amount for the entire meal i.e: 700 kj', 'lsx-health-plan' ),
422
-				'type'       => 'text',
423
-				'show_on_cb' => 'cmb2_hide_if_no_cats',
424
-			)
425
-		);
426
-		$cmb->add_field(
427
-			array(
428
-				'name'       => __( 'Protein', 'lsx-health-plan' ),
429
-				'id'         => $this->slug . '_protein',
430
-				'desc'       => __( 'Add the protein amount for the entire meal i.e: 50 g', 'lsx-health-plan' ),
431
-				'type'       => 'text',
432
-				'show_on_cb' => 'cmb2_hide_if_no_cats',
433
-			)
434
-		);
435
-		$cmb->add_field(
436
-			array(
437
-				'name'       => __( 'Carbohydrates', 'lsx-health-plan' ),
438
-				'id'         => $this->slug . '_carbohydrates',
439
-				'desc'       => __( 'Add the carbohydrates amount for the entire meal i.e: 5 g', 'lsx-health-plan' ),
440
-				'type'       => 'text',
441
-				'show_on_cb' => 'cmb2_hide_if_no_cats',
442
-			)
443
-		);
444
-		$cmb->add_field(
445
-			array(
446
-				'name'       => __( 'Fibre', 'lsx-health-plan' ),
447
-				'id'         => $this->slug . '_fibre',
448
-				'desc'       => __( 'Add the fibre amount for the entire meal i.e: 5 g', 'lsx-health-plan' ),
449
-				'type'       => 'text',
450
-				'show_on_cb' => 'cmb2_hide_if_no_cats',
451
-			)
452
-		);
453
-		$cmb->add_field(
454
-			array(
455
-				'name'       => __( 'Fat', 'lsx-health-plan' ),
456
-				'id'         => $this->slug . '_fat',
457
-				'desc'       => __( 'Add the fat amount for the entire meal i.e: 20 g', 'lsx-health-plan' ),
458
-				'type'       => 'text',
459
-				'show_on_cb' => 'cmb2_hide_if_no_cats',
460
-			)
461
-		);
462
-	}
353
+     /**
354
+      * Define the metabox and field configurations.
355
+      */
356
+     public function details_metaboxes() {
357
+          $cmb = new_cmb2_box(
358
+               array(
359
+                    'id'           => $this->slug . '_details_metabox',
360
+                    'title'        => __( 'Cooking Info', 'lsx-health-plan' ),
361
+                    'object_types' => array( $this->slug ), // Post type
362
+                    'context'      => 'normal',
363
+                    'priority'     => 'high',
364
+                    'show_names'   => true,
365
+               )
366
+          );
367
+          $cmb->add_field(
368
+               array(
369
+                    'name'       => __( 'Prep Time', 'lsx-health-plan' ),
370
+                    'id'         => $this->slug . '_prep_time',
371
+                    'desc'       => __( 'Add the preparation time for the entire meal i.e: 25 mins', 'lsx-health-plan' ),
372
+                    'type'       => 'text',
373
+                    'show_on_cb' => 'cmb2_hide_if_no_cats',
374
+               )
375
+          );
376
+          $cmb->add_field(
377
+               array(
378
+                    'name'       => __( 'Cooking Time', 'lsx-health-plan' ),
379
+                    'id'         => $this->slug . '_cooking_time',
380
+                    'desc'       => __( 'Add the cooking time i.e: 15 mins', 'lsx-health-plan' ),
381
+                    'type'       => 'text',
382
+                    'show_on_cb' => 'cmb2_hide_if_no_cats',
383
+               )
384
+          );
385
+          $cmb->add_field(
386
+               array(
387
+                    'name'       => __( 'Serves', 'lsx-health-plan' ),
388
+                    'id'         => $this->slug . '_serves',
389
+                    'desc'       => __( 'Add the recommended serving size i.e: 6', 'lsx-health-plan' ),
390
+                    'type'       => 'text',
391
+                    'show_on_cb' => 'cmb2_hide_if_no_cats',
392
+                    'attributes' => array(
393
+                         'type'    => 'number',
394
+                         'pattern' => '\d*',
395
+                    ),
396
+               )
397
+          );
398
+          $cmb->add_field(
399
+               array(
400
+                    'name'       => __( 'Portion', 'lsx-health-plan' ),
401
+                    'desc'       => __( 'Add the recommended portion size i.e: 200mg', 'lsx-health-plan' ),
402
+                    'id'         => $this->slug . '_portion',
403
+                    'type'       => 'text',
404
+                    'show_on_cb' => 'cmb2_hide_if_no_cats',
405
+               )
406
+          );
407
+          $cmb = new_cmb2_box(
408
+               array(
409
+                    'id'           => $this->slug . '_nutritional_metabox',
410
+                    'title'        => __( 'Nutritional Info', 'lsx-health-plan' ),
411
+                    'object_types' => array( $this->slug ), // Post type
412
+                    'context'      => 'normal',
413
+                    'priority'     => 'high',
414
+                    'show_names'   => true,
415
+               )
416
+          );
417
+          $cmb->add_field(
418
+               array(
419
+                    'name'       => __( 'Energy', 'lsx-health-plan' ),
420
+                    'id'         => $this->slug . '_energy',
421
+                    'desc'       => __( 'Add the energy amount for the entire meal i.e: 700 kj', 'lsx-health-plan' ),
422
+                    'type'       => 'text',
423
+                    'show_on_cb' => 'cmb2_hide_if_no_cats',
424
+               )
425
+          );
426
+          $cmb->add_field(
427
+               array(
428
+                    'name'       => __( 'Protein', 'lsx-health-plan' ),
429
+                    'id'         => $this->slug . '_protein',
430
+                    'desc'       => __( 'Add the protein amount for the entire meal i.e: 50 g', 'lsx-health-plan' ),
431
+                    'type'       => 'text',
432
+                    'show_on_cb' => 'cmb2_hide_if_no_cats',
433
+               )
434
+          );
435
+          $cmb->add_field(
436
+               array(
437
+                    'name'       => __( 'Carbohydrates', 'lsx-health-plan' ),
438
+                    'id'         => $this->slug . '_carbohydrates',
439
+                    'desc'       => __( 'Add the carbohydrates amount for the entire meal i.e: 5 g', 'lsx-health-plan' ),
440
+                    'type'       => 'text',
441
+                    'show_on_cb' => 'cmb2_hide_if_no_cats',
442
+               )
443
+          );
444
+          $cmb->add_field(
445
+               array(
446
+                    'name'       => __( 'Fibre', 'lsx-health-plan' ),
447
+                    'id'         => $this->slug . '_fibre',
448
+                    'desc'       => __( 'Add the fibre amount for the entire meal i.e: 5 g', 'lsx-health-plan' ),
449
+                    'type'       => 'text',
450
+                    'show_on_cb' => 'cmb2_hide_if_no_cats',
451
+               )
452
+          );
453
+          $cmb->add_field(
454
+               array(
455
+                    'name'       => __( 'Fat', 'lsx-health-plan' ),
456
+                    'id'         => $this->slug . '_fat',
457
+                    'desc'       => __( 'Add the fat amount for the entire meal i.e: 20 g', 'lsx-health-plan' ),
458
+                    'type'       => 'text',
459
+                    'show_on_cb' => 'cmb2_hide_if_no_cats',
460
+               )
461
+          );
462
+     }
463 463
 }
Please login to merge, or discard this patch.
templates/tab-content-workout.php 2 patches
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -26,24 +26,24 @@  discard block
 block discarded – undo
26 26
 
27 27
 	<div class="entry-content">
28 28
 		<?php
29
-			wp_link_pages(
30
-				array(
31
-					'before'      => '<div class="lsx-postnav-wrapper"><div class="lsx-postnav">',
32
-					'after'       => '</div></div>',
33
-					'link_before' => '<span>',
34
-					'link_after'  => '</span>',
35
-				)
36
-			);
37
-		?>
29
+               wp_link_pages(
30
+                    array(
31
+                         'before'      => '<div class="lsx-postnav-wrapper"><div class="lsx-postnav">',
32
+                         'after'       => '</div></div>',
33
+                         'link_before' => '<span>',
34
+                         'link_after'  => '</span>',
35
+                    )
36
+               );
37
+          ?>
38 38
 		<div class="single-plan-inner workout-content">
39 39
 			<?php
40
-			if ( is_singular( 'workout' ) ) { ?>
40
+               if ( is_singular( 'workout' ) ) { ?>
41 41
 				<div class="single-plan-section-title workout title-lined">
42 42
 					<?php lsx_get_svg_icon( 'work.svg' ); ?>
43 43
 					<h2><?php the_title(); ?></h2>
44 44
 					<?php if ( class_exists( 'LSX_Sharing' ) ) {
45
-						lsx_content_sharing();
46
-					} ?>
45
+                              lsx_content_sharing();
46
+                         } ?>
47 47
 				</div>
48 48
 			<?php } else { ?>
49 49
 				<div class="single-plan-section-title workout title-lined">
@@ -52,8 +52,8 @@  discard block
 block discarded – undo
52 52
 				</div>
53 53
 			<?php } ?>
54 54
 			<?php
55
-			if ( lsx_health_plan_has_warmup() && ( ! is_singular( 'workout' ) ) ) {
56
-				?>
55
+               if ( lsx_health_plan_has_warmup() && ( ! is_singular( 'workout' ) ) ) {
56
+                    ?>
57 57
 				<div class="workout-instructions">
58 58
 					<div class="row">
59 59
 						<div class="col-md-12">
@@ -65,8 +65,8 @@  discard block
 block discarded – undo
65 65
 					</div>
66 66
 				</div>
67 67
 				<?php
68
-			}
69
-			?>
68
+               }
69
+               ?>
70 70
 
71 71
 			<?php lsx_health_plan_workout_sets(); ?>
72 72
 		</div>
@@ -82,5 +82,5 @@  discard block
 block discarded – undo
82 82
 <?php } ?>
83 83
 <?php
84 84
 if ( ! empty( $connected_articles ) ) {
85
-	lsx_hp_single_related( $connected_articles, __( 'Related articles', 'lsx-health-plan' ) );
85
+     lsx_hp_single_related( $connected_articles, __( 'Related articles', 'lsx-health-plan' ) );
86 86
 }
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -8,10 +8,10 @@  discard block
 block discarded – undo
8 8
 global $shortcode_args;
9 9
 
10 10
 // Getting translated endpoint.
11
-$archive_workout = \lsx_health_plan\functions\get_option( 'endpoint_workout_archive', 'workout' );
12
-$workout         = \lsx_health_plan\functions\get_option( 'endpoint_workout', 'workout' );
11
+$archive_workout = \lsx_health_plan\functions\get_option('endpoint_workout_archive', 'workout');
12
+$workout         = \lsx_health_plan\functions\get_option('endpoint_workout', 'workout');
13 13
 
14
-$connected_articles = get_post_meta( get_the_ID(), ( $workout . '_connected_articles' ), true );
14
+$connected_articles = get_post_meta(get_the_ID(), ($workout . '_connected_articles'), true);
15 15
 
16 16
 ?>
17 17
 
@@ -37,29 +37,29 @@  discard block
 block discarded – undo
37 37
 		?>
38 38
 		<div class="single-plan-inner workout-content">
39 39
 			<?php
40
-			if ( is_singular( 'workout' ) ) { ?>
40
+			if (is_singular('workout')) { ?>
41 41
 				<div class="single-plan-section-title workout title-lined">
42
-					<?php lsx_get_svg_icon( 'work.svg' ); ?>
42
+					<?php lsx_get_svg_icon('work.svg'); ?>
43 43
 					<h2><?php the_title(); ?></h2>
44
-					<?php if ( class_exists( 'LSX_Sharing' ) ) {
44
+					<?php if (class_exists('LSX_Sharing')) {
45 45
 						lsx_content_sharing();
46 46
 					} ?>
47 47
 				</div>
48 48
 			<?php } else { ?>
49 49
 				<div class="single-plan-section-title workout title-lined">
50
-					<?php lsx_get_svg_icon( 'work.svg' ); ?>
51
-					<h2><?php esc_html_e( 'My Workout', 'lsx-health-plan' ); ?></h2>
50
+					<?php lsx_get_svg_icon('work.svg'); ?>
51
+					<h2><?php esc_html_e('My Workout', 'lsx-health-plan'); ?></h2>
52 52
 				</div>
53 53
 			<?php } ?>
54 54
 			<?php
55
-			if ( lsx_health_plan_has_warmup() && ( ! is_singular( 'workout' ) ) ) {
55
+			if (lsx_health_plan_has_warmup() && ( ! is_singular('workout'))) {
56 56
 				?>
57 57
 				<div class="workout-instructions">
58 58
 					<div class="row">
59 59
 						<div class="col-md-12">
60 60
 							<div class="content-intro">
61
-								<h3><?php esc_html_e( "Don't forget your warm up!", 'lsx-health-plan' ); ?></h3>
62
-								<p><?php esc_html_e( 'Be sure to do the warm-up before every workout session.', 'lsx-health-plan' ); ?></p>
61
+								<h3><?php esc_html_e("Don't forget your warm up!", 'lsx-health-plan'); ?></h3>
62
+								<p><?php esc_html_e('Be sure to do the warm-up before every workout session.', 'lsx-health-plan'); ?></p>
63 63
 							</div>
64 64
 						</div>
65 65
 					</div>
@@ -75,12 +75,12 @@  discard block
 block discarded – undo
75 75
 	<?php lsx_entry_bottom(); ?>
76 76
 
77 77
 </article><!-- #post-## -->
78
-<?php if ( is_singular( $workout ) ) { ?>
78
+<?php if (is_singular($workout)) { ?>
79 79
 	<div  class="back-plan-btn">
80
-		<a class="btn" href="/<?php echo $archive_workout; ?>"><?php esc_html_e( 'Back to workouts', 'lsx-health-plan' ); ?></a>
80
+		<a class="btn" href="/<?php echo $archive_workout; ?>"><?php esc_html_e('Back to workouts', 'lsx-health-plan'); ?></a>
81 81
 	</div>
82 82
 <?php } ?>
83 83
 <?php
84
-if ( ! empty( $connected_articles ) ) {
85
-	lsx_hp_single_related( $connected_articles, __( 'Related articles', 'lsx-health-plan' ) );
84
+if ( ! empty($connected_articles)) {
85
+	lsx_hp_single_related($connected_articles, __('Related articles', 'lsx-health-plan'));
86 86
 }
Please login to merge, or discard this patch.
templates/tab-content-meal.php 2 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -26,13 +26,13 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -7,11 +7,11 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
templates/single-plan.php 2 patches
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -11,8 +11,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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 -->
Please login to merge, or discard this patch.
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -16,59 +16,59 @@  discard block
 block discarded – undo
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,16 +76,16 @@  discard block
 block discarded – undo
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
 											
@@ -93,20 +93,20 @@  discard block
 block discarded – undo
93 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]' ) );
96
+										if (lsx_health_plan_has_tips()) {
97
+											echo wp_kses_post(do_shortcode('[lsx_health_plan_featured_tips_block]'));
98 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' ) ) {
107
+											if (function_exists('wc_get_page_id')) {
108 108
 												?>
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>
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 111
 											}
112 112
 											?>
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 
129 129
 		<?php
130 130
 		// Show the buttons on the single plan tabs.
131
-		if ( ! empty( $has_sections ) && false !== $is_section ) {
131
+		if ( ! empty($has_sections) && false !== $is_section) {
132 132
 			?>
133 133
 			<div class="row status-plan-buttons">
134 134
 				<?php lsx_health_plan_day_button(); ?>
@@ -140,8 +140,8 @@  discard block
 block discarded – undo
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' ) );
143
+		if ( ! empty($connected_articles)) {
144
+			lsx_hp_single_related($connected_articles, __('Latest articles', 'lsx-health-plan'));
145 145
 		}
146 146
 		?>
147 147
 
Please login to merge, or discard this patch.
templates/content-archive-recipe.php 2 patches
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -13,10 +13,10 @@  discard block
 block discarded – undo
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
 block discarded – undo
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">
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -12,31 +12,31 @@  discard block
 block discarded – undo
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
 block discarded – undo
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>
Please login to merge, or discard this patch.