wordpress get_categories into columns

I am trying to get 5 wordpress categories to display a certian way. I have images attached to each category via a plugin

Here Is How I need it to be displayed.

Read More

[category] [blank] [category]

[blank] [category] [blank]

[category] [blank] [category]

I have the following code to display into columns

 $get_cats = wp_list_categories( 'echo=0&title_li=&depth=1&include=16,15,17,18,20' );
     $cat_array = explode('</li>',$get_cats);
     $results_total = count($cat_array);
     $cats_per_list = ceil($results_total / 3);
     $list_number = 0;
     $result_number = 0;
<ul class="category_footer_post" id="cat-col-<?php echo $list_number; ?>">

<?php
    foreach($cat_array as $category) {
    $result_number++;

    if($result_number % $cats_per_list == 0) {
    $list_number++;
    echo $category.'</li>
    </ul>

    <ul class="category_footer_post" id="cat-col-'.$list_number.'">';
 }

else {
    echo $category.'</li>';
    }
} ?>
</ul>

What else can I do to make this work?

Related posts

Leave a Reply