Issues (4138)

templates/content-archive-workout.php (12 issues)

1
<?php
2
/**
3
 * Template used to display post content on widgets and archive pages.
4
 *
5
 * @package lsx-health-plan
6
 */
7
8
$featured = get_post_meta( get_the_ID(), 'workout_featured_workout', 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

8
$featured = get_post_meta( /** @scrutinizer ignore-type */ get_the_ID(), 'workout_featured_workout', true );
Loading history...
9
?>
10
11
<?php lsx_entry_before(); ?>
12
13
<div class="col-xs-12 col-sm-6 col-md-4">
14
	<article class="lsx-slot box-shadow">
15
		<?php lsx_entry_top(); ?>
16
17
		<?php lsx_hp_exercise_plan_meta(); ?>
18
19
		<div class="workout-feature-img">
20
			<?php if ( $featured ) { ?>
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
21
				<span class="featured-workout"><?php lsx_get_svg_icon( 'icon-featured.svg' ); ?></span>
22
			<?php } ?>
23
			<a href="<?php echo esc_url( get_permalink() ); ?>">
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

23
			<a href="<?php echo esc_url( /** @scrutinizer ignore-type */ get_permalink() ); ?>">
Loading history...
24
			<?php
25
			$featured_image = get_the_post_thumbnail();
26
			if ( ! empty( $featured_image ) && '' !== $featured_image ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
27
				the_post_thumbnail( 'lsx-thumbnail-square', array(
0 ignored issues
show
The opening parenthesis of a multi-line function call should be the last content on the line.
Loading history...
For multi-line function calls, each argument should be on a separate line.

For a function calls that spawns multiple lines, the coding style suggests to split arguments to separate lines like this:

someFunctionCall(
    $firstArgument,
    $secondArgument,
    $thirdArgument
);
Loading history...
28
					'class' => 'aligncenter',
29
				) );
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.
Loading history...
30
			} else {
31
				?>
32
				<img loading="lazy" src="<?php echo esc_attr( plugin_dir_url( __FILE__ ) . '../assets/images/placeholder.jpg' ); ?>">
33
				<?php
34
			}
35
			?>
36
			</a>
37
		</div>
38
		<div class="content-box workout-content-box white-bg">
39
			<a href="<?php echo esc_url( get_permalink() ); ?>">
40
				<?php the_title( '<h3 class="workout-title">', '</h3>' ); ?>
41
			</a>
42
			<?php
43
			if ( ! has_excerpt() ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
44
				$content = wp_trim_words( get_the_content(), 20 );
45
				$content = '<p>' . $content . '</p>';
46
			} else {
47
				$content = apply_filters( 'the_excerpt', get_the_excerpt() );
48
			}
0 ignored issues
show
No blank line found after control structure
Loading history...
49
			echo wp_kses_post( $content );
50
			?>
51
			<a href="<?php echo esc_url( get_permalink() ); ?>" class="btn border-btn"><?php esc_html_e( 'See workout', 'lsx-health-plan' ); ?></a>
52
		</div>
53
		<?php lsx_entry_bottom(); ?>
54
	</article>
55
</div>
56
57
<?php
58
lsx_entry_after();
59