Skip to main content
added 304 characters in body
Source Link
user1632018
  • 484
  • 3
  • 10
  • 26

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' ) ); ?>
 
            

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>

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' ) ); ?>
 
            
edited tags
Link
EAMann
  • 32.2k
  • 9
  • 88
  • 147
Source Link
user1632018
  • 484
  • 3
  • 10
  • 26

Does wordpress add their own classes into nav menus?

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>