<?php
/**
 * The template for displaying team image content
 *
 * @package SimClick
 */
?>

<?php
$quantity = get_theme_mod( 'signify_team_number', 4 );

for ( $i = 1; $i <= $quantity; $i++ ) {
	$target = get_theme_mod( 'signify_team_target_' . $i ) ? '_blank' : '_self';

	$signify_link = get_theme_mod( 'signify_team_link_' . $i ) ? get_theme_mod( 'signify_team_link_' . $i ) : '#';

	if ( function_exists( 'qtrans_convertURL' ) ) {
		$signify_link = qtrans_convertURL( $signify_link );
	}

	echo '
	<article id="team-post-' . esc_attr( $i ) . '" class="hentry"> <div class="hentry-inner">';

		$signify_title       = get_theme_mod( 'signify_team_title_' . $i );
		$position    = get_theme_mod( 'signify_team_position_' . $i );
		$content     = get_theme_mod( 'signify_team_content_' . $i );
		$more_button = get_theme_mod( 'signify_team_more_button_text_' . $i );

		$image = get_theme_mod( 'signify_team_image_' . $i ) ? get_theme_mod( 'signify_team_image_' . $i ) : trailingslashit( get_template_directory_uri() ) . 'images/no-thumb-1160x670.jpg';

		echo '
		<div class="post-thumbnail" >
			<a class="cover-link" href="' . esc_url( $signify_link ) . '" target="' . esc_attr( $target ) . '">
				<img src="' . esc_url( $image ) . '" class="wp-post-image" alt="' . esc_attr( $signify_title ) . '" title="' . esc_attr( $signify_title ) . '">
			</a>
		</div>';

		if ( $signify_title || $content || $more_button) {
			echo '
			<div class="entry-container">
				<header class="entry-header">';

				if ( $signify_title ) {
					echo '
					<h2 class="entry-title">
						<a href="' . esc_url( $signify_link ) . '" rel="bookmark" target="' . esc_attr( $target ) . '">' . wp_kses_post( $signify_title ) . '</a>
					</h2>';
				}

				if ( $position ) {
					echo '
					<div class="entry-meta">
						<span class="entry-job">
                        	<span class="job-label">' . esc_html( $position ) . '</span>
	                    </span>
	                </div> <!-- .entry-meta -->';
	            }

				echo '</header>';

				if ( $content || $more_button ) {
					if ( $more_button ) {
						$content .= '<span class="more-button">
							<a class="more-link" href="' . esc_url( $signify_link ) . '" rel="bookmark" target="' . esc_attr( $target ) . '">' . esc_html( $more_button ) . '</a>
						</span>';
					}

				 	echo '<div class="entry-summary">' . wp_kses_post( $content ) . '</div><!-- .entry-summary -->';
				}

				signify_team_social_links( $i );

				echo '
			</div><!-- .entry-container -->';		}

		echo '
		</div>
	</article><!-- .team-post-' . esc_attr( $i ) . ' -->';
} // End for().
