How to Dispaly Wordpress Categories in Two Columns
Posted by a_usman on Jun 14 2009 in Blogspot, How To, Internet, Tips and Tutorials, Windows | 0 comments

If you have such a wordpress theme which have a wide sidebar, and you want to dispaly the categories in two columns, then this hack is perfect for you.
The stadard wp_list_categories() functions echoes a list of all your categories in one column or row but using the below mentioned code in your theme, you can generate the wordpress categories in two rows.
Open the sidebar.php file of your theme and place this code in it at appropriate place:
<?php
$cats = explode("<br />",wp_list_categories(''));
$cat_n = count($cats) - 1;
for ($i=0;$i<$cat_n;$i++):
if ($i<$cat_n/2):
$cat_left = $cat_left.'<li>'.$cats[$i].'</li>';
elseif ($i>=$cat_n/2):
$cat_right = $cat_right.'<li>'.$cats[$i].'</li>';
endif;
endfor;
?>
<ul class="left">
<?php echo $cat_left;?>
</ul>
<ul class="right">
<?php echo $cat_right;?>
</ul>
via Blog oh Blog