<?php
/**
 * The template for displaying testimonial items
 *
 * @package Personal_Trainer
 */
?>

<?php
$enable = get_theme_mod( 'personaltrainer_testimonial_option', 'disabled' );

if ( ! personaltrainer_check_section( $enable ) ) {
	// Bail if featured content is disabled
	return;
}

$headline = get_theme_mod( 'personaltrainer_testimonial_headline', esc_html__( 'Testimonials', 'personal-trainer' ) );
$subheadline = get_theme_mod( 'personaltrainer_testimonial_subheadline' );

$classes[] = 'section testimonial-wrapper';

if ( ! $headline && ! $subheadline ) {
	$classes[] = 'no-headline';
}

?>

<div class="testimonials-content-wrapper <?php echo esc_attr( implode( ' ', $classes ) ); ?>">
	<div class="wrapper">

		<?php if ( $headline || $subheadline ) : ?>
			<div class="section-heading-wrap">
			<?php if ( $headline ) : ?>
				<h2 class="section-title"><?php echo wp_kses_post( $headline ); ?></h2>
			<?php endif; ?>

			<?php if ( $subheadline ) : ?>
				<div class="section-description">
					<?php echo wp_kses_post( $subheadline ); ?>
				</div><!-- .section-description -->
			<?php endif; ?>
			</div><!-- .section-heading-wrap -->
		<?php endif; ?>

		<div class="section-content-wrap">
			<div class="cycle-slideshow"
			    data-cycle-log="false"
			    data-cycle-pause-on-hover="true"
			    data-cycle-swipe="true"
			    data-cycle-auto-height=container
			    data-cycle-fx="scrollHorz"
				data-cycle-speed="1000"
				data-cycle-timeout="4000"
				data-cycle-loader=false
				data-cycle-prev= .cycle-prev
				data-cycle-next= .cycle-next
				data-cycle-slides="> .review-slide"
				>

				<!-- empty element for pager links -->
				<div class="cycle-pager"></div>

			<?php get_template_part( 'template-parts/testimonials/post-types', 'testimonial' ); ?>
			</div><!-- .cycle-slideshow -->
			<!-- prev/next links -->
			<div class="cycle-prev fa fa-angle-left" aria-label="<?php esc_attr_e( 'Previous', 'personal-trainer' ); ?>" aria-hidden="true"><span class="screen-reader-text"><?php esc_html_e( 'Previous Slide', 'personal-trainer' ); ?></span></div>
			<div class="cycle-next fa fa-angle-right" aria-label="<?php esc_attr_e( 'Next', 'personal-trainer' ); ?>" aria-hidden="true"><span class="screen-reader-text"><?php esc_html_e( 'Next Slide', 'personal-trainer' ); ?></span></div>

		</div><!-- .section-content-wrap -->
	</div><!-- .wrapper -->
</div><!-- .testimonials-content-wrapper -->
