1

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.

1 Answer 1

4

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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