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

global $campoal_options;
global $post;
global $current_user;

$sidebar_position = isset($campoal_options['conikal_sidebar_field']) ? $campoal_options['conikal_sidebar_field'] : 'right';
$view_counter = isset($campoal_options['conikal_view_counter_field']) ? $campoal_options['conikal_view_counter_field'] : 0;
$related = isset($campoal_options['conikal_related_field']) ? $campoal_options['conikal_related_field'] : 0;
$dropcap = isset($campoal_options['conikal_dropcap_post_field']) ? $campoal_options['conikal_dropcap_post_field'] : 0;

$post_id = get_the_ID(); 
$post_title = get_the_title();
$post_date = get_the_date();
$post_category = get_the_category();
$post_image = wp_get_attachment_image_src( get_post_thumbnail_id( $post_id ), 'single-post-thumbnail' );
$post_excerpt = get_the_excerpt();
$post_tags = get_the_tags();
$post_url = get_permalink();
$post_words = explode(' ', get_the_content());

// set view
if (function_exists('conikal_set_post_views')) {
    conikal_set_post_views($post_id);
}
?>

<?php if (function_exists('conikal_ads_banner')) { 
    conikal_ads_banner('conikal_single_post_banner_1_field');
} ?>

<!-- Main Content -->
<div class="entry-content post <?php echo esc_attr(count($post_words) >= 50 && $dropcap == 1 ? 'dropcap' : '') ?>">
    <?php the_content(); ?>
    <div class="clearfix"></div>
    <?php wp_link_pages( array(
        'before'      => '<div class="page-links">',
        'after'       => '</div>',
        'link_before' => '<span>',
        'link_after'  => '</span>',
        'pagelink'    => '%',
        'separator'   => '',
    ) ); ?>
</div>

<?php if ($post_tags) { ?>
<div class="post-tags-section">
    <div class="ui basic vertical segment">
        <div class="ui labels">
            <?php foreach($post_tags as $tag) {
                echo '<a href="' . get_tag_link($tag->term_id) . '" class="ui label" data-bjax>' . esc_html($tag->name) . '</a>';
            } ?>
        </div>
    </div>
</div>
<?php } ?>

<?php if (function_exists('conikal_ads_banner')) { 
    conikal_ads_banner('conikal_single_post_banner_2_field');
} ?>

<!-- AUTHOR -->
<?php get_template_part('templates/content/part/post', 'author'); ?>

<!-- NAVIGATION -->
<?php get_template_part('templates/content/part/post', 'navigation'); ?>

<?php wp_nonce_field('views_ajax_nonce', 'securityViews', true); ?>