<?php /*
Template Name: Blog Page Template
*/
?>&#13;
<?php global $asteria;?>&#13;
<?php get_header(); ?>&#13;
&#13;
<div class="fixed_site">&#13;
<!--BIG PAGE HEADER START-->&#13;
	<div class="fixed_wrap singlefx">&#13;
		<?php if(($asteria['page_type_id']) == '1'){ ?>&#13;
            <div class="page_tt">&#13;
                <div class="center"><h1 class="postitle"><?php the_title(); ?></h1></div>&#13;
            </div> &#13;
        <?php } ?>&#13;
<!--BIG PAGE HEADER END-->&#13;
&#13;
<div class="lay4">&#13;
<div class="center">&#13;
&#13;
<div class="lay4_wrap&lt;?php if ( !is_active_sidebar( 'sidebar' ) ) { ?&gt; no_sidebar&lt;?php } ?&gt;">&#13;
<div class="lay4_inner">&#13;
<?php $args = array(
				   'post_type' => 'post',&#13;
				   'cat' =&gt; ''.$asteria['blog_cat_id'].'',&#13;
				   'paged' =&gt; ( get_query_var('paged') ? get_query_var('paged') : 1),&#13;
				   'posts_per_page' =&gt; '6');&#13;
	$the_query = new WP_Query( $args );&#13;
 ?&gt;&#13;
                <?php while ( $the_query->have_posts() ) : $the_query-&gt;the_post(); ?&gt;&#13;
                <div post_class> id="post-<?php the_ID(); ?>"&gt; &#13;
&#13;
                <?php global $wp_query; $postid = $wp_query->post-&gt;ID; $astvidthumb = get_post_meta( $postid, 'ast_videolink', true ); ?&gt;&#13;
                <?php if ( ! empty ( $astvidthumb ) ) { ?>&#13;
                 <div class="imgwrap">&#13;
				<!--VIDEO THUMBNAIL--> &#13;
                <?php $astvidthumb =str_replace('https://www.youtube.com/watch?v=', '//www.youtube.com/embed/', $astvidthumb);?>                    &#13;
               <div class="ast_vid"><div class="responsive-container"><iframe src="&lt;?php%20echo%20%24astvidthumb;%20?&gt;?rel=0&amp;autohide=1&amp;showinfo=0"></iframe></div></div>&#13;
&#13;
 				</div>              &#13;
               <?php } else { ?> &#13;
            &#13;
                <div class="post_image">&#13;
                     <!--CALL TO POST IMAGE-->&#13;
                    <?php if ( has_post_thumbnail() ) : ?>&#13;
                    <div class="imgwrap">&#13;
                    <a href="&lt;?php%20the_permalink();?&gt;"><?php the_post_thumbnail('medium'); ?></a></div>&#13;
                    &#13;
                    <?php elseif($photo = asteria_get_images('numberposts=1', true)): ?>&#13;
    &#13;
                    <div class="imgwrap">&#13;
                	<a href="&lt;?php%20the_permalink();?&gt;"><?php echo wp_get_attachment_image($photo[0]->ID ,'medium'); ?&gt;</a></div>&#13;
                &#13;
                    <?php else : ?>&#13;
                    &#13;
                    <div class="imgwrap">&#13;
                    <a href="&lt;?php%20the_permalink();?&gt;"><img src="&lt;?php%20echo%20get_template_directory_uri();%20?&gt;/images/blank_img.png" alt="&lt;?php the_title_attribute(); ?&gt;" class="asteria_thumbnail"></a></div>   &#13;
                             &#13;
                    <?php endif; ?>&#13;
                </div>&#13;
                					<?php } ?>&#13;
                &#13;
                <div class="post_content">&#13;
                    <h2 class="postitle"><a href="&lt;?php%20the_permalink();?&gt;" title="&lt;?php the_title_attribute(); ?&gt;"><?php the_title(); ?></a></h2>&#13;
                    <!--POST INFO START-->&#13;
                    <div class="single_metainfo">&#13;
                    <i class="fa-calendar"></i><a class="comm_date"><?php the_time( get_option('date_format') ); ?></a>&#13;
                    <i class="fa-user"></i><a class="meta_auth"><?php the_author(); ?></a>&#13;
                    <i class="fa-comments"></i><?php if (!empty($post->post_password)) { ?&gt;&#13;
                <?php } else { ?><div class="meta_comm"><?php comments_popup_link( __('0 Comment', 'asteria'), __('1 Comment', 'asteria'), __('% Comments', 'asteria'), '', __('Off' , 'asteria')); ?></div><?php } ?>&#13;
                &#13;
                  <i class="fa-th-list"></i><div class="catag_list"><?php the_category(', '); ?></div>&#13;
                    </div>&#13;
                    <!--POST INFO END-->&#13;
                    &#13;
                    <!--POST CONTENT START-->&#13;
                    <?php the_excerpt(); ?> &#13;
                    <!--POST CONTENT END-->&#13;
                </div>&#13;
                &#13;
                        </div>&#13;
            <?php endwhile ?> &#13;
 		<?php wp_reset_postdata(); ?>&#13;
</div>&#13;
&#13;
<!--PAGINATION START-->&#13;
<div class="ast_pagenav">&#13;
	<?php global $wp_query;
        $big = 999999999; // need an unlikely integer
            echo paginate_links( array(
                'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),&#13;
                'format' =&gt; '?paged=%#%',&#13;
                'current' =&gt; max( 1, get_query_var('paged') ),&#13;
                'total' =&gt; $wp_query-&gt;max_num_pages,&#13;
                'show_all'     =&gt; true,&#13;
                'prev_next'    =&gt; false&#13;
            &#13;
            ) );&#13;
    ?&gt;&#13;
</div>&#13;
<!--PAGINATION END-->&#13;
&#13;
</div>&#13;
<!--SIDEBAR START-->&#13;
  <?php if ( is_active_sidebar( 'sidebar' ) ) { ?><?php get_sidebar();?><?php } ?>&#13;
<!--SIDEBAR END-->&#13;
    </div>&#13;
	</div>&#13;
</div>&#13;
</div>    &#13;
<?php get_footer(); ?>