
<?php /* Template Name: Blog Template */ ?>
<?php get_header(); ?>
<?php
$categories = get_the_category();
$category = $categories[ 0 ];
?>
<div class="container-fluid-blog main-content-wrap category" role="mains-1">
 <!-- Start row Most Recent Post Full Width -->
         <?php $blog_index_hero = get_theme_mod( 'blog_index_hero', 'yes' );?><?php if ($blog_index_hero == "yes") : ?>
  <?php query_posts('post_type=post&post_status=publish&posts_per_page=10&paged='. get_query_var('paged')); ?>
  <?php
  $args = array(
    'posts_per_page' => '1',
  );
  ?>
  <?php
  $query = new WP_query( $args );
  if ( $query->have_posts() ) ?>
  <?php while ( $query->have_posts() ) : $query->the_post(); /* start the loop */ ?>
  <?php $backgroundImg = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'full' ); ?>
  <div class="header page-title post-header" style="background: url('<?php echo $backgroundImg[0]; ?>') no-repeat; ">
    <div class="headerCentered">
      <div class="cat-label">
        <?php
        $categories = get_the_category();
        if ( !empty( $categories ) ) {
          echo '<a href="' . esc_url( get_category_link( $categories[ 0 ]->term_id ) ) . '">' . esc_html( $categories[ 0 ]->name ) . '</a>';
        }
        ?>
      </div>
      <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><h2 data-role="page-title">
        <?php the_title(); ?>
      </h2></a>
      <span class="page-author"><strong>Written by</strong> <?php the_author(); ?></span> 
       <span style="display: block;" class="article-readmore-main"><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">View Article &#8594;</a></span>
      </div>
  </div>
  <?php endwhile; rewind_posts(); ?>
	 <?php else : ?>
	<?php endif; ?>
  <!-- END row Most Recent Post Full Width --> 
  	<?php $index_style = get_theme_mod('blog_index_style', 'index_cards');?>
          <?php if ( $index_style == 'index_cards' ): ?>
    		<?php get_template_part( 'blog/blog', 'cat-iga_cards' );?>
<!-- -----------------CATEGORY CARDS End -->
  <?php elseif ( $index_style == 'index_grid') : ?>
	<?php 	get_template_part( 'blog/blog', 'cat-grid' );?>
<!-- -----------------CATEGORY GRIDS End -->
	<?php elseif ( $index_style == 'index_row') : ?>
<?php 	get_template_part( 'blog/blog', 'cat-rows' );?>
	<!-- -----------------CATEGORY Rows End -->
  <?php else : ?>
  Not Found
  <?php endif; ?>


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