WordPress tutorials: WordPress 3.0 menu activation

Wpsnipp – With the upcoming 3.0 release, WordPress is introducing a new user interface to help manage navigation menus, which simply means you’ll get a new page with some tools on it to help you add, delete, and arrange links.Adding this code snippet to your wordpress theme will activate the new wordpress 3.0 menu system.

 

 

 

functions.php

register_nav_menus(
array(
'header-menu' => __( 'Header Menu' ),
'footer-menu' => __( 'Footer Menu' ),
)
);
// if no menu pressent fallback to.... used in wp_nav_menu
function header_fallback() {
echo '<div class="sf-menu-wrapper group"><ul class="sf-menu">';
wp_list_pages('title_li=');
echo '</ul></div>';
}
function footer_fallback() {
echo '<div id="footer-nav-wrapper" class="group"><ul id="footer-nav">';
wp_list_pages('depth=1&title_li=');
echo '</ul></div>';
}

theme

<?php wp_nav_menu(array('theme_location'=>'header-menu',

'container_class'=>'sf-menu-wrapper group',

'menu_class'=>'sf-menu','fallback_cb'=>'header_fallback')); ?>
<?php wp_nav_menu(array('theme_location'=>'footer-menu',

'container_id'=>'footer-nav-wrapper','container_class'=>'group',

'menu_id'=>'footer-nav','fallback_cb'=>'footer_fallback')); ?>

Leave a comment