Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I like to use the Starkers Theme and build child-theme.

So, I`d like to remove the this primary menu

Starkers (functions.php)

function starkers_setup() {
// This theme uses wp_nav_menu() in one location.
register_nav_menus( array(
'primary' => __( 'Primary Navigation', 'starkers' ),
) );


}
endif;

My child-theme functions.php looks like this:

unregister_nav_menu( array(
'primary' => __( 'Primary Navigation', 'starkers' ),
));

// my new nav
register_nav_menus(array(
'primary_navigation' => __('Main', 'starkers'),
'utility_navigation' => __('Meta', 'starkers')
));

But it doesn´t work for me.

What´s wrong?
Thanks

share|improve this question
add comment

2 Answers 2

up vote 4 down vote accepted

The Starkers theme setup is hooked to after_setup_theme, at a priority of 10. So you basically have to wrap the unregister function inside another function (child themes functions.php file) and add it later than the parent themes setup function, so it gets first added by the parent and later on removed by the child.

function wpse_remove_parent_theme_locations()
{
    // @link http://codex.wordpress.org/Function_Reference/unregister_nav_menu
    unregister_nav_menu( 'primary' );
}
add_action( 'after_setup_theme', 'wpse_remove_parent_theme_locations', 20 );
share|improve this answer
    
Thanks, great - it works! –  ogni Apr 22 '12 at 17:13
add comment

This should definitely work for you, I just checked out

add_action( 'after_setup_theme', 'remove_default_menu', 11 );
function remove_default_menu(){
unregister_nav_menu('primary');
}
share|improve this answer
    
Thanks, doesn´t work , too. –  ogni Apr 22 '12 at 16:51
    
Check the edited code, this should work. –  Enthusiast Apr 22 '12 at 17:07
    
Thanks, great - it works! –  ogni Apr 22 '12 at 17:13
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.