PHP Code Custom Footer

1 replies
Hi
It's late and im brain dead...

Created a new menu and used this code to display the menu in sites footer:
<?php wp_nav_menu( array('menu' => 'Sub Menu' )); ?>

The menu displays fine but it's aligned verticaly, how do i get it to align horizontaly :confused:

Thanks
#code #custom #footer #php
  • Profile picture of the author Nathan K
    When you call the 'wp_nav_menu( array('menu' => 'Sub Menu' ))', it will output something like this (there will be values in the class and id attributes).

    Code:
    <div class="">
       <ul id="" class="">
         <li id="" class=""><a href="">Link 1</a></li>
         <li id="" class=""><a href="">Link 2</a></li>
       </ul>
    </div>
    What you have to do is assign a class to the div that will align the list items horizontally. To achieve this add 'container_class' to the array and set its value to the css class name for eg: 'sub_menu'.

    Code:
    wp_nav_menu(
       array(
         'menu'=> 'Sub Menu',
         'container_class' => 'sub_menu'
       )
    );
    CSS
    ----------------------------------
    Code:
    .sub_menu ul li {
       display: inline;
    }
    {{ DiscussionBoard.errors[8654196].message }}

Trending Topics