Skip to content

Instantly share code, notes, and snippets.

@landru247
Created April 24, 2013 17:22
Show Gist options
  • Save landru247/5453883 to your computer and use it in GitHub Desktop.
Save landru247/5453883 to your computer and use it in GitHub Desktop.
WordPress: PHP - register custom menus
// Creates custom menus
add_action( 'init', 'register_my_menus' );
function register_my_menus() {
register_nav_menus(
array(
'header-nav-1' => __( 'Top Nav' ),
'header-nav-2' => __( 'Header main' ),
'footer-nav' => __( 'Footer Nav' ),
'policy-nav'=> __('policy Nav')
)
);
}
// Prints menu
<?php wp_nav_menu( array('theme_location' => 'header-nav-1','menu_class' => 'nav')); ?>
// Creates custom menus
add_action( 'init', 'register_my_menus' );
function register_my_menus() {
register_nav_menus(
array(
'header-nav-1' => __( 'Top Nav' ),
'header-nav-2' => __( 'Header main' ),
'footer-nav' => __( 'Footer Nav' ),
'policy-nav'=> __('policy Nav')
)
);
}
// Prints menu
<?php wp_nav_menu( array('theme_location' => 'header-nav-1','menu_class' => 'nav')); ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment