W3Counter

Hide nav menu from selected posts/pages

September 27, 2010

The following snippet removes the Thesis Nav menu from selected posts/pages.

It hooks into the template_redirect hook, and selectively unhooks the default Thesis menu from running.

function thesify_hide_nav_on_selected_posts()
{
    // remove nav menu on 'hello-world' post and 'about-me' page.
    if( is_single( 'hello-world' ) || is_page( 'about-me' ) )
        remove_action( 'thesis_hook_before_header', 'thesis_nav_menu' );
}
add_action( 'template_redirect', 'thesify_hide_nav_on_selected_posts' );

Tested on Thesis 1.8 and WordPress 3.0

Props to @lexirodrigo

Leave a Comment

Previous post:

Next post: