WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I was thinking of removing navigation on my contact page.

I was thinking of inserting a conditional statement and an inline CSS style to "display: none;" if the page template was the contact page.

Is there a better way?

I'm using Twenty Eleven as a parent theme.

share|improve this question
up vote 4 down vote accepted

You could try putting this code in your functions.php

function remove_contact_nav( $nav_menu, $args ){

    if( is_page_template('template-contact.php') || is_page( 'contact' ) ) {
        $nav_menu = null;
    }

    return $nav_menu;
}
add_filter( 'wp_nav_menu', 'remove_contact_nav', 11, 2 );

The if condition need to be modified as per your template name or the second condition would also do if your contact page slug is contact

share|improve this answer

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.