<?php
/**
 * Theme Name: 		Noisa
 * Theme Author: 	Mariusz Rek - Rascals Themes
 * Theme URI: 		http://rascalsthemes.com/noisa
 * Author URI: 		http://rascalsthemes.com
 * File:			single.php
 * @package noisa
 * @since 1.0.0
 */

get_header();

// Get options
$noisa_opts = noisa_opts();

// Get layout
$noisa_layout = get_post_meta( $wp_query->post->ID, '_layout', true );
$noisa_layout = isset( $noisa_layout ) && $noisa_layout !== '' ? $noisa_layout = $noisa_layout : $noisa_layout = 'wide';

// Get Custom Intro Section
get_template_part( 'inc/custom-intro' );

?>

<div id="content" class="<?php echo esc_attr( $noisa_layout ) ?>">

	<div class="container clearfix">
		
		<div role="main" class="main <?php echo esc_attr( $noisa_layout ) ?>">
			<?php
			// Start the Loop.
			while ( have_posts() ) : the_post();

				// Include the page content template.
				include( locate_template( 'content.php', false, false ) ); 

			endwhile;
			?>
		</div>
		<!-- /main -->
		<?php if ( $noisa_layout !== 'wide' && $noisa_layout !== 'thin' && $noisa_layout !== 'vc' ) : ?>
			<?php get_sidebar( 'custom' ); ?>
		<?php endif; ?>
	</div>
    <!-- /container -->

    <!-- Single Navigation  -->
     <?php if ( is_single() ) : ?>
        <?php echo noisa_post_nav(); ?>
    <?php endif; ?>
</div>
<!-- #content -->

<!-- Comments -->
<?php
// If comments are open or we have at least one comment, load up the comment template.
if ( comments_open() || get_comments_number() ) {
	$disqus = $noisa_opts->get_option( 'disqus_comments' );
	$disqus_shortname = $noisa_opts->get_option( 'disqus_shortname' );

	if ( ( $disqus && $disqus === 'on' ) && ( $disqus_shortname && $disqus_shortname !== '' ) ) {
		get_template_part( 'inc/disqus' );

	} else {
		comments_template();
	}
}

get_footer();