WordPress.org

Ready to get started?Download WordPress

Forums

List categories with alphabetical headings (2 posts)

  1. Ruriko
    Member
    Posted 4 years ago #

    I found a code to list my categories in 2 columns but now I want it to show the alphabetical headings for example http://www.zomganime.com/anime-series-list/. So does anyone know how? don't say use a plugin because I'm trying to use less plugins to save performance.

    <?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>
  2. mskogly
    Member
    Posted 3 years ago #

    It seems you have been able to solve this, can you tell me how you did it?

    I'm looking for a way do to something similar, but with an addition of norwegian characters.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.