1 | <?php |
||||
2 | /** |
||||
3 | * LSX Videos Shortcode. |
||||
4 | * |
||||
5 | * @package lsx-health-plan |
||||
6 | */ |
||||
7 | |||||
8 | $args = array( |
||||
9 | 'orderby' => 'date', |
||||
10 | 'order' => 'DESC', |
||||
11 | 'post_type' => 'video', |
||||
12 | 'posts_per_page' => 3, |
||||
13 | 'meta_key' => 'video_featured_video', |
||||
0 ignored issues
–
show
introduced
by
![]() |
|||||
14 | 'meta_compare' => 'EXISTS', |
||||
15 | ); |
||||
16 | $videos = new WP_Query( $args ); |
||||
17 | ?> |
||||
18 | |||||
19 | <div id="lsx-videos-shortcode" class="daily-plan-block"> |
||||
20 | <h2 class="title-lined"><?php esc_html_e( 'Featured Workout', 'lsx-health-plan' ); ?></h2> |
||||
21 | <div class="lsx-videos-shortcode lsx-videos-slider slick-slider slick-dotted slick-has-arrows" data-slick="{'slidesToShow': 1, 'slidesToScroll': 1}" > |
||||
22 | <?php |
||||
23 | if ( $videos->have_posts() ) : |
||||
0 ignored issues
–
show
|
|||||
24 | while ( $videos->have_posts() ) : |
||||
0 ignored issues
–
show
|
|||||
25 | $videos->the_post(); |
||||
26 | |||||
27 | $featured = get_post_meta( get_the_ID(), 'video_featured_video', 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
![]() |
|||||
28 | $giphy = get_post_meta( get_the_ID(), 'video_giphy_source', true ); |
||||
29 | $youtube = esc_url( get_post_meta( get_the_ID(), 'video_youtube_source', 1 ) ); |
||||
30 | ?> |
||||
31 | <div class="lsx-videos-slot"> |
||||
32 | <div class="row"> |
||||
33 | <div class="col-md-4"> |
||||
34 | <h4 class="lsx-videos-title"><?php the_title(); ?></h4> |
||||
35 | <?php the_content(); ?> |
||||
36 | </div> |
||||
37 | <div class="col-md-8"> |
||||
38 | <?php |
||||
39 | if ( ! empty( $giphy ) ) { |
||||
0 ignored issues
–
show
|
|||||
40 | echo $giphy; // WPCS: XSS OK. |
||||
0 ignored issues
–
show
|
|||||
41 | } elseif ( ! empty( $youtube ) ) { |
||||
0 ignored issues
–
show
|
|||||
42 | echo wp_oembed_get( $youtube ); // WPCS: XSS OK. |
||||
0 ignored issues
–
show
Are you sure
wp_oembed_get($youtube) of type false|string can be used in echo ?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
43 | } |
||||
44 | ?> |
||||
45 | </div> |
||||
46 | </div> |
||||
47 | </div> |
||||
48 | <?php endwhile; ?> |
||||
0 ignored issues
–
show
|
|||||
49 | <?php endif; ?> |
||||
50 | <?php wp_reset_postdata(); ?> |
||||
51 | </div> |
||||
52 | </div> |
||||
53 |