1 | <?php |
||||
2 | /** |
||||
3 | * LSX Tips Shortcode. |
||||
4 | * |
||||
5 | * @package lsx-health-plan |
||||
6 | */ |
||||
0 ignored issues
–
show
Coding Style
introduced
by
![]() |
|||||
7 | |||||
8 | |||||
9 | $this_post_type = get_post_type( get_the_ID() ); |
||||
0 ignored issues
–
show
It seems like
get_the_ID() can also be of type false ; however, parameter $post of get_post_type() does only seem to accept WP_Post|integer|null , 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 | |||||
11 | $connected_tips = get_post_meta( get_the_ID(), ( $this_post_type . '_connected_tips' ), 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
![]() |
|||||
12 | |||||
13 | ?> |
||||
14 | <div id="lsx-tips-shortcode" class="daily-plan-block"> |
||||
15 | <div class="lsx-tips-shortcode lsx-tips-slider slick-slider slick-dotted" > |
||||
16 | <?php |
||||
17 | if (is_array($connected_tips) || is_object($connected_tips)) { |
||||
0 ignored issues
–
show
|
|||||
18 | foreach ( $connected_tips as $tip ) { |
||||
0 ignored issues
–
show
|
|||||
19 | $tip_link = get_permalink( $tip ); |
||||
20 | $tip_name = get_the_title( $tip ); |
||||
21 | $tip_content = get_post_field( 'post_content', $tip ); |
||||
22 | $icon = LSX_HEALTH_PLAN_URL . 'assets/images/tips-icon.svg'; |
||||
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 8 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. ![]() |
|||||
23 | ?> |
||||
24 | <div class="content-box diet-tip-wrapper quick-tip"> |
||||
25 | <div class="row"> |
||||
26 | <div class="col-xs-2"> |
||||
27 | <img loading="lazy" src="<?php echo esc_url( $icon ); ?>" alt="tip"/> |
||||
28 | </div> |
||||
29 | <div class="col-xs-10"> |
||||
30 | <h3 class="tip-title"><?php echo esc_html( $tip_name ); ?></h3> |
||||
31 | <?php echo wp_kses_post( $tip_content ); ?> |
||||
32 | </div> |
||||
33 | </div> |
||||
34 | </div> |
||||
35 | <?php |
||||
36 | } |
||||
37 | } |
||||
38 | ?> |
||||
39 | </div> |
||||
40 | </div> |
||||
41 | <?php |
||||
42 |