Navigation switch not working properly

Community Forums Forums General Discussion Navigation switch not working properly

This topic is: not resolved

Tagged: 

This topic contains 1 reply, has 2 voices, and was last updated by  nutsandbolts 10 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #69868

    Tijmen
    Member
    Post count: 9

    I have a primary and secondary navigation which both show on all pages. But what I want is to only show the secondary nav on the homepage, and only the primary nav on all other pages. I have been trying to get this to work for the last couple of hours, but I can’t get it to work the way I want to.

    If I add this code to the home.php, it removes the primary nav from the homepage. But then all other pages still show both the primary & secondary nav (which makes sense). If I add the same code to the functions.php instead of the home.php, nothing happens?

    
    if ( is_home() ){
    	remove_action( 'genesis_after_header', 'genesis_do_nav' );
    }

    If I add this to the functions.php, it removes the secondary nav on all pages, including the homepage?

    if ( !is_home() ) {
    	remove_action( 'genesis_after_header', 'genesis_do_subnav' );	
    }

    I did not specify a static homepage, so is_home should just work, right? But somehow it’s not really doing it’s job?

    If I add this code to the functions.php, and add no code to the home.php. I end up without any navigation at all on the homepage, and just the primary nav on all other pages.

    if ( is_home() ){
            add_action( 'genesis_after_header', 'genesis_do_subnav' );
    	remove_action( 'genesis_after_header', 'genesis_do_nav' );
    } else {
    	remove_action( 'genesis_after_header', 'genesis_do_subnav' );	
    }

    Whatever combination I try, it never really does what I want. Just the secondary nav on the homepage, and the primary on all other pages. Any ideas how to make this work?

    • This topic was modified 10 months ago by  Tijmen.
    • This topic was modified 10 months ago by  Tijmen.
    #69948

    nutsandbolts
    Moderator
    Post count: 3119

    This tutorial should help you: http://wpsites.net/web-design/remove-nav-menu-specific-page/


    Andrea Whitmer, Owner, Nuts and Bolts Media
    I provide dev and training services for web designers • Find me on Twitter and Google+

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.