Press enter to see results or esc to cancel.

Wanna buy Bitcoin, and start winning? Just click for join >

Break Categories to Columns in WordPress

Normally the category list is single column. But you can use this trick to split two columns.

Firstly, find

<?php wp_list_categories(); ?>

Then replace this code like here :

<?php
$cats = explode("<br />",wp_list_categories('title_li=&echo=0&depth=1&style=none'));
$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>

After changing this you can stylize your columns with css file (style.css)

.right {float:left; width:140px;}
.left {float:left; width:140px;}
Comments

Comments are disabled for this post