Issues (1223)

templates/content-single-team.php (12 issues)

1
<?php
2
/**
3
 * @package lsx-team
4
 */
5
?>
6
7
<?php
8
	global $lsx_team;
9
10
	$thumbnail = $lsx_team->get_thumbnail( get_the_ID(), 'lsx-team-single' );
11
12
	$job_title = get_post_meta( get_the_ID(), 'lsx_job_title', true );
13
14
	$links = array(
15
		'facebook'  => get_post_meta( get_the_ID(), 'lsx_facebook', true ),
16
		'twitter'   => get_post_meta( get_the_ID(), 'lsx_twitter', true ),
17
		'linkedin'  => get_post_meta( get_the_ID(), 'lsx_linkedin', true ),
18
		'github'    => get_post_meta( get_the_ID(), 'lsx_github', true ),
19
		'wordpress' => get_post_meta( get_the_ID(), 'lsx_wordpress', true ),
20
	);
21
22
	foreach ( $links as $service => $link ) {
23
		if ( empty( $link ) ) {
24
			unset( $links[ $service ] );
25
		}
26
	}
27
28
	$email = get_post_meta( get_the_ID(), 'lsx_email_contact', true );
29
	$phone = get_post_meta( get_the_ID(), 'lsx_tel', true );
30
	$skype = get_post_meta( get_the_ID(), 'lsx_skype', true );
31
32
	$phone_attr = $phone;
33
	$phone_attr = str_replace( ' ', '', $phone_attr );
34
	$phone_attr = str_replace( '+', '', $phone_attr );
35
	$phone_attr = str_replace( '(', '', $phone_attr );
36
	$phone_attr = str_replace( ')', '', $phone_attr );
37
	$phone_attr = str_replace( '.', '', $phone_attr );
38
39
	// Tabs
40
41
	$tabs = array();
42
43
	// Tab Posts
44
45
	$site_user = get_post_meta( get_the_ID(), 'lsx_site_user', true );
46
47
	if ( ! empty( $site_user ) ) {
48
		if ( is_user_member_of_blog( $site_user ) ) {
49
			$user_posts = count_user_posts( $site_user, 'post' );
50
51
			if ( $user_posts > 0 ) {
52
				$params = array(
53
					'post_type' => 'post',
54
					'author' => $site_user,
55
					'posts_per_page' => 9,
56
					'order' => 'DESC',
57
					'orderby' => 'date',
58
					'fields' => 'ids',
59
					'tax_query' => array(
60
						array(
61
							'taxonomy' => 'post_format',
62
							'field' => 'slug',
63
							'terms' => array(
64
								'post-format-aside',
65
								'post-format-audio',
66
								'post-format-chat',
67
								'post-format-gallery',
68
								'post-format-image',
69
								'post-format-link',
70
								'post-format-quote',
71
								'post-format-status',
72
								'post-format-video',
73
							),
74
							'operator' => 'NOT IN',
75
						),
76
					),
77
				);
78
79
				$posts_query = new \WP_Query( $params );
80
81
				if ( $posts_query->have_posts() ) {
82
					$tab_post['post_type'] = 'post';
83
					$tab_post['title'] = esc_html__( 'Posts', 'lsx-team' );
84
					$tab_post['posts'] = $posts_query->posts;
85
86
					if ( ! empty( $tab_post['posts'] ) ) {
87
						$post_ids = join( ',', $tab_post['posts'] );
88
						$tab_post['shortcode'] = '[lsx_posts columns="3" limit="9" include="' . $post_ids . '"]';
89
						$tabs[] = $tab_post;
90
					}
91
				}
92
			}
93
		}
94
	}
95
96
	// Tab Projects
97
98
	$tab_project['post_type'] = 'project';
99
	$tab_project['title'] = esc_html__( 'Projects', 'lsx-team' );
100
	$tab_project['posts'] = get_post_meta( get_the_ID(), 'project_to_team', true );
101
	if ( is_plugin_active( 'lsx-projects/lsx-projects.php' ) && ( ! empty( $tab_project['posts'] ) ) ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
102
		$post_ids = join( ',', $tab_project['posts'] );
103
		$tab_project['shortcode'] = '[lsx_projects columns="3" include="' . $post_ids . '"]';
104
		$tabs[] = $tab_project;
105
	}
106
107
	// Tab Services
108
109
	if ( is_plugin_active( 'lsx-services/lsx-services.php' ) ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
110
		$tab_service['post_type'] = 'service';
111
		$tab_service['title'] = esc_html__( 'Services', 'lsx-team' );
0 ignored issues
show
Equals sign not aligned with surrounding assignments; expected 5 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.

Loading history...
112
		$tab_service['posts'] = get_post_meta( get_the_ID(), 'service_to_team', true );
0 ignored issues
show
Equals sign not aligned with surrounding assignments; expected 5 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.

Loading history...
113
114
		if ( ! empty( $tab_service['posts'] ) ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
115
			$post_ids = join( ',', $tab_service['posts'] );
0 ignored issues
show
Equals sign not aligned with surrounding assignments; expected 17 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.

Loading history...
116
			$tab_service['shortcode'] = '[lsx_services columns="3" include="' . $post_ids . '"]';
117
			$tabs[] = $tab_service;
0 ignored issues
show
Equals sign not aligned with surrounding assignments; expected 19 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.

Loading history...
118
		}
119
	}
120
121
	// Tab Testimonials
122
123
	$tab_testimonial['post_type'] = 'testimonial';
124
	$tab_testimonial['title'] = esc_html__( 'Testimonials', 'lsx-team' );
125
	$tab_testimonial['posts'] = get_post_meta( get_the_ID(), 'testimonial_to_team', true );
126
127
	if ( is_plugin_active( 'lsx-testimonials/lsx-testimonials.php' ) && ( ! empty( $tab_testimonial['posts'] ) ) ) {
0 ignored issues
show
Expected 0 spaces after opening bracket; 1 found
Loading history...
Expected 0 spaces before closing bracket; 1 found
Loading history...
128
		if ( count( $tab_testimonial['posts'] ) <= 2 ) {
129
			$columns = count( $tab_testimonial['posts'] );
130
		} else {
131
			$columns = 2;
132
		}
133
134
		$post_ids = join( ',', $tab_testimonial['posts'] );
135
		$tab_testimonial['shortcode'] = '[lsx_testimonials columns="' . $columns . '" include="' . $post_ids . '" orderby="date" order="DESC" display="excerpt"]';
136
		$tabs[] = $tab_testimonial;
137
	}
138
?>
139
140
<?php lsx_entry_before(); ?>
141
142
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
143
144
	<?php lsx_entry_top(); ?>
145
146
	<div class="row">
147
		<div class="col-xs-12 col-sm-6 col-md-4">
148
			<figure class="lsx-team-avatar">
149
				<?php echo wp_kses_post( $thumbnail ); ?>
150
			</figure>
151
152
			<?php if ( count( $links ) > 0 ) : ?>
153
				<span class="lsx-team-socials-header"><?php echo esc_html__( 'Follow', 'lsx-team' ) . ':'; ?></span>
154
155
				<ul class="lsx-team-socials list-inline">
156
					<?php foreach ( $links as $service => $link ) : ?>
157
						<li><a href="<?php echo esc_html( $link ); ?>" target="_blank" rel="nofollow noreferrer noopener"><i class="fa fa-<?php echo esc_html( $service ); ?>" aria-hidden="true"></i></a></li>
158
					<?php endforeach; ?>
159
				</ul>
160
			<?php endif; ?>
161
		</div>
162
163
		<div class="col-xs-12 col-sm-6 col-md-8">
164
			<h1 class="lsx-team-name"><?php the_title(); ?></h1>
165
			<h5 class="lsx-team-job-title"><?php echo esc_html( $job_title ); ?></h5>
166
			<div class="lsx-team-content"><?php the_content(); ?></div>
167
168
			<?php if ( ! empty( $email ) || ! empty( $phone ) || ! empty( $skype ) ) : ?>
169
				<ul class="lsx-team-contact list-inline">
170
					<?php if ( ! empty( $email ) ) : ?>
171
						<li><a href="mailto:<?php echo esc_attr( $email ); ?>"><i class="fa fa-envelope-o" aria-hidden="true"></i> <?php echo esc_attr( $email ); ?></a></li>
172
					<?php endif; ?>
173
174
					<?php if ( ! empty( $phone ) ) : ?>
175
						<li><a href="tel:<?php echo esc_attr( $phone_attr ); ?>"><i class="fa fa-phone" aria-hidden="true"></i> <?php echo esc_attr( $phone ); ?></a></li>
176
					<?php endif; ?>
177
178
					<?php if ( ! empty( $skype ) ) : ?>
179
						<li><i class="fa fa-skype" aria-hidden="true"></i> <?php echo esc_attr( $skype ); ?></li>
180
					<?php endif; ?>
181
				</ul>
182
			<?php endif; ?>
183
		</div>
184
	</div>
185
186
	<?php if ( count( $tabs ) > 0 ) : ?>
187
		<div class="entry-tabs">
188
			<ul class="nav nav-tabs">
189
				<?php foreach ( $tabs as $i => $tab ) : ?>
190
					<li<?php if ( 0 === $i ) echo ' class="active"'; ?>><a data-toggle="tab" href="#<?php echo esc_attr( sanitize_title( $tab['title'] ) ); ?>"><?php echo esc_html( $tab['title'] ); ?></a></li>
191
				<?php endforeach; ?>
192
			</ul>
193
194
			<div class="tab-content">
195
				<?php foreach ( $tabs as $i => $tab ) : ?>
196
					<div id="<?php echo esc_attr( sanitize_title( $tab['title'] ) ); ?>" class="tab-pane fade<?php if ( 0 === $i ) echo ' in active'; ?>">
197
						<?php echo do_shortcode( $tab['shortcode'] ); ?>
198
					</div>
199
				<?php endforeach; ?>
200
			</div>
201
		</div>
202
	<?php endif; ?>
203
204
	<?php lsx_entry_bottom(); ?>
205
206
</article><!-- #post-## -->
207
208
<?php lsx_entry_after();
209