wp_list_categories pagination

I was wondering if I can paginate wp_list_categories? I had a go with paginate_links but no luck. Or is there a good workaround? Thank you!!

<?php   $orderby = 'name';
    $show_count = 0;
    $pad_counts = 0;
    $hierarchical = 1;
    $taxonomy = 'categories';
    $title = '';
    $exclude = '16';

    $args = array(
    'orderby' => $orderby,
    'show_count' => $show_count,
    'pad_counts' => $pad_counts,
    'hierarchical' => $hierarchical,
    'taxonomy' => $taxonomy,
    'title_li' => $title,
    'exclude' => $exclude,
    'hide_empty' => 0
    );
    ?>
    <ul class="resourcelist">
    <?php wp_list_categories($args); ?>
    </ul> 

Related posts

Leave a Reply

1 comment

  1. OK, after no luck with wp_list_categories, I resorted to get_categories to get the pagination working. I hope this helps someone.

    <?php
        $args = array(
                'taxonomy' => 'categories',
                'orderby' => 'term_group',
                'hide_empty' => 0,
                'hierarchical' => 1,
                'exclude' => '16',
                'parent' => '0',
        );
        $categories = get_categories($args);
        $numOfItems = 60;
        $page = isset( $_GET['cpage'] ) ? abs( (int) $_GET['cpage'] ) : 1;
        $to = $page * $numOfItems;
        $current = $to - $numOfItems;
        $total = sizeof($categories);
    
                echo '<ul class="content">';
    
        for ($i=$current; $i<$to; ++$i) {
    
            $category = $categories[$i];
    
            if ($category->name) { echo '<li><a href="' . get_term_link($category->slug, 'categories') . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>' . $category->name.'</a></li>';}
    
        }
    
                echo '</ul>';
    
        unset($category);
        echo paginate_links( array(
            'base' => add_query_arg( 'cpage', '%#%' ),
            'format' => '',
            'prev_text' => __('&laquo;'),
            'next_text' => __('&raquo;'),
            'total' => ceil($total / $numOfItems),
            'current' => $page
        ));
    
        ?>