1 | <?php |
||||
2 | /** |
||||
3 | * Template used to display post content on single pages. |
||||
4 | * |
||||
5 | * @package lsx-health-plan |
||||
6 | */ |
||||
0 ignored issues
–
show
Coding Style
introduced
by
![]() |
|||||
7 | global $group_name, $connected_workouts, $shortcode_args; |
||||
8 | |||||
9 | $warm_up = get_post_meta( get_the_ID(), 'plan_warmup', true ); |
||||
0 ignored issues
–
show
It seems like
get_the_ID() can also be of type false ; however, parameter $post_id of get_post_meta() does only seem to accept integer , maybe add an additional type check?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
10 | if ( false === $warm_up || '' === $warm_up ) { |
||||
0 ignored issues
–
show
|
|||||
11 | $options = \lsx_health_plan\functions\get_option( 'all' ); |
||||
12 | if ( isset( $options['plan_warmup'] ) && '' !== $options['plan_warmup'] && ! empty( $options['plan_warmup'] ) ) { |
||||
0 ignored issues
–
show
|
|||||
13 | $warm_up = $options['plan_warmup']; |
||||
14 | } |
||||
15 | } |
||||
16 | |||||
17 | ?> |
||||
18 | <div class="warmup-container"> |
||||
19 | <?php |
||||
20 | |||||
21 | if ( false !== $warm_up && '' !== $warm_up ) { |
||||
0 ignored issues
–
show
|
|||||
22 | if ( ! is_array( $warm_up ) ) { |
||||
0 ignored issues
–
show
|
|||||
23 | $warm_up = array( $warm_up ); |
||||
24 | } |
||||
25 | |||||
26 | $warmup_type = array( 'page', 'workout', 'exercise' ); |
||||
27 | $warmup_query = new WP_Query( |
||||
28 | array( |
||||
29 | 'post__in' => $warm_up, |
||||
30 | 'post_type' => $warmup_type, |
||||
31 | ) |
||||
32 | ); |
||||
33 | |||||
34 | if ( $warmup_query->have_posts() ) { |
||||
0 ignored issues
–
show
|
|||||
35 | while ( $warmup_query->have_posts() ) { |
||||
0 ignored issues
–
show
|
|||||
36 | $warmup_query->the_post(); |
||||
37 | lsx_entry_before(); |
||||
38 | if ( 'workout' === get_post_type() ) { |
||||
0 ignored issues
–
show
|
|||||
39 | $connected_workouts = array( get_the_ID() ); |
||||
40 | ?> |
||||
41 | <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> |
||||
42 | <?php lsx_entry_top(); ?> |
||||
43 | <div class="entry-content"> |
||||
44 | <div class="single-plan-inner warmup-content"> |
||||
45 | <div class="single-plan-section-title warmup-plan title-lined"> |
||||
46 | <?php lsx_get_svg_icon( 'warm.svg' ); ?> |
||||
47 | <h2><?php esc_html_e( 'Warm Up', 'lsx-health-plan' ); ?></h2> |
||||
48 | </div> |
||||
49 | </div> |
||||
50 | </div><!-- .entry-content --> |
||||
51 | <?php lsx_entry_bottom(); ?> |
||||
52 | </article><!-- #post-## --> |
||||
53 | <?php |
||||
54 | lsx_health_plan_warmup_sets( $connected_workouts ); |
||||
55 | } else { |
||||
56 | ?> |
||||
57 | <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> |
||||
58 | <?php lsx_entry_top(); ?> |
||||
59 | <div class="entry-content"> |
||||
60 | <div class="single-plan-inner warmup-content"> |
||||
61 | <div class="single-plan-section-title warmup-plan title-lined"> |
||||
62 | <?php lsx_get_svg_icon( 'warm.svg' ); ?> |
||||
63 | <h2><?php esc_html_e( 'Warm Up', 'lsx-health-plan' ); ?></h2> |
||||
64 | </div> |
||||
65 | <?php |
||||
66 | the_content(); |
||||
67 | wp_link_pages( array( |
||||
0 ignored issues
–
show
|
|||||
68 | 'before' => '<div class="lsx-postnav-wrapper"><div class="lsx-postnav">', |
||||
69 | 'after' => '</div></div>', |
||||
70 | 'link_before' => '<span>', |
||||
71 | 'link_after' => '</span>', |
||||
72 | ) ); |
||||
0 ignored issues
–
show
For multi-line function calls, the closing parenthesis should be on a new line.
If a function call spawns multiple lines, the coding standard suggests to move the closing parenthesis to a new line: someFunctionCall(
$firstArgument,
$secondArgument,
$thirdArgument
); // Closing parenthesis on a new line.
![]() |
|||||
73 | ?> |
||||
74 | </div> |
||||
75 | </div><!-- .entry-content --> |
||||
76 | <?php lsx_entry_bottom(); ?> |
||||
77 | </article><!-- #post-## --> |
||||
78 | <?php |
||||
79 | } |
||||
0 ignored issues
–
show
|
|||||
80 | |||||
0 ignored issues
–
show
|
|||||
81 | } |
||||
0 ignored issues
–
show
|
|||||
82 | wp_reset_postdata(); |
||||
83 | } |
||||
84 | } |
||||
85 | ?> |
||||
86 | </div> |
||||
87 | <?php |
||||
88 |