Code snippet to remove nav on home page only, not inside pages

Community Forums Forums Design Tips and Tricks Code snippet to remove nav on home page only, not inside pages

This topic is: not resolved

This topic contains 7 replies, has 3 voices, and was last updated by  braddalton 8 months, 2 weeks ago.

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

    joycegrace
    Participant
    Post count: 57

    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) and Clicks Online Marketing (clicksonlinemarketing.com).

    #48461

    braddalton
    Participant
    Post count: 9332

    If 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.


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

    #60964

    scotm
    Participant
    Post count: 35

    I’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?

    #61007

    braddalton
    Participant
    Post count: 9332

    Different 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?


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

    #61018

    braddalton
    Participant
    Post count: 9332

    The 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:
    [php]
    remove_action( ‘genesis_after_header’, ‘genesis_do_nav’, 15 );
    [/php]


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

    #61059

    scotm
    Participant
    Post count: 35

    Great idea. Thanks!

    #79695

    joycegrace
    Participant
    Post count: 57

    I forgot to thank you for this, thank you!


    Find me at Joyce Grace (http://www.joycegrace.ca) and Clicks Online Marketing (clicksonlinemarketing.com).

    #79708

    braddalton
    Participant
    Post count: 9332

    You’re welcome.


    Specializing In StudioPress Child Theme Customization.
    500+ StudioPress Tutorials

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

You must be logged in to reply to this topic.