Am looking for a way to implement pagination on my categories I tried to use paginated_links();
functions but it works only for posts, and not the actual categories. I have looked around and it seems this is a little trickier than I was expecting…
$cats = get_categories(
array('parent' => $cat->cat_ID)
);
// loop through the categries
foreach ($cats as $cat) {
echo '<div class="card">';
// setup the cateogory ID
$cat_id= $cat->term_id;
echo '<div class="card-body">';
// make images for the category
echo '<div class="card-title"><a href="' . get_category_link($cat->term_id) . '">' . $cat->name . '</a> <i class="fas fa-arrow-right"></i></div>';
echo '</div>';
// create a custom wordpress query
query_posts("cat=$cat_id&posts_per_page=3");
if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php echo '<div class="blog-list-points">' ?>
<?php // create our link now that the post is setup ?>
<a href="<?php the_title();?>">
<?php the_excerpt(); ?>
<hr>
</a>
<?php echo '</div>'?>
<?php endwhile; endif; echo ' </div> '// done our wordpress loop. Will start again for each category ?>
<?php }
// done the foreach statement ?>