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.

Possible Duplicate:
Remove navigation from header in custom page template

Is there some way to remove wp_nav_menu in a page template? I can't find anything related to page templates other than redirect default theme files etc.

I know that just placing the header.php content in the page template will do the trick but this seems a awkward hack.

Thanks for any clue.

share|improve this question

marked as duplicate by Chip Bennett, toscho Dec 18 '12 at 20:46

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer 1

up vote 2 down vote accepted

Without knowing your theme, you have at least a few options. You could 1. hide it with CSS.

.your-page-template-php #your-menu {
  display: none;
}

Or 2. you could create a custom header file. For example, duplicated header.php to header-nomenu.php. And in your new file delete the menu. And then in your page template instead of calling

get_header();

you'd call

get_header('nomenu');

EDIT

Upon further review there is a filter inside the wp_nav_menu function. Conditional logic will probably work as long as you haven't messed around with the query object and forgot to reset it.

function wpa76334_filter_nav_menu($menu, $args){
    if( is_page_template('your-template.php')) $menu = null;
    return $menu;
}
add_filter('wp_nav_menu','wpa76334_filter_nav_menu', 10, 2);
share|improve this answer
    
Hi, I'm hidding with css :S –  Diana Dec 17 '12 at 6:04
1  
The answer I've just provided here should work: Similar Question. –  Jeremy Jared Dec 17 '12 at 7:12
    
Good answer @JeremyJared. That would work perfectly in a custom theme or anywhere else you are cool with editing header.php. Looks like this question is a duplicate then. –  helgatheviking Dec 17 '12 at 19:11
    
I thought there is some filter to prevent functions in template pages :( that's ok. –  Diana Dec 18 '12 at 14:00
    
You were right actually. There is a filter in wp_nav_menu. Let me edit my answer. –  helgatheviking Dec 18 '12 at 20:02

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