How to add pagination to custom category template?
-
I have a custom category template which displays the current categories child categories instead of posts. I would like to add numbered pagination to the template for categories with a large number of child categories.
Here are the pagination variables and code I’m using to get the child categories:
<?php $catpage = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1; $catnum = 5; $offset = ($catnum * $catpage) - 5; $cat = get_category( get_query_var( 'cat' ) ); $cat_id = $cat->cat_ID; $child_categories=get_categories( array( 'parent' => $cat_id, 'orderby' => 'id', 'order' => 'DESC', 'hide_empty' => '0', 'number' => $catnum, 'offset' => $offset, 'posts_per_page' => 5, 'paged' => $catpage ) );
This displays 5 child categories. Now how do I actually add the numbered pagination links to the page?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘How to add pagination to custom category template?’ is closed to new replies.