wordpress - Genesis - Turn off menu on certain pages -
i want turn off menu on pages in genesis framework wp. have following code:
function turn_off_menu() { if (!is_front_page() || !is_page('blog')) { remove_action( 'genesis_after_header','genesis_do_nav' ) ; } } add_action( 'init', 'turn_off_menu');
but turning off menu on every page.
what pages want exclude menu on? can page id or slug.
how wordpress settings => reading configured alter how it.
example:
is_page( 42 ); // when page 42 (id) being displayed. is_page( 'contact' ); // when page post_title of "contact" being displayed. is_page( 'about-me' ); // when page post_name (slug) of "about-me" being displayed.
your code:
function turn_off_menu() { if ( !is_front_page() && !is_home() && !is_page('blog') ) { // not default homepage or blog slug page remove_action( 'genesis_after_header','genesis_do_nav' ) ; } } add_action( 'init', 'turn_off_menu');
Comments
Post a Comment