Issues (1066)

templates/archive-projects.php (2 issues)

1
<?php
2
/**
3
 * The template for displaying all single projects.
4
 *
5
 * @package lsx-projects
6
 */
7
8
get_header(); ?>
9
10
<?php lsx_content_wrap_before(); ?>
11
12
<div id="primary" class="content-area <?php echo esc_attr( lsx_main_class() ); ?>">
13
14
	<?php lsx_content_before(); ?>
15
16
	<main id="main" class="site-main">
17
18
		<?php lsx_content_top(); ?>
19
20
		<?php
21
		if ( ! function_exists( 'lsx_search' ) ) {
22
			$args = array(
23
				'taxonomy'   => 'project-group',
24
				'hide_empty' => false,
25
			);
26
27
			$groups = get_terms( $args );
28
			$group_selected = get_query_var( 'project-group' );
29
30
			if ( count( $groups ) > 0 ) {
31
			?>
32
33
			<ul class="nav nav-tabs lsx-projects-filter">
34
				<?php
35
					$group_selected_class = '';
36
37
					if ( empty( $group_selected ) ) {
38
						$group_selected_class = ' class="active"';
39
					}
40
				?>
41
42
				<li<?php echo wp_kses_post( $group_selected_class ); ?>><a href="<?php echo empty( $group_selected ) ? '#' : esc_url( get_post_type_archive_link( 'project' ) ); ?>" data-filter="*"><?php esc_html_e( 'All', 'lsx-projects' ); ?></a></li>
0 ignored issues
show
It seems like get_post_type_archive_link('project') 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

42
				<li<?php echo wp_kses_post( $group_selected_class ); ?>><a href="<?php echo empty( $group_selected ) ? '#' : esc_url( /** @scrutinizer ignore-type */ get_post_type_archive_link( 'project' ) ); ?>" data-filter="*"><?php esc_html_e( 'All', 'lsx-projects' ); ?></a></li>
Loading history...
43
44
				<?php foreach ( $groups as $group ) : ?>
45
					<?php
46
						$group_selected_class = '';
47
48
						if ( (string) $group_selected === (string) $group->slug ) {
49
							$group_selected_class = ' class="active"';
50
						}
51
					?>
52
53
					<li<?php echo wp_kses_post( $group_selected_class ); ?>><a href="<?php echo empty( $group_selected ) ? '#' : esc_url( get_term_link( $group ) ); ?>" data-filter=".filter-<?php echo esc_attr( $group->slug ); ?>"><?php echo esc_attr( $group->name ); ?></a></li>
0 ignored issues
show
get_term_link($group) of type WP_Error is incompatible with the type string expected by parameter $url of esc_url(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

53
					<li<?php echo wp_kses_post( $group_selected_class ); ?>><a href="<?php echo empty( $group_selected ) ? '#' : esc_url( /** @scrutinizer ignore-type */ get_term_link( $group ) ); ?>" data-filter=".filter-<?php echo esc_attr( $group->slug ); ?>"><?php echo esc_attr( $group->name ); ?></a></li>
Loading history...
54
				<?php endforeach; ?>
55
			</ul>
56
57
			<?php
58
			}
59
		}
60
		?>
61
62
		<?php if ( have_posts() ) : ?>
63
64
			<div class="lsx-projects-container">
65
				<div class="row row-flex lsx-projects-row">
66
67
					<?php
68
						$count = 0;
69
70
						while ( have_posts() ) {
71
							the_post();
72
							include LSX_PROJECTS_PATH . '/templates/content-archive-projects.php';
73
						}
74
					?>
75
76
				</div>
77
			</div>
78
79
			<?php lsx_paging_nav(); ?>
80
81
		<?php else : ?>
82
83
			<?php get_template_part( 'partials/content', 'none' ); ?>
84
85
		<?php endif; ?>
86
87
		<?php lsx_content_bottom(); ?>
88
89
	</main><!-- #main -->
90
91
	<?php lsx_content_after(); ?>
92
93
</div><!-- #primary -->
94
95
<?php lsx_content_wrap_after(); ?>
96
97
<?php get_sidebar(); ?>
98
99
<?php get_footer();
100