
<?php
/**
 * Template Name: Full width 2 Column Blog Template
 * 
 * @package WordPress
 * @subpackage Probit
 * @since Probit 1.0
 *
 */
if (!defined('ABSPATH')) {
    exit; // Exit if accessed directly
}
get_header();
?>
<div class="single_top_bar entry-header">
    <div class="container">
        <div class="row">
            <h1 class="entry-title text-capitalize col-xs-12"><?php the_title(); ?></h1>
            <?php if (get_theme_mod('enable_breadcrumbs')) { ?>
                <div class="col-xs-12"><?php probit_breadcrumb(); ?></div>
            <?php } ?>
        </div>
    </div>
</div>
<div class="container">
    <div id="content" role="main">
        <div class="row">
            <div id="primary">
                <div class="col-xs-12 blog_wrapper grid-layout">
                    <?php
                    global $wp_query;
                    $i = 0;
                    if (have_posts()) :
                        while (have_posts()) : the_post();
                            if ($i % 2 == 0) {
                                $class = 'padding_left_0';
                            } else {
                                $class = 'padding_right_0';
                            }

                            if (has_post_thumbnail()) {
                                $content_class = 'col-sm-8';
                            } else {
                                $content_class = 'col-sm-12';
                            }
                            ?>
                            <div class="col-xs-12 col-sm-12 col-md-6 blog_section <?php echo $class; ?>">
                                <div class="blog_div">
                                    <?php if (has_post_thumbnail()) { ?>
                                        <div class="blog_img col-xs-12 col-sm-4">
                                            <a href="<?php the_permalink(); ?>">
                                                <?php
                                                if (has_post_thumbnail())
                                                    the_post_thumbnail('probit-blog-img');
                                                else
                                                    echo '<img alt="' . esc_attr(get_the_title()) . '" src="' . esc_url(get_template_directory_uri() . '/images/no_image_270.png') . '" />';

                                                if (is_sticky()) :
                                                    ?>
                                                    <div class="featured-post-two-column">
                                                        <?php _e('Featured post', 'probit'); ?>
                                                    </div>
                                                    <?php
                                                endif;
                                                ?>
                                            </a>
                                        </div><?php
                                    }
                                    ?>
                                    <div class="blog_content col-xs-12 <?php echo $content_class; ?> padding_right_0">
                                        <div class="blog_title pull-left">
                                            <h3 class="text-capitalize">
                                                <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
                                            </h3>
                                            <div class="postmeta">
                                                <div class="postdate headerfont" itemprop="datePublished">
                                                    <span class="postday"><?php echo esc_html(get_the_date("d")); ?></span>
                                                    <?php echo esc_html(get_the_date("M Y")); ?>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="col-xs-12 padding_left_0 text-justify">
                                            <?php echo wp_trim_words(get_the_excerpt(), 25, ' &hellip;'); ?>
                                        </div>
                                    </div>                            
                                    <footer class="blog_footer text-capitalize blog-footer-two-block">
                                        <span><i class="fa fa-user"></i><?php echo esc_attr(get_the_author()); ?></span>
                                        <?php
                                        if (comments_open()) :
                                            comments_popup_link('<span class="leave-reply"><i class="fa fa-comment"></i>0</span>', '<span class="leave-reply"><i class="fa fa-comment"></i>1</span>', '<span class="leave-reply"><i class="fa fa-comment"></i>%</span>');
                                        endif; // comments_open()

                                        if ('post' == get_post_type()) {
                                            // Translators: used between list items, there is a space after the comma.
                                            $categories_list = get_the_category_list(', ');
                                            $category_pieces = explode(", ", $categories_list);

                                            // Translators: used between list items, there is a space after the comma.
                                            $tag_list = get_the_tag_list('', ', ');
                                            $tag_pieces = explode(", ", $tag_list);

                                            if ($categories_list != "") {
                                                ?>
                                                <span class="probit-two-blog"><i class="fa fa-bookmark"></i><?php echo $category_pieces[0]; ?></span>
                                                <?php
                                            }

                                            if ($tag_list != "") {
                                                ?>
                                                <span class="probit-two-blog"><i class="fa fa-tag"></i><?php echo $tag_pieces[0]; ?></span>
                                                <?php
                                            }
                                        }
                                        ?>
                                        <div class="read_more">
                                            <a href="<?php the_permalink(); ?>" class="text-capitalize"><i class="fa fa-plus"></i><?php _e('Read More', 'probit'); ?></a>
                                        </div>
                                    </footer>
                                </div>
                            </div>
                            <?php
                            $i++;
                        endwhile;
                        ?>
                        <div class="col-xs-12 padding_0">
                            <?php
                            // Previous/next page navigation.
                            probit_paging_nav();
                            ?>
                        </div>
                        <?php
                    endif;
                    ?>
                </div>
            </div>
        </div><!-- .row -->
    </div><!-- #content -->

</div><!-- .container -->
<?php get_footer(); ?>