<?php
/**
 * The template for header notice
 *
 * @package MatrixAddons
 * @subpackage trainify
 * @since 1.0.0
 */


$slider_notice_args = array(
	"item"=>			1,
	"vertical"=>		true,
	"loop"=>			true,
	"verticalHeight"=>	apply_filters( 'trainify_notice_section_height', 35 ),
	"pager"=>			false,
	"enableTouch"=>		false,
	"enableDrag"=>		false,
	"auto"=>			true,
	"controls"=>		true,
	"speed"=>			1350,
);
?>
<div class="tff-notice-wrapper">
	<div class="tff-container">
		<div class="tff-notice-block tff-clearfix">
			<?php
			$trainify_notice_caption = get_theme_mod( 'trainify_notice_caption', esc_html__( 'Notices', 'trainify' ) );
			?>
			<span class="notice-caption"><?php echo esc_html( $trainify_notice_caption ); ?></span>
			<div class="notice-content-wrapper">
				<?php
				$trainify_notice_cat_id = apply_filters( 'trainify_notice_cat_id', null );
				$notice_args                    = array(
					'cat'            => $trainify_notice_cat_id,
					'posts_per_page' => '5'
				);
				$notice_query                   = new WP_Query( $notice_args );
				if ( $notice_query->have_posts() ){
					?>
					<ul id="newsNotice" class="cS-hidden" data-notice="<?php echo esc_attr(json_encode($slider_notice_args)); ?>">
						<?php
						while ( $notice_query->have_posts() ){
							$notice_query->the_post();
							?>
							<li>
								<div class="news-notice-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
								</div>
							</li>
							<?php
						}
						?>
					</ul>
					<?php
				}
				?>
			</div><!-- .notice-content-wrapper -->
		</div><!-- .tff-notice-block -->
	</div><!-- .tff-container -->
</div><!-- .tff-notice-wrapper -->