<?php
/**
 * The template for displaying featured image content
 *
 * @package Personal_Trainer
 */
?>

<?php
$quantity = get_theme_mod( 'personaltrainer_professionals_number', 3 );

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

	$link = get_theme_mod( 'personaltrainer_professionals_link_' . $i ) ? get_theme_mod( 'personaltrainer_professionals_link_' . $i ) : '#';

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

	$title      = get_theme_mod( 'personaltrainer_professionals_title_' . $i );
	$subtitle   = get_theme_mod( 'personaltrainer_professionals_subtitle_' . $i );
	$content    = get_theme_mod( 'personaltrainer_professionals_content_' . $i );
	$image      = get_theme_mod( 'personaltrainer_professionals_image_' . $i );
	$post_class = $image ? ' has-post-thumbnail' : '';

	echo '
	<div class="meet-slide">
		<article id="post-' . esc_attr( $i ) . '" class="hentry professionals-image' . $post_class . '">
			<div class="entry-container">';

				if ( '' !== $content ) {
					echo '
					<div class="entry-content">' . wp_kses_post( apply_filters( 'the_content', $content ) ) . '</div><!-- .entry-content -->';
				}

				if ( $title || $subtitle ) {
					echo '
					<header class="entry-header">';

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

					if ( $subtitle ) {
						echo '<div class="entry-meta"><p>' . $subtitle . '</p></div>';
					}

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

			if ( $image &&  ! get_theme_mod( 'personaltrainer_professionals_disable_image' ) ) {
				echo '
				<figure class="featured-content-image">
					<img src="' . esc_url( $image ) . '" class="wp-post-image" alt="' . esc_attr( $title ) . '" title="' . esc_attr( $title ) . '">
				</figure>';
			}

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