wordpress カスタムメニュー

■function.php

register_nav_menus(
	array(
		'main_nav' => 'メインナビゲーション',
		'sub_nav' => 'サブナビゲーション',
	)
);

■テンプレート
・main-nav.php

<nav>
	<?php
	wp_nav_menu(
		array(
			'theme_location'=>'main_nav',
			'container' => '',
			'menu_class' => '',
			'items_wrap' => '<ul id="main-nav">%3$s</ul>'
		)
	);
	?>
</nav>

・sub-nav.php

<nav>
<?php
wp_nav_menu(
	array(
		'theme_location'=>'sub_nav',
		'container' => '',
		'menu_class' => '',
		'items_wrap' => '<ul id="sub-nav">%3$s</ul>'
	)
);
?>
</nav>
PAGE TOP