-1

i'm new to creating wordpress themes and want a menu at the Top of my page. I do have the following: Header.php

<html>
<head>
<title>Tutorial theme</title>
<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>">
</head>
<body>
<div id="wrapper">
<?php wp_nav_menu( array('menu' =>'Top Navi', 'container' => '', 'items_wrap'  => '<ul id="menu-primary" class="menu" >%3$s</ul>'  ) ); ?>
<div id="header">
 </div>

functions.php

<?php
add_theme_support( 'menus' );
if (function_exists('register_nav_menus')) {
register_nav_menus(
    array(
        'main_nav' => 'Main Navigation Menu'
        )
    );
}
?>

And finally my css file http://pastebin.com/Pjr3THJm

However my menu comes out in a list, not horizontally. What am i doing wrong?

  • 1
    This is a CSS-specific question, not a WordPress question. (Side note: use theme_location rather than menu in your wp_nav_menu() call.) – Chip Bennett Mar 11 '13 at 15:06
  • @ChipBennett Sorry about that then, was not aware it was an css specific issue – Stingervz Mar 11 '13 at 15:08
3

In my opinion, this is a CSS-only question.

You have to provide the <li> elements in your menu with the CSS style display: inline; (or 'inline-block').

  • I have no idea how to access the <li> elements as far as i can see i can only get to the <ul> element – Stingervz Mar 11 '13 at 15:11
  • Found it! had to add #menu-primary li { display: inline; } to my css file. Thanks! – Stingervz Mar 11 '13 at 15:16

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.