WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Putting nav menu in a different location on my home page only (4 posts)

  1. davidzupec
    Member
    Posted 1 year ago #

    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.

  2. Andrew
    Forum Moderator
    Posted 1 year ago #

    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

  3. esmi
    Forum Moderator
    Posted 1 year ago #

    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.

  4. davidzupec
    Member
    Posted 1 year ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic