Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

all

       As per my html theme structure i do not want to add my menu <ul><li> under <div>.

I am using

 <?php wp_nav_menu( array( 'menu_class' => 'tlm', 'theme_location' => 'primary-menu' ) ); ?>

By default this wrap my menu with div. like

<div class="menu-first-container"><ul class="tlm" id="menu-first"><li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-23" id="menu-item-23"><a href="http://localhost/tmw_new/">Dashboard</a></li>
<li class="hasul menu-item menu-item-type-custom menu-item-object-custom current-menu-ancestor current-menu-parent menu-item-58" id="menu-item-58"><a href="#">Patients</a>
<ul class="sub-menu">
    <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-27" id="menu-item-27"><a href="http://localhost/tmw_new/?page_id=25">Patients</a></li>
    <li class="menu-item menu-item-type-post_type menu-item-object-page current-menu-item page_item page-item-55 current_page_item menu-item-57" id="menu-item-57"><a href="http://localhost/tmw_new/?page_id=55">Add Patients</a></li>
    <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-62" id="menu-item-62"><a href="http://localhost/tmw_new/?page_id=60">Calender</a></li>
    <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-66" id="menu-item-66"><a href="http://localhost/tmw_new/?page_id=64">Images</a></li>
</ul>
</li>
<li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-67" id="menu-item-67"><a href="http://google.com">Support</a></li>
<li class="menu-item menu-item-type-custom menu-item-object-custom menu-item-68" id="menu-item-68"><a href="#">Logout</a></li>
</ul></div>

How to remove div container in custom menu ? as i can think there may be need some change in wp_nav_menu() function array.

share|improve this question

2 Answers 2

up vote 1 down vote accepted

Set the container to be empty. :)

wp_nav_menu( array(
    'menu_class' => 'tlm',
    'theme_location' => 'primary-menu',
    'container' => ''
) );

Please refer to the function reference to review all the arguments that you can pass to wp_nav_menu().

share|improve this answer

You can use the parameter to remove the div container

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

there is a "container" class to change main container. you can change it to anything or put '' null to remove the container.

share|improve this answer
    
sorry its my fault that i am not defining 'container' => '' it. Without define this blank its take automatically div and its id. BTW thanks –  Ajay Patel Feb 1 '12 at 13:14
    
one more think if u can help me ... as you can see li tag <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-27" id="menu-item-27"><a href="localhost/tmw_new/?page_id=25">Patients</a></…; i want to make it like <li class="menu-item menu-item-type-post_type menu-item-object-page menu-item-27" id="menu-item-27"><a href="localhost/tmw_new/?page_id=25"><span>Patients</…; (<span>) –  Ajay Patel Feb 1 '12 at 13:26
    
did it using 'link_before' => , 'link_after' => , –  Ajay Patel Feb 1 '12 at 13:33

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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