• Hi,

    I would like to add a class to my <li> in my wp_list_categories.
    Any ideas how to do this???

    Google found this piece of code:

    <?php
    $variable = wp_list_categories('title_li=&exclude=22,1,5&depth=2&orderby=order&current_category='.$myCat);
    $variable = str_replace(array('<li'), '<li class="mr7"', $variable);
    echo $variable;
    ?>

    It gives me the categories, but for some reason doesn’t add the class to my lis.

    Please help!
    Thanks, Karina

Viewing 1 replies (of 1 total)
  • Thread Starter cgoldt

    (@cgoldt)

    So I just found a solution, that works perfect for me.
    wp_list_categories adds by default a specific class to every li. In my case cat-item-3 and cat-item-4.

    So I just edited those classes in my css file.

Viewing 1 replies (of 1 total)
  • The topic ‘Add class to in wp_list_categories’ is closed to new replies.