WordPress.org

Support

Support » Themes and Templates » [Resolved] Putting nav menu in a different location on my home page only

[Resolved] Putting nav menu in a different location on my home page only

  • Hello all this may seem very basic but I’m not sure how to accomplish this. Right now my wp_nav_menu is in my header.php file. So on all my pages the navigation is at the top, which is where it should be. Now what I want to do is just on the Home page I want the navigation to be at the bottom. How can I accompllish this since the wp_nav_menu is in my header.php file?

    Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator Andrew Nevins

    @anevins

    Forum moderator

    If you’re using a Child Theme, add some PHP conditional statements around the header.php wp_nav_menu to execute all but the home page.

    Then do the same with footer.php but vice versa.

    E.g header.php

    if ( !is_front_page() ) {
     wp_nav_menu( $args );
    }

    Then in footer.php

    if ( is_front_page() ) {
     wp_nav_menu( $args );
    }

    http://codex.wordpress.org/Function_Reference/is_front_page

    esmi

    @esmi

    Forum Moderator

    You can use get_header() to call for a custom header.php file – such as header-home.php called by <?php get_header('home');?>.

    Or alternatively, you could use the is_home and/or is_front_page conditionals to load the menu on every page except the home page in header.php and in just the home page in footer.php.

    Awesome, thank you so much! Looks like all are great solutions : )

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] Putting nav menu in a different location on my home page only’ is closed to new replies.
Skip to toolbar