Posted By

jschultz76 on 09/17/10


Tagged

menu wordpress


Versions (?)

WordPress 3 Menu in Template and Functions


 / Published in: PHP
 

Code for enabling custom menus in your theme in WordPress 3. This code is from http://justintadlock.com/archives/2010/06/01/goodbye-headaches-hello-menus

  1. <?php
  2. // placed with functions.php
  3. add_action( 'init', 'register_my_menus' );
  4.  
  5. function register_my_menus() {
  6. register_nav_menus(
  7. 'primary-menu' => __( 'Primary Menu' ),
  8. 'secondary-menu' => __( 'Secondary Menu' ),
  9. 'tertiary-menu' => __( 'Tertiary Menu' )
  10. )
  11. );
  12. }
  13. ?>
  14.  
  15.  
  16. // placed within themes template where menu should be located
  17. <?php wp_nav_menu( array( 'theme_location' => 'primary-menu' ) ); ?>

Report this snippet  

You need to login to post a comment.