这两段代码可以让你先体验一下wordpress 3.0的菜单样式
首先在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>';
}
然后在模板文件中(想在哪显示就在哪个模板中)添加:
<?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')); ?> 原文链接:/wordpress/871122.html