Taxonomy Categories in Multiple Columns
-
I have tried a bunch of solutions and mostly have it working using this code:
<div class="category_widget_container"> <?php $categories = wp_list_categories( $args ); if( count( $categories ) > 0 ) { $new_array = partition( $categories, 3 ); if( $new_array ) { foreach( $new_array as $top_index ) { if( is_array( $top_index ) ) { echo '<ul>'; foreach( $top_index as $cats ) { printf( '<li><a href="%s">%s</a></li>', get_term_link( $cats->slug, 'eventcategory' ), $cats->name ); } echo '</ul>'; } } } } ?></div>
CSS:
.category_widget_container{ width: 100%; } .category_widget_container ul { float: left; width: 185px; margin-right: 5px; }
But the formatting is all messed up. Not sure how to fix it. Can anyone help?
- The topic ‘Taxonomy Categories in Multiple Columns’ is closed to new replies.