Forums
Home / Themes and Templates / How to generate my menu in primary location
(@igorlaszlo)
9 years, 6 months ago
Hello,
to avoid installing my menu in each pages (sidebar.php, index.php, category.php, etc.), i creat a template part (a php.file) for my menu, for example (i have a twentyeleven child theme, i will change the codes of course):
<?php /** * The template for displaying menu in Twenty Eleven * * @package WordPress * @subpackage Twenty_Eleven * @since Twenty Eleven 1.0 */ ?> <div id="menu"> <ul> <li> <a href="http://www.mylink.com/">home</a> </li> <li> <a href="http://www.mylink.com/">about</a> </li> <li> <a href="http://www.mylink.com/">contact</a> </li> </ul> </div>
Then i install the <?php get_menu(); ?> after the <div id="primary"> in each page where i want to show the menu…
<?php get_menu(); ?>
<div id="primary">
I guess i must also make some codes in the function.php, how should i do ??? What else should i do still ?
Thanks for your help in advance !