to display posts category wise you just need to add this code. or to extend the filtration u just need to add additional parameters in $args array.
<?php
// make query fileration
$args = array(
‘posts_per_page’ => 20,
‘paged’ => $paged,
‘cat’ => $cat_id,
);
$wp_query = new WP_Query($args);
$i = 0;
if ( $wp_query->have_posts() ) while ($wp_query->have_posts()) : $wp_query->the_post();
$pop_img = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID) );
?>
<li style=” <?php echo ($i%4==0)?”clear:both;”:””; ?> “> ” class=”img”><img src=”<?php echo $pop_img[0]; ?>” alt=”” />
<h5>“><?php echo substr(get_the_title($post->ID),0,20); ?></h5>
<?php
$i++;
endwhile;
?>
<?php
// for pagination just need to call this function and it will create complete pagination
theme_pagination($wp_query->max_num_pages); ?>
get the theme_pagination function code from here https://www.php-mastermind.com and put in your theme functions.php file. it should work now.
Note*- do it on your own risk.