Primary Nav Bar Only on Home Page

Community Forums Forums General Discussion Primary Nav Bar Only on Home Page

This topic is: resolved

This topic contains 7 replies, has 4 voices, and was last updated by  OliveBurbank 1 year, 9 months ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #11599

    OliveBurbank
    Participant
    Post count: 14

    I just need the primary nav bar on the home page – all other pages have a vertical nav bar in a sidebar.  I found this for functions.php
    /** Change – Reposition the primary navigation menu */
    remove_action( ‘genesis_after_header’, ‘genesis_do_nav’ );

    Which is great – it removed the primary nav bar from all of the pages.

    Question, how do I put the nav bar back on just the home page?

    I have looked through various forums, searched the internet – most of the items I have ran across are for sidebars or removing pages from nav bars.

    I am looking for any assistance.  Thank You.

    #11718

    itsonlybarney
    Participant
    Post count: 15

    You could test for whether the page is the home page, and then remove it for all others using the following:


    if ( !is_home() ) {
    remove_action( ‘genesis_after_header’, ‘genesis_do_nav’ );
    }

    #11819

    OliveBurbank
    Participant
    Post count: 14

    Thank you – I have a functions.php and a home.php.  I tried placment in both and nothing changed.

    Any other suggestions?

    The home page does not have an id however, do you know what code would take the nav bar off a page.  I know it is the long way of doing it in the css for every page but it is an option, I think.

    Thank you for your time.

    #11821

    Susan
    Moderator
    Post count: 9255

    Here’s a thread where someone wanted to move the nav. bar off a particular page (it doesn’t work for a home page with no ID), but it will answer your question for doing it the long way…

    http://www.studiopress.com/forums/topic/how-to-remove-navigation-menus-from-a-certain-page/


    Susan @ Graphically Designing I offer theme customizations I tweet!
    I’ve taken up the challenge! – help me answer some of the unanswered posts

    #11823

    Bill Murray
    Participant
    Post count: 575

    I think a mix of itsonlybarney’s and Susan’s recommendations is what you want:

    [php]
    //Remove nav from home page
    add_action(‘get_header’, ‘child_remove_genesis_do_nav’);
    function child_remove_genesis_do_nav() {
    if ( !is_home() ) {
    remove_action(‘genesis_after_header’, ‘genesis_do_nav’);
    }
    }
    [/php]


    Web: https://wpperform.com or Twitter: @wpperform

    We do managed WordPress hosting.

    #11829

    OliveBurbank
    Participant
    Post count: 14

    Thank you Susan and Bill.

    Bill, the mix you provided worked like a charm – Nav Menu Bar is on the home page only and removed from the other pages.

    Again, Thank you so much.

    #11831

    Bill Murray
    Participant
    Post count: 575

    Glad it worked. Keep in mind that itsonlybarney put you on the right path. You might have copied the exact code he provided into your functions.php and the exact code wouldn’t work because you need to put the code in a function and add the function to an existing action. itsonlybarney may have assumed you were aware of that step so he just included the code that went inside the function.


    Web: https://wpperform.com or Twitter: @wpperform

    We do managed WordPress hosting.

    #11833

    OliveBurbank
    Participant
    Post count: 14

    Yes, you are correct in your assessment Bill.  I am a novice and put the code right into the function with out the action.

    Thank you itsonlybarney – Thank you all.

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

The topic ‘Primary Nav Bar Only on Home Page’ is closed to new replies.