• I’m adding a custom menu in my header. The new fuction in WP 3.0 that lets admins add a custom menu to the theme.

    (wp_nav_menu)

    The code I add works fine when I create a menu in the dashboard, but when I remove the menu it showes the default setup with a container etc. How can I make this a list-style?

    here is my code:

    <?php wp_nav_menu( array( 'container' => '', 'depth=1&title_li=','menu_id' => 'navmenu-h' , 'theme_location' => 'primary' ) ); ?>

    The code above gives this result when I have added a custom menu in the dashboard:

    <li id="menu-item-195" class="menu-item menu-item-type-custom current-menu-item current_page_item menu-item-home menu-item-195"><a href="http://comain.com/">Home</a></li> 
    
    <li id="menu-item-196" class="menu-item menu-item-type-post_type menu-item-196"><a href="http://domain.com/?page_id=72">Guestbook</a></li> 
    
    <li id="menu-item-197" class="menu-item menu-item-type-post_type menu-item-197"><a href="http://domain.com/?page_id=174">Testpage</a></li>

    When I delete the custom menu from the dashboard it gives me a defaul output like this:

    <div class="menu">
    <ul>
    <li class="page_item page-item-72"><a href="http://domain.com/?page_id=72" title="Hyttebok">Guestbook</a></li>
    
    <li class="page_item page-item-174"><a href="http://domain.com/?page_id=174" title="testpage1">Testpage</a></li>
    </ul>
    </div>

    My main wish is to not show anything if the admin havent created a menu. easy: if menu = show menu – else = dont show anything.

    Anyone know how to solve this? I have tryed to use the ‘fallback_cb’ but it diesnt seem to react like it should

  • The topic ‘if / else custom menu in 3.0’ is closed to new replies.