0

I have a code snippet like this one,

<div class="container">
            <ul id="menu">
                <li>
                    <a>
                        <i class="icon_about"></i>
                        <span class="title">Home</span>
                        <span class="description">Any Description Here Manual/Auto</span>
                    </a>
                </li>
            </ul>
</div>

And Im getting the list of menu items from this php code

<?php wp_nav_menu('menu=header_menu&container=false'); ?>

But the resultant of that cod is somehow like this,

<div class="menu">
    <ul>
        <li class="page_item page-item-14">
            <a href="My_Link"> Home </a>
        </li>
    </ul>
</div>

So, what im missing here is the id="container" inside the tag and after the anchor tag the . I dont really know how to put those I have a reference

http://codex.wordpress.org/Function_Reference/wp_nav_menu

But the thing is I still cant understand as to how to add what the things Im missing from the snippet.

1

You will not be able to create this kind of markup simply using wp_nav_menu function . Either change your markup or use the Custom Walker Function that will allow you to create anykind of markup.

  • thank you for the reply, and I have checked the Walker Function and it just let me add's custom class/id into <ul> and <li> if im not wrong here, and it doesnt let me at a tag inside the anchor tag. – rockStar Sep 16 '13 at 12:43
  • You are welcome . That is an example of how to use it . "The easiest way to build a new walker function is to copy the default class (Walker_Nav_Menu)[phpdoc.wordpress.org/trunk/WordPress/Nav_Menus/… from \wp-includes\nav-menu-template.php and simply customize what you need." – Tolea Bivol Sep 17 '13 at 9:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.