Wp Nav Menu Setup


/ Published in: PHP
Save to your folder(s)

Our basic WP navigation menu setup. See [this page](http://codex.wordpress.org/Function_Reference/wp_nav_menu) for more documentation.


Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.