<?php get_header(); ?>
<?php $mts_options = get_option(MTS_THEME_NAME); ?>
<?php if ($mts_options['mts_breadcrumb'] == '1') { ?>
	<div class="breadcrumb" xmlns:v="http://rdf.data-vocabulary.org/#"><?php mts_the_breadcrumb(); ?></div>
<?php } ?>
<div id="page">
    <article class="<?php mts_article_class(); ?>" itemscope="" itemtype="http://schema.org/BlogPosting">
   		<div id="content_box">
      		<div id="post-<?php the_ID(); ?>" <?php post_class('g post'); ?>>
        		<div class="single_post">
                	<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
                 		<?php $header_animation = mts_get_post_header_effect(); ?>
                 		<?php if(!empty($header_animation)) { ?>
							<?php if ( 'parallax' === $header_animation ) {?>
								<?php if (mts_get_thumbnail_url()) : ?>
	        						<div id="parallax" <?php echo 'style="background-image: url('.mts_get_thumbnail_url().');"'; ?>></div>
	    						<?php endif; ?>
							<?php } else if ( 'zoomout' === $header_animation ) {?>
		 						<?php if (mts_get_thumbnail_url()) : ?>
	        						<div id="zoom-out-effect"><div id="zoom-out-bg" <?php echo 'style="background-image: url('.mts_get_thumbnail_url().');"'; ?>></div></div>
	    						<?php endif; ?>
							<?php } ?>
						<?php } else {
							if ( has_post_thumbnail() && !empty($mts_options['mts_single_featured']) ) {
								echo '<div class="featured-thumbnail single-featured">'; the_post_thumbnail('slider1',array('title' => '')); echo '</div>'; 
							}
						} ?>

        				<header>
            				<h1 class="title single-title entry-title" itemprop="headline"><?php the_title(); ?></h1>
             				<?php mts_the_postinfo( 'single' ); ?>
        				</header><!--.headline_area-->

						<?php if ( isset( $mts_options['mts_single_post_layout'] ) && is_array( $mts_options['mts_single_post_layout'] ) && array_key_exists( 'enabled', $mts_options['mts_single_post_layout'] ) ) {
							$single_post_parts = $mts_options['mts_single_post_layout']['enabled'];
						} else {
							$single_post_parts = array( 'content' => 'content', 'related' => 'related', 'author' => 'author' );
						}
						foreach( $single_post_parts as $part => $label ) { 
							switch ($part) {
								case 'content': ?>
								 	<div class="post-single-content box mark-links entry-content">
             							<div class="thecontent" itemprop="articleBody">
											<?php if ($mts_options['mts_posttop_adcode'] != '') { ?>
												<?php $toptime = $mts_options['mts_posttop_adcode_time']; if (strcmp( date("Y-m-d", strtotime( "-$toptime day")), get_the_time("Y-m-d") ) >= 0) { ?>
													<div class="topad">
															<?php echo do_shortcode($mts_options['mts_posttop_adcode']); ?>
													</div>
												<?php } ?>
											<?php } ?>
											<?php if (isset($mts_options['mts_social_button_position']) && $mts_options['mts_social_button_position'] == 'top') mts_social_buttons(); ?>
											<?php the_content(); ?>
											<?php wp_link_pages(array('before' => '<div class="pagination">', 'after' => '</div>', 'link_before'  => '<span class="current"><span class="currenttext">', 'link_after' => '</span></span>', 'next_or_number' => 'next_and_number', 'nextpagelink' => '<i class="fa fa-angle-right"></i>', 'previouspagelink' => '<i class="fa fa-angle-left"></i>', 'pagelink' => '%','echo' => 1 )); ?>
											<?php if ($mts_options['mts_postend_adcode'] != '') { ?>
												<?php $endtime = $mts_options['mts_postend_adcode_time']; if (strcmp( date("Y-m-d", strtotime( "-$endtime day")), get_the_time("Y-m-d") ) >= 0) { ?>
													<div class="bottomad">
														<?php echo do_shortcode($mts_options['mts_postend_adcode']); ?>
													</div>
												<?php } ?>
											<?php } ?> 
											<?php if (isset($mts_options['mts_social_button_position']) && $mts_options['mts_social_button_position'] !== 'top') mts_social_buttons(); ?>
										</div><!--.post-single-content-->
									</div><!--.single_post-->
								<?php break;

								case 'tags':
									mts_the_tags('<span class="tagtext">'.__('Tags', MTS_THEME_TEXTDOMAIN ).':</span>',', ');
								break;

								case 'related':
									mts_related_posts();
								break;

								case 'author': ?>
									<h4 class="single-page-title"><?php _e('About The Author', 'mythemeshop'); ?></h4>
	           						<div class="postauthor">
	            						<?php if(function_exists('get_avatar')) { echo get_avatar( get_the_author_meta('email'), '141' );  } ?> 
		            					<div class="author_wrap">
		                					<h5 class="vcard"><a href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?>" rel="nofollow" class="fn"><?php the_author_meta( 'nickname' ); ?></a></h5>
		                  					<div class="readMore">
		                  						<a href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?>" rel="nofollow"><?php _e('More about this author', 'mythemeshop'); ?></a>
		                					</div>
		                					<div class="post-info">
		                  						<span class="theauthor"><?php _e('Author ', 'mythemeshop'); ?></span>
		                  						<span class="thecomment"><a rel="nofollow" href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?>" itemprop="interactionCount"><?php printf( __( '%d Posts', 'mythemeshop' ), count_user_posts( get_the_author_meta( 'ID' ) ) ) ?></a></span>
		                					</div>
		            					</div>    
	            						<p><?php the_author_meta('description') ?></p>
	        						</div>
								<?php break;
							}
						} ?>
						<?php comments_template( '', true ); ?>
					<?php endwhile; /* end loop */ ?>
				</div>
			</div>
		</div>
	</article>
	<?php get_sidebar(); ?>
<?php get_footer(); ?>