Register Nav

PHP
function setNavigation(){
    if (function_exists('add_theme_support')) {
      add_theme_support('menus');
    }
    function header_menu(){
      wp_nav_menu(
      array(
          'theme_location'  => 'header-menu',
          'menu'            => '',
          'container'       => 'div',
          'container_class' => 'menu-{menu slug}-container',
          'container_id'    => '',
          'menu_class'      => 'menu',
          'menu_id'         => '',
          'echo'            => true,
          'fallback_cb'     => 'wp_page_menu',
          'before'          => '',
          'after'           => '',
          'link_before'     => '',
          'link_after'      => '',
          'items_wrap'      => '<ul>%3$s</ul>',
          'depth'           => 0,
          'walker'          => ''
        )
      );
    }
    function footer_menu(){
      wp_nav_menu(
        array(
          'theme_location'  => 'footer-menu',
          'menu'            => '',
          'container'       => 'div',
          'container_class' => 'menu-{menu slug}-container',
          'container_id'    => '',
          'menu_class'      => 'menu',
          'menu_id'         => '',
          'echo'            => true,
          'fallback_cb'     => 'wp_page_menu',
          'before'          => '',
          'after'           => '',
          'link_before'     => '',
          'link_after'      => '',
          'items_wrap'      => '<ul>%3$s</ul>',
          'depth'           => 0,
          'walker'          => ''
        )
      );
    }
    function register_nav(){
      register_nav_menus(array( 
        'header-menu' => '頁首', 
        'footer-menu' => '頁尾',
      ));
    }
    add_action('init', 'register_nav');
  }

Tags: