Skip to content

Instantly share code, notes, and snippets.

@CodeNegar
Created November 10, 2012 13:48
Show Gist options
  • Save CodeNegar/4051123 to your computer and use it in GitHub Desktop.
Save CodeNegar/4051123 to your computer and use it in GitHub Desktop.
PHP: Wordpress navigation menu
<?php
// functions.php
add_theme_support('menus');
function reg_menu() {
register_nav_menus(
array(
'head-menu' => __('Head Menu')
)
);
}
add_action( 'init', 'reg_menu' );
?>
<?php
// inside theme
if (function_exists('wp_nav_menu')){
wp_nav_menu(array(
'container_id' => 'menu_box',
'theme_location' => 'head-menu'
));
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment