
<?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="main">
  <ul class="breadcrumb">
    <li><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></li>
  </ul>
  
  <!-- Start row Most Recent Post Full Width -->
  <?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(); ?>
  <!-- END row Most Recent Post Full Width --> 
  

<div class="blog-content-area">
  <div class="container-blog ">
    <div class="row">
      <div class="col-lg-12">
        <section id="content">
          <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
            <section class="entry-content">
              <div class="page-content"> 
                <!-- Start rows of Three Posts -->
                  <div class="card-row">
                <?php  $args = array(
                  'offset' => '1',
                  'post_type' => 'post',
                  'posts_per_page' => -1
                ); 
                //$i = 1;
                $wp_query = new WP_query( $args );
                if ( $wp_query->have_posts() ): while ( $wp_query->have_posts() ): $wp_query->the_post();
                // post stuff... ?>
               
                <div class="card-article">
                  <div class="article-header">
                    <div class="img-fit">
                      <div class="article-featured">
                        <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
                        <?php the_post_thumbnail('full');?>
                      </a>
                      </div>
                      </a> </div>
                    <div class="card-content">
                      <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>
                      <h2 data-role="article-title"><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
                        <?php the_title(); ?>
                        </a> </h2>
                      <div class="article-date">
                        <?php $post_date = get_the_date( 'F j, Y' ); echo $post_date;?>
                      </div>
                      <div class="article-readmore"> <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">View Article &#8594;</a> </div>
                    </div>
                  </div>
                </div>
               <?php wp_reset_postdata(); ?>
 
                <?php endwhile;
                endif;?>
                </div>
                
                <!-- END rows of Three Posts --> 
              </div>
            </section>
          </article>
        </section>
            <div class="navigation">
                            <!-- pagination -->

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