<?php
/**
 * Featured Content Slider.
 * @package Delicacy
 */

$featured = delicacy_get_featured_posts();

if ( empty( $featured ) )
	return;

?>

<div id="featured-slider" class="featured-slider">

	<section id="featured-slides" class="featured-slides"><?php
		foreach ( $featured as $post ) {
			setup_postdata( $post );
			get_template_part( 'featured-content', 'slider' );
		}
		wp_reset_postdata();
	?></section>

	<?php rewind_posts(); ?>

	<?php if ( is_countable( $featured ) && 1 < count( $featured ) ) : ?>
		<nav class="feature-slider-navigation">
			<ul><?php
				$counter_slider = 1;
				foreach ( $featured as $post ) {
					setup_postdata( $post );

					$class = '';
					if ( 1 == $counter_slider )
						$class = ' class="active"';
					?>
					<li><a href="#featured-post-<?php the_ID(); ?>" title="<?php echo esc_attr( sprintf( __( 'Featuring: %s', 'delicacy' ), the_title_attribute( 'echo=0' ) ) ) ?>"<?php echo $class; ?>><?php echo $counter_slider; ?></a></li>
					<?php
					$counter_slider++;
				}
				wp_reset_postdata();
			?></ul>
		</nav>
	<?php endif; ?>
</div><!-- .featured-slider -->