Community Forums › Forums › Archived Forums › General Discussion › Primary Nav Bar Only on Home Page
Tagged: Primary Navigation Menu
- This topic has 7 replies, 4 voices, and was last updated 12 years, 11 months ago by
OliveBurbank.
-
AuthorPosts
-
January 13, 2013 at 11:29 am #11599
OliveBurbank
MemberI 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.
January 13, 2013 at 7:58 pm #11718itsonlybarney
MemberYou 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’ );
}
January 14, 2013 at 8:19 am #11819OliveBurbank
MemberThank 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.
January 14, 2013 at 8:29 am #11821Susan
ModeratorHere'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.community/topic/how-to-remove-navigation-menus-from-a-certain-page/
January 14, 2013 at 8:35 am #11823Bill Murray
MemberI think a mix of itsonlybarney's and Susan's recommendations is what you want:
//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'); } }
Web: https://wpperform.com or Twitter: @wpperform
We do managed WordPress hosting.
January 14, 2013 at 9:00 am #11829OliveBurbank
MemberThank 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.
January 14, 2013 at 9:13 am #11831Bill Murray
MemberGlad 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.
January 14, 2013 at 9:21 am #11833OliveBurbank
MemberYes, 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.
-
AuthorPosts
- The topic ‘Primary Nav Bar Only on Home Page’ is closed to new replies.