<?php
/**
 * @package WordPress
 * @subpackage Campoal
 */

global $campoal_options;

$related                = isset($campoal_options['conikal_related_field']) ? $campoal_options['conikal_related_field'] : 0;
$share_button_position  = isset($campoal_options['conikal_post_share_button_position_field']) ? $campoal_options['conikal_post_share_button_position_field'] : 'bottom';
$post_comment           = isset($campoal_options['conikal_post_comment_field']) ? $campoal_options['conikal_post_comment_field'] : 1; ?>

<?php while(have_posts()) : the_post(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class('single-post-center'); ?>>
    <div class="ui relaxed grid post-center-header">
        <div class="sixteen wide mobile eight wide computer column post-center-left">
            <div class="post-center-image"></div>
        </div>
        <div class="sixteen wide mobile eight wide computer column post-center-right">
            <div class="post-center-title">
                <div class="ui basic segment">
                    <?php get_template_part('templates/content/part/post-category-labels'); ?>

                    <header class="entry-header">
                        <?php the_title( '<h1 class="entry-title post-single-title">', '</h1>' ); ?>
                    </header><!-- .entry-header -->

                    <div class="post-subheader-section ui small header">
                        <?php get_template_part('templates/content/part/post-subtitle-action'); ?>
                    </div>

                    <?php if ( in_array($share_button_position, array('all', 'header')) ) {
                        echo conikal_social_button_after_post_content('', 'none');
                    } ?>
                </div>
            </div>
        </div>
    </div>
    <div class="wrapper read post">
        <div class="ui container">
            <div class="ui relaxed grid">
                <div class="sixteen wide mobile four wide tablet three wide computer column computer only post-left-sticky" id="post-left-sticky">
                    <?php 
                    /*
                     * Include related posts template
                     */
                    get_template_part('templates/related-post-sticky'); ?>

                    <div class="social-share ui sticky" id="share-post">
                        <?php echo apply_filters('conikal_post_left_sticky' , ''); ?>
                    </div>
                    <div class="clearfix"></div>
                </div>
                <div class="sixteen wide mobile sixteen wide tablet ten wide computer column" id="content">
                    
                <?php
                    // Include the single post content template.
                    get_template_part( 'templates/content/single-content', 'post' ); 
                ?>
                </div>
                <div class="sixteen wide mobile one wide tablet three wide computer column computer only post-right-sticky" id="post-right-sticky">
                    <div class="post-ads-banner ui sticky" id="post-ads-banner">
                        <?php if (function_exists('conikal_ads_banner')) { 
                            conikal_ads_banner('conikal_single_post_banner_3_field');
                        } ?>
                    </div>
                    <div class="clearfix"></div>
                </div>
            </div>
        </div>
    </div>
    <div class="clearfix"></div>

    <div class="ui container post-addition-section">
        <div class="ui hidden divider"></div>
        <?php if($related == 1) { ?>
            <?php get_template_part('templates/related-posts'); ?>
        <?php } ?>
        <?php if(comments_open() && $post_comment == 1) { ?>
        <div class="post-comment-section">
            <div class="ui grid">
                <div class="sixteen wide mobile three wide computer column computer only"></div>
                <div class="sixteen wide mobile ten wide computer column">
                    <?php comments_template(); ?>
                </div>
            </div>
        </div>
        <?php } ?>

        <?php if (function_exists('conikal_ads_banner')) { 
            conikal_ads_banner('conikal_single_post_banner_4_field');
        } ?>
    </div>
</article>
<?php endwhile; ?>
