check current_theme_supports in admin_menu hook

I’m adding a menu and sub-menus via the admin_menu hook in my functions.php. One of the sub-menus I want to add is menus.

I want to make sure that the theme supports menus before I do that, so I tried using the current_theme_supports function, but it returns false, apparently because $_wp_theme_features is still null at this stage.

What should I do? Do you think I really need this check, if I’m anyway in my functions.php? And if I do – should I use a later hook to create my menus? Or any other solution?

1 Answer
1

Not really sure what you’re asking here, but this allows theme support for navigation menus in your theme.

Place this block of code in your theme’s functions.php file.

if(function_exists('register_nav_menus')){
    register_nav_menus(
        array(
            'header_navigation' => 'Header Navigation',
            'main_navigation' => 'Main Navigation',
            'footer_navigation' => 'Footer Navigation'
        )
    );
}

Leave a Comment