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.

I want to remove the <ul> tags from the wp_nav_menu. I already found different posts about it here but they don´t seem to work for me. Here is what I did:

First I registered the menu in functions.php:

add_action('init', 'register_custom_menu');

function register_custom_menu() {
    register_nav_menu('main-navi', __('Main-Navi'));
}

Then I created the menu in the Wordpress backend.

After that I put following code into my header.php :

<?php $args = array(
    'menu' => 'main-navi',
    'items_wrap' => '%3$s',
    'container' => false );
?>
<?php wp_nav_menu($args); ?>

But the output is still the following:

<ul id="menu-main-navi">
    <li id="menu-item-5" class="menu-item menu-item-type-custom menu-item-object-custom current-menu-item current_page_item menu-item-home menu-item-5">
       <a href="http://fruchtkiste.eu/blog.leitblick-wp">Blog</a>
    </li>
    <li id="menu-item-4" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-4">
       <a href="http://fruchtkiste.eu/blog.leitblick-wp/?page_id=2">Leistungen</a>
    </li>
</ul>
share|improve this question
1  
It's working for me. If there isn't an ul-tag in your template file, it could be that your theme or a plugin filters wp_nav_menu. Add remove_all_filters('wp_nav_menu', 99); in your functions.php to remove any existing filter hook and test again. –  rofflox Jul 16 '12 at 10:44
    
I checked for plugin filters and also tried to add the filter-removal line but it doesn´t seem to work :/ I´ll just keep trying around until someone maybe has THE answer :) –  Jannik Ruf Jul 16 '12 at 10:51
    
Okay I´ve made a mistake. I didn´t tell the menu to be displayed in the 'main-navi' but it still doesn´t work. –  Jannik Ruf Jul 16 '12 at 10:55

2 Answers 2

Since it didn't work any other way, I used jQuery to unwrap the menu.

I put in $('li.menu-item').unwrap(); and everything worked fine.

share|improve this answer
<?php wp_nav_menu( array( 'items_wrap' => '%3$s' ) ); ?>

Source http://codex.wordpress.org/Function_Reference/wp_nav_menu#Removing_the_ul_wrap

share|improve this answer

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.