Community Forums › Forums › Archived Forums › Design Tips and Tricks › Code snippet to remove nav on home page only, not inside pages
Tagged: primary nav inside pages, remove menu from home page, remove nav from home page, remove primary nav from home page
- This topic has 7 replies, 3 voices, and was last updated 10 years, 4 months ago by Brad Dalton.
-
AuthorPosts
-
June 29, 2013 at 1:41 am #48344joycegraceParticipant
I am using Education theme, and I want to get a horizontal navigation menu to appear before content on inside pages and not the home page.
For the home page I am using the header right area with a custom menu like the demo. This will remain on the inside pages but then the inside pages will also show the primary nav that Genesis offers.
I looked up code snippets and there are snippets to remove the nav or reposition it, but not to have it show only on inside pages.
I also looked up the Education theme's home.php template and it's not clear where navigation fits into it from reading the code (you can't search the word "nav" in that file).
I was thinking one way around this is to de-register the menus all together in the functions.php file, then register a new widget area using this method: http://my.studiopress.com/tutorials/register-widget-area/ , throw in a custom menus widget, and then stick the widget area into a template, but there is no template for inside pages, I guess that's taken care of at a parent theme level.
I also thought maybe I could use Genesis Simple Hooks for this but to be honest I'm not sure what code to put where in that plugin.
Or maybe I could use "display: none" in the css for the home page nav menu but that seems a little tacky....
I'm not a php-er so I'm a bit stuck and would really appreciate the help with this.
A code snippet would really help! I'm surprised this isn't a more requested feature - I did try searching the forums but couldn't see anything related.
Thank you!
Find me at Joyce Grace (http://www.joycegrace.ca)
June 29, 2013 at 8:39 pm #48461Brad DaltonParticipantIf you want to remove the custom menu in the header right widget, from your home page, you can install the Widget Logic plugin and paste in the !is_home() conditional tag. This will exclude the widget from outputting your custom menu in that position on the home page only.
If you want to remove your primary or secondary nav menu from your home page, you can use this code or modify it according to your needs.
This code assumes your primary nav menu uses the after header position.
Change the hook if needed depending on your themes setup.
You can also change the code from genesis_do_nav to genesis_do_subnav to remove your secondary nav menu from the after header position.
September 5, 2013 at 5:39 pm #60964scotmMemberI've tried this to remove the primary nav on Minimum Pro but it doesn't work even though it looks correct. Perhaps because it already repositions the primary nav in the functions.php. file?
September 5, 2013 at 8:38 pm #61007Brad DaltonParticipantDifferent themes are coded differently.
The question relates to the Education theme which i tested the code with and it works for that theme, not the Minimum Pro theme.
Please link to your site.
The menu in the Pro demo uses a custom header right widget, not the primary nav.
Which menu location are you using?
September 5, 2013 at 9:19 pm #61018Brad DaltonParticipantThe Minimum Pro theme uses a front_page.php file.
You can paste this code in that file to remove the primary nav menu from the front page only:
remove_action( 'genesis_after_header', 'genesis_do_nav', 15 );
September 6, 2013 at 7:22 am #61059scotmMemberGreat idea. Thanks!
December 17, 2013 at 1:56 am #79695joycegraceParticipantDecember 17, 2013 at 3:49 am #79708Brad DaltonParticipant -
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.