• Resolved gufyduck

    (@gufyduck)


    I’m hoping someone can help me with this. I’ve spent a few hours on google and am still coming up blank.

    I am creating a custom for our school’s web page where each menu button and the drop down associated with it are unique colors. I have a html prototype here.

    I am trying assign each of the parent <li> and the entire child

      to a css class (the only css code for menu1, menu2, etc. is only color).

    <ul id="menu">
            <li class="menu1"><a href="#">Administration</a>
                	<ul class="children menu1">
                      <li><a href="#">Subitem 1</a></li>
                      <li><a href="#">Subitem 2</a></li>
                      <li><a href="#">Subitem 3</a></li>
                    </ul>
            </li>
            <li class="menu2"><a href="#">Schools</a>
                	<ul class="menu2 children">
                      <li><a href="#">Subitem 1</a></li>
                      <li><a href="#">Subitem 2</a></li>
                      <li><a href="#">Subitem 3</a></li>
                    </ul>
            </li>

    I know how to control the li classes through a custom walker class but am completely stuck on adding the <ul class="menu1">.

    Thanks in advance for any help!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Why not let WordPress core create the menu via wp_nav_menu()? That way, each li – include the dropdown parents – would have an unique id.

    Thread Starter gufyduck

    (@gufyduck)

    The problem is getting the child <ul> to have the class. I went back to my CSS and was able to add some nested calls to accomplish this. Thanks for the idea though!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Assigning a class to children’ is closed to new replies.