Issues (4138)

templates/tab-content-recipes.php (2 issues)

1
<?php
2
/**
3
 * Template used to display post content on single pages.
4
 *
5
 * @package lsx-health-plan
6
 */
7
?>
8
9
<?php lsx_entry_before(); ?>
10
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
11
12
	<?php lsx_entry_top(); ?>
13
14
	<div class="entry-meta">
15
		<?php lsx_post_meta_single_bottom(); ?>
16
	</div><!-- .entry-meta -->
17
18
	<div class="entry-content">
19
		<?php
20
			//the_content();
21
22
			wp_link_pages( array(
23
				'before'      => '<div class="lsx-postnav-wrapper"><div class="lsx-postnav">',
24
				'after'       => '</div></div>',
25
				'link_before' => '<span>',
26
				'link_after'  => '</span>',
27
			) );
28
		?>
29
		<div class="single-plan-inner recipes-content">
30
			<div class="single-plan-section-title recipes-plan title-lined">
31
				<?php lsx_get_svg_icon( 'recipes.svg' ); ?>
32
				<h2><?php esc_html_e( 'Recipes', 'lsx-health-plan' ); ?> <span class="blue-title"><?php the_title(); ?></span></h2>
33
			</div>
34
			<div class="recipes">
35
			<div class="row eating-row">
36
			<?php
37
			$connected_recipes = get_post_meta( get_the_ID(), 'connected_recipes', 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 ignore-type  annotation

37
			$connected_recipes = get_post_meta( /** @scrutinizer ignore-type */ get_the_ID(), 'connected_recipes', true );
Loading history...
38
			if ( empty( $connected_recipes ) ) {
39
				$options = \lsx_health_plan\functions\get_option( 'all' );
40
				if ( isset( $options['connected_recipes'] ) && '' !== $options['connected_recipes'] && ! empty( $options['connected_recipes'] ) ) {
41
					$connected_recipes = $options['connected_recipes'];
42
					if ( ! array( $connected_recipes ) ) {
43
						$connected_recipes = array( $connected_recipes );
44
					}
45
				}
46
			}
47
			$args    = array(
48
				'orderby'   => 'date',
49
				'order'     => 'DESC',
50
				'post_type' => 'recipe',
51
				'post__in'  => $connected_recipes,
52
			);
53
			$recipes = new WP_Query( $args );
54
55
			if ( $recipes->have_posts() ) {
56
				while ( $recipes->have_posts() ) {
57
					$recipes->the_post();
58
					$post_id = get_the_id();
59
60
					?>
61
					<div class="col-md-4 recipe-column">
62
						<div class="content-box box-shadow">
63
							<h3 class="recipe-title title-lined"><?php the_title(); ?></h3>
64
							<?php lsx_health_plan_recipe_data(); ?>
65
							<a href="<?php echo esc_url( get_permalink() ); ?>" class="btn btn-full"><?php esc_html_e( 'View Recipe', 'lsx-health-plan' ); ?></a>
0 ignored issues
show
It seems like get_permalink() can also be of type false; however, parameter $url of esc_url() does only seem to accept string, 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 ignore-type  annotation

65
							<a href="<?php echo esc_url( /** @scrutinizer ignore-type */ get_permalink() ); ?>" class="btn btn-full"><?php esc_html_e( 'View Recipe', 'lsx-health-plan' ); ?></a>
Loading history...
66
						</div>
67
					</div>
68
				<?php
69
				}
70
			}
71
			?>
72
			<?php wp_reset_postdata(); ?>
73
			</div>
74
			</div>
75
		</div>
76
	</div><!-- .entry-content -->
77
78
	<?php lsx_entry_bottom(); ?>
79
80
</article><!-- #post-## -->
81
82
<?php
83