I am building a theme and have noticed that when I create a menu with just html or have it dynamically add menu items based on pages it looks how it was meant to be. Although when I change the code to generate the menu from the menu editor it adds alot of extra padding to the menu.
Is this a wordpress issue? Has anyone heard of this before? Here is an example.
When I generate a menu using the menu editor it adds padding:
<div class="header">
<div class="nav">
<ul>
<li>
<?php wp_nav_menu( array( 'theme_location' => 'primary' ) ); ?>
</li>
</ul>
When I generate a menu through just hardcoding HTML it looks fine:
<div class="header">
<div class="nav">
<ul>
<li><a href="#home">Home</a></li>
<li><a href="#about">About</a></li>
<li><a href="#portfolio">Portfolio</a></li>
<li><a href="#support">Support</a></li>
</ul>
Problem has been solved. I removed both the <ul>
and <li>
tags and the navigation is in it's proper location.
<div class="header">
<div class="nav">
<?php wp_nav_menu( array( 'theme_location' => 'primary' ) ); ?>
wp_nav_menu
generates a full unordered list - having it within<li>
tags like your first block of code would mean the generated menu is a list-within-a-list, which may explain the padding...