Support » Themes and Templates » Hide categories children via css

  • Resolved infected



    My problem: I would like to display some categories and it´s children. No problem so far. I use this code for displaying categories in my sidebar:

    <?php wp_list_categories('hide_empty=0&title_li=<h2>Abteilungen</h2>'); ?>

    Now i tried to hide all childrens and make them visible after parent is clicked. This is working fine. Here´s the css:

    ul.children { display: none; }
    li.current-cat ul.children{display: block;}

    The problem: If i then click on a child categorie all childrens are hidden again. Is it possible to avoid this? I want to show all the childs as long as i am in a childs-category. Is it possible to do this without javascript?

    Thanks in advance!

Viewing 1 replies (of 1 total)
  • Could fix it. It works with

    ul.children { display: none; }
    li.current-cat ul.children, li.current-cat-parent ul.children{display: block;}

Viewing 1 replies (of 1 total)
  • The topic ‘Hide categories children via css’ is closed to new replies.