WordPress.org

Ready to get started?Download WordPress

Forums

Show child of parent category after click in menu (2 posts)

  1. artshowapplepie
    Member
    Posted 2 years ago #

    Hi

    I'm fairly new to this so i'll try to be as specific as I can be.

    I have a problem with my categories in my header menu (using the imbalance theme).
    I want to have my child categories visible after clicking one of the parent categories but I don't know how to fix this.

    I tried to change the depth (see code below) but this shows all child categories without clicking the parent, and screws up my 'dropdown' menu.

    Code in my header.php :

    <div id="categories">
                <ul class="mcol2">
              <?php
                        $data = wp_list_categories('show_count=1&exclude=1&echo=0&title_li=&depth=1&hide_empty=0&orderby=ID');
                        $data = preg_replace('/\<\/a\> \((.*)\)/',' <span>$1</span></a>',$data);
                        echo $data;
                      ?>
                </ul>
            </div>

    Here 2 screenshots of what the menu normally looks like after clicking 'videos', and what happens when i change depth=1 to depth=2..

    Header normal

    Header after depth changed to 2

    Again i would just like to click on videos, which opens the categories and after clicking on a parent it should open the child categories.

    Hope someone can help as I've been trying for the last 3 days haha

  2. artshowapplepie
    Member
    Posted 2 years ago #

    After changing depth

    Sorry double image in previous post

Topic Closed

This topic has been closed to new replies.

About this Topic