这两段代码可以让你先体验一下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 3.0,WordPress 3.3, 插件与修改, 激活, 菜单