• I’m converting a static html template to a WordPress one & I’ve got a problem with the nav menu that is driving me bananas – This is the first time I’ve attempted a template although I’ve been programming for a long time but PHP & CSS aren’t one of my strengths

    The template renders it’s menu’s like so

    <ul id="menu">
            <li class="act"><a href="index.html">Home</a></li>
            <li><a href="index-1.html">Services</a></li>
            <li><a href="index-2.html">Choose a Plan</a></li>
            <li><a href="index-3.html">Gallery</a></li>
    
            <li><a href="index-4.html">Custom Homes</a></li>
            <li><a href="index-5.html">Renovations & Additions</a></li>
            <li><a href="index-6.html">Contacts</a></li>
          </ul>

    I’m using wp_nav_menu & I’m trying to replicate the flat coding so when the nav menu renders it can pick up the same CSS as the original template file so I used ‘container’ => ‘false’ (& tried ‘container’ => ”) to stop WordPress wrapping a div around the menu block but it doesn’t seem to work all I get out no matter what I do is this:

    <div class="menu"><ul><li class="current_page_item"><a href="https://localhost/wordpress/" title="Home">Home</a></li><li class="page_item page-item-5"><a href="https://localhost/wordpress/?page_id=5" title="Services">Services</a></li></ul></div>

    It’s driving me nuts & I’ve looked closely at the API & as far as I can tell I’m doing the right thing but it just doesn’t seem to work – can anyone offer any clues please

    I’m using twentyten as a reference so I’ve got

    // This theme uses wp_nav_menu() in one location.
    	register_nav_menus( array(
    		'primary-menu' => __( 'Primary Menu' ),
    	) );

    In functions.php as well as trying

    function builder_page_menu_args( $args ) {
    	$args['show_home'] = true;
    	$args['container'] = false;
    	return $args;
    }
    add_filter( 'wp_page_menu_args', 'builder_page_menu_args' );

    with just

    `<?php wp_nav_menu(); ?>’

    It does render my menu but I get it in a vertical list without any styling rather than a horizontal one with the correct font

  • The topic ‘Menu problems’ is closed to new replies.