Forums

Customizing HTML output of WordPress Menus? (1 post)

  1. Icarurs
    Member
    Posted 5 months ago #

    Hello, I would like a little bit of guidance on how to customize the output of WordPress menus. The basic menu output with sub menus looks something like this:

    <ul id="menu-main">
        <li><a href="#">Home</a></li>
        <li><a href="#">About</a></li>
            <ul class="sub-menu">
                <li><a href="#">Other</a></li>
            </ul>
        <li><a href="#">Contact</a></li>
        <li><a href="#">Blog</a></li>
    </ul>

    However, I would like to customize it so that my menu is outputted like this:

    <ul class="nav">
        <li class="active">
            <a href="#">Home</a>
        </li>
        <li>
            <a href="#">About</a>
        </li>
        <li class="dropdown" data-dropdown="dropdown">
            <a class="dropdown-toggle" href="#">Dropdown</a>
                <ul class="dropdown-menu">
                    <li><a href="#">Testing</a></li>
                    <li><a href="#">Testing</a></li>
                    <li class="divider"></li>
                    <li><a href="#">Another link</a></li>
                </ul>
        </li>
    </ul>

    I've looked up a couple of guides online but none of them explained how to customize the output of submenus like how I wanted them. Is this possible?

Reply

You must log in to post.

About this Topic