<div class="blog">
<?php
$args = array(
'post_type' => 'our-blog',
'posts_per_page' => 8
);
$the_query = new WP_Query( $args );
?>
<?php if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
<?php
if( get_field('blog-size') == 'small' ) {
?>
<a href="<?php echo get_post_permalink($post->ID) ?>" class="blog__item">
<div class="blog__img">
<img src="<?php the_field('blog-img', $post->ID);?>">
<div class="blog__back"></div>
</div>
<div class="blog__title"><?php the_title() ?></div>
<div class="blog__txt"><?php the_content() ?></div>
</a>
<?php
}
elseif( get_field('blog-size') == 'big' ) {
?>
<a href="<?php echo get_post_permalink($post->ID) ?>" class="blog__item blog__item-big">
<div class="blog__img">
<img src="<?php the_field('blog-img', $post->ID);?>">
<div class="blog__back"></div>
</div>
<div class="bl">
<div class="blog__title"><?php the_title() ?></div>
<div class="blog__txt"><?php the_content() ?></div>
</div>
</a>
<?php
}
?>
<?php endwhile;
else: ?> Nothing here <?php endif; ?>
<?php wp_reset_query(); ?>
</div>
<?php
$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
$args = array(
'post_type' => 'custom_post_type_name',
'posts_per_page' => 10,
'paged' => $paged
);
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
// CPT content
endwhile;
?>
<div class="pagination">
<?php
$big = 999999999;
echo paginate_links( array(
'base' => str_replace( $big, '%#%', get_pagenum_link( $big ) ),
'format' => '?paged=%#%',
'current' => max( 1, get_query_var('paged') ),
'total' => $loop->max_num_pages,
'prev_text' => '«',
'next_text' => '»'
) );
?>
</div>
<?php wp_reset_postdata(); ?>
<?php the_posts_pagination(); ?>