Posted By

mindshare on 03/12/11


Tagged

menu wordpress nav hints


Versions (?)

Wp Nav Menu Setup


 / Published in: PHP
 

Our basic WP navigation menu setup. See this page for more documentation.

  1. <?php
  2. // place this code where you want your nav menu to appear
  3. wp_nav_menu( array('menu' => 'Main Nav', 'theme_location' => 'main-nav', 'container' => 'menu', 'menu_class' => 'sf-menu', 'menu_id' => 'suckerfishnav', 'before' => '' )); ?>
  4.  
  5. <?php
  6.  
  7. // put this code in your theme's functions.php file
  8. if ( function_exists('register_nav_menus') ) {
  9. register_nav_menus(array('main-nav' => 'Main Nav'));
  10. if (!is_nav_menu( 'main-nav' ) ) {
  11. wp_create_nav_menu( 'Main Nav', array( 'slug' => 'main-nav' ) );
  12. }
  13. }
  14. ?>

Report this snippet  

You need to login to post a comment.