[resolved] Hide categories children via css (2 posts)

  1. infected
    Posted 5 years ago #


    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!

  2. infected
    Posted 5 years ago #

    Could fix it. It works with

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

Topic Closed

This topic has been closed to new replies.

About this Topic