Genesis Tutorials

Tips, Tricks, and How-tos for the Genesis Theme Framework

  • The Genesis Developer’s HandbookVisual Hook Guide
  • code, settings & options oh my!Resources
    • Collection Of CodeSnippets
    • Under ConstructionGenesis Functions
    • Coming Soon…Utilizing Genesis SEO Options
  • Extend GenesisPlug-ins
    • Genesis Post Teasers
    • Genesis Favicon Uploader
  • Genesis Child ThemesThemes
  • What is genesistutorials.com?About
    • Genesis Tutorials Roadmap
You are here: Home / Snippets / Remove Navigation Only On the Homepage

Remove Navigation Only On the Homepage

December 26, 2010 by 5 Comments

add_filter('genesis_options', 'gt_no_nav_home', 10, 2);
function gt_no_nav_home($options, $setting) {
	if($setting == GENESIS_SETTINGS_FIELD) {
	if ( is_home() ) {
		$options['nav'] = 0;
		$options['subnav'] = 0;
		}
	}
	return $options;
}


This snippet was requested by the “Suggest a Tutorial ” form in the right side of the site. If you have an idea for a tutorial or a snippet please suggest something.

Comments

  1. Sheila Bergman says

    August 23, 2012 at 11:14 pm

    I’m having trouble making this work on the Venture child theme. I’ve pasted your code into the top of my home.php file as below but with no effect. http://www.mervbergman.net/ . Please advise. Thanks.

    Reply
    • Christopher says

      August 24, 2012 at 11:49 am

      With an actual home.php file you can simply add the following lines to your template file to remove the navs. Since the code will only be in home.php it will only run on home.php.

      remove_action( 'genesis_after_header', 'genesis_do_nav' );
      remove_action( 'genesis_after_header', 'genesis_do_subnav' );
      
      Reply
  2. Sheila Bergman says

    August 24, 2012 at 12:06 pm

    Thanks. I cut and pasted that code into home.php and it had no effect. The nav is still there. This comment box doesn’t seem to allow code or I would show you.

    Reply
    • Sheila Bergman says

      August 24, 2012 at 12:14 pm

      I see that in the Venture child theme, the nav div is nested inside of the header. Is there a hook that accounts for that?

      Reply
      • Sheila Bergman says

        August 24, 2012 at 10:30 pm

        This code from the folks at StudioPress solved my problem:
        /** remove navigation from home */
        add_filter(‘genesis_options’, ‘gt_no_nav_home’, 10, 2);
        function gt_no_nav_home($options, $setting) {
        if($setting == GENESIS_SETTINGS_FIELD) {
        if ( is_home() ) {
        $options[‘nav’] = 0;
        $options[‘subnav’] = 0;
        }
        }
        return $options;
        }

        Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Genesis Framework for WordPress

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Genesis Guide for Absolute Beginners

Click to download the Genesis Guide for Absolute Beginners

Follow me on Twitter

Follow @tweetsfromchris

Recent tutorials

Genesis 3.0.0 Removed Deprecated Functions

How to Add a Logo to the Header

Say Hello to the Genesis Visual Hook Guide v2.5

Genesis Tutorials • Built on the Genesis Theme Framework

Genesis Tutorials is not affiliated with StudioPress, and is maintained and operated by Christopher Cochran.