<?php
/**
 * The template for displaying all single posts.
 *
 * @package _spx
 */
get_header();
?>

<!-- Extra header content goes here (like slider, header title, post thumbnail/ video, etc) -->

<?php
if (xs_get_option('theme_options', 'main_template_style') == 'color' && has_post_thumbnail()) {
    $large_image_url = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full');
    echo '
	<div class="single-post-heading">
		<img src="' . $large_image_url[0] . '" alt="" class="img-responsive">
	</div>';
}
?>

<!-- End extra content -->
</section>
<!-- end HEADER --> 
<!--BEGIN-INTRO-BOX-->
<section id="intro" class="page-block single-post">
    <div class="container">
        <div class="section bottom-margin <?php
        if (!has_post_thumbnail()) {
            echo 'no-thumb';
        }
        ?> <?php
        if (xs_get_option('theme_options', 'main_template_style') == 'image') {
            echo 'no-bottom';
        }
        ?>">
            <header class="page-head clearfix">
                <div class="row">
                    <div class="text-right">
                        <div class="col-md-11 col-sm-10 col-xs-9 text-left">
                            <h2><?php echo esc_html(get_the_title()); ?></h2>
                            <small class="text-muted">
                                <?php
                                if (get_post_meta($post->ID, 'xs_post_show_category', true) != 'off') {
                                    xs_posted_cat();
                                }

                                if (get_post_meta($post->ID, 'xs_post_show_author', true) != 'off') {
                                    xs_posted_by($post->post_author);
                                }
                                ?>
                            </small>
                        </div>
                        <div class="col-md-1 col-sm-2 col-xs-3 date-container">
                            <?php xs_posted_on($post->ID); ?>
                        </div>
                    </div>
                </div><!--end-row--> 
            </header>
        </div><!--end-of-section-->
        <?php
        if (xs_get_option('theme_options', 'main_template_style') == 'image' && has_post_thumbnail()) {
            $large_image_url = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full');
            echo '
	<div class="featured-img">
		<img src="' . $large_image_url[0] . '" alt="' . the_title_attribute('echo=0') . '" class="img-responsive">
	</div>';
        }
        ?>
        <div class="xs-dynamic row">
            <div class="xs-dynamic col-md-8 col-sm-8 col-xs-12">
                <!-- Post Content -->
                <div class="post-content">
                    <div class="content-wrapper">
                        <?php while (have_posts()) : the_post(); ?>

                            <?php get_template_part('content', 'single'); ?>

                            <hr>
                            <?php xs_post_nav(); ?>
                            <hr>

                            <?php
                            if (get_post_meta($post->ID, 'xs_post_show_comment', true) != "off"):
                                // If comments are open or we have at least one comment, load up the comment template
                                if (comments_open() || get_comments_number()) :
                                    comments_template();
                                endif;
                            endif;
                            ?>

                        <?php endwhile; // end of the loop.  ?>
                    </div>
                </div>
            </div>

            <?php get_sidebar(); ?>
        </div>
    </div>
</section>
<?php get_footer(); ?>
