How To Display your categories in two columns

display-categories-in-two-columns

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.'

  • ‘.$cats[$i].”;
    elseif ($i>=$cat_n/2):
    $cat_right = $cat_right.’

  • ‘.$cats[$i].’
  • ‘;
    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

    0

    10 Comments

    1. […] How To Display your categories in two columns JAUHARI Posted by root 2 hours 4 minutes ago (http://www.jauhari.net) With this simple trick we can display the categories in two columns 1 comments add yours the upper is the most recent comment wireless accessories middot compression garments middot banner stands middot home loans middot banner stands middot bedroom sets Discuss  |  Bury |  News | How To Display your categories in two columns JAUHARI […]

    Tinggalkan Balasan

    Alamat email Anda tidak akan dipublikasikan.

    Situs ini menggunakan Akismet untuk mengurangi spam. Pelajari bagaimana data komentar Anda diproses.