Skip to Content
Menu

nav_menu_locations()

Registers various Nebula navigation menu locations.

PHP April 27, 2017

Usage

This function runs automatically, so it is not called manually. Is this incorrect?

Was this page helpful? Yes No


    A feedback message is required to submit this form.


    Please check that you have entered a valid email address.

    Enter your email address if you would like a response.

    Thank you for your feedback!

    Source File

    Located in /libs/Functions.php on line 2274.

    1 Hook

    Find these filters and actions in the source code below to hook into them. Use do_action() and add_filter() in your functions file or plugin.

    Filters
    "pre_nebula_nav_menu_locations"
    Need a new filter hook? Request one here.

    Actions
    This function has no action hooks available. Request one?

    PHP
            public function nav_menu_locations(){
                $override = apply_filters('pre_nebula_nav_menu_locations', null);
                if ( isset($override) ){return;}
    
                register_nav_menus(array(
                    'utility' => 'Utility Menu',
                    'primary' => 'Primary Menu',
                    'offcanvas' => 'Offcanvas Menu',
                    'footer' => 'Footer Menu'
                ));
            }
    

    Override

    To override this PHP function, use this hook in your child theme or plugin ("my_custom" can be changed):

    PHP
    add_filter('pre_nebula_nav_menu_locations', 'my_custom_nav_menu_locations'); 
    function my_custom_nav_menu_locations(){ 
        //Write your own code here
    
        return true; //Return true to prevent the original function from running afterwords
    }

    You can completely disable this PHP function with a single line actions:

    PHP
     add_filter('pre_nebula_nav_menu_locations', '__return_false');