<?php
// PAGINATION CODE
$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
$mainarray = array(
'post_type' => array('post'),
'post_status' => array('publish'),
'orderby' => 'date',
'order' => 'DESC',
'posts_per_page' => 6,
'paged' => $paged,
);
$q = new WP_Query($mainarray);
?>
<div class="row custom-blog-main-wrapper">
<?php while ($q->have_posts()) : $q->the_post(); ?>
<div class="col-md-4 col-sm-6">
<div class="blog-news-wrapper">
<div class="blog-image">
<a href="<?php the_permalink(); ?>">
<?php if (has_post_thumbnail()):
$thumbnail = wp_get_attachment_image_src(get_post_thumbnail_id(),'large', true);
?>
<img src="<?php echo $thumbnail[0]; ?>" alt="Picture" class="featured-image">
<?php else: ?>
<img src="<?php echo site_url('PATH'); ?>" alt="Picture" class="featured-image">
<?php endif; ?>
</a>
</div>
<div class="blog-content">
<p class="blog-date">
<?php echo get_the_date('M d Y'); ?>
</p>
<h3 class="blog-title">
<a href="<?php the_permalink(); ?>">
<?php the_title(); ?>
</a>
</h3>
<div class="blog-inner">
<p class="blog-text">
<?php if(!empty(get_the_excerpt())){
echo strip_tags(substr(get_the_excerpt(), 0, 200));
}
else{