Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Adding menu’s to your WordPress theme > https://since1979.dev/snippet-003-adding-menus-to-your-theme/
<?php
/**
* register_navigation_menus.
*
* Register navigation menus with WordPRess,
*
* @see https://since1979.dev/snippet-003-adding-menus-to-your-theme/
*
* @uses register_nav_menus() https://developer.wordpress.org/reference/functions/register_nav_menus/
* @uses __() https://developer.wordpress.org/reference/functions/__/
* @uses array() https://www.php.net/manual/en/function.array.php
*
* @return void
*/
function register_navigation_menus()
{
register_nav_menus(
array(
'header-menu' => __('Header menu', 'your-textdomain'),
'footer-menu' => __('Footer menu', 'your-textdomain'),
'mobile-menu' => __('Mobile menu', 'your-textdomain')
)
);
}
/**
* Hook: after_setup_theme.
*
* @uses add_action() https://developer.wordpress.org/reference/functions/add_action/
* @uses init https://developer.wordpress.org/reference/hooks/init/
*/
add_action('init', 'register_navigation_menus');
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.