看看wp_nav_menu
参数:
<?php
$defaults = array(
\'theme_location\' => \'\',
\'menu\' => \'\',
\'container\' => \'div\',
\'container_class\' => \'\',
\'container_id\' => \'\',
\'menu_class\' => \'menu\',
\'menu_id\' => \'\',
\'echo\' => true,
\'fallback_cb\' => \'wp_page_menu\',
\'before\' => \'\',
\'after\' => \'\',
\'link_before\' => \'\',
\'link_after\' => \'\',
\'items_wrap\' => \'<ul id="%1$s" class="%2$s">%3$s</ul>\',
\'depth\' => 0,
\'walker\' => \'\'
);
wp_nav_menu( $defaults );
?>
您可以使用
menu_id
参数设置其
id
属性和
menu_class
设置其class属性。您还可以设置容器id/类属性。