The stadard wp_list_categories() functions echoes a list of all your categories. With this simple trick we can display the categories in two columns. This code is easy to implemented and doesn’t need high level skill to add on our theme. Just paste this code on your theme file and you are ready to split your wp_list_categories()
[sourcecode language=’php’]
< ?php
$cats = explode("
“,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.'
elseif ($i>=$cat_n/2):
$cat_right = $cat_right.’
‘;
endif;
endfor;
?>
-
< ?php echo $cat_left;?>
-
< ?php echo $cat_right;?>
[/sourcecode]
After you copy this code and save it. Thanks to Blog Oh Blog and WP Recipes that share this tricks
Leave a Comment