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
Lagi belajar banyak tentang WP… akhirnya blog jauhari.net bisa jadi blog rujukan yang paling tepat nie..
nice tutor..
But what about get a theme with two columns? I did not get for what to do that…
preety nice tweak
Thank you
$cat_left = $cat_left.'<li>'.$cats[$i].'';
???
$cat_left = $cat_left.'<li>'.$cats[$i].'</li>';
thank you this blog very nice
Thank you, thank you, thank you! Coding is still so complicated sometimes.