Remove menu from HOME page

Viewing 8 posts - 1 through 8 (of 8 total)
  • #3894
    treadlightly
    Participant

    Hi,

    I absolutely love this theme and have had a great time making customizations to it.
    I recently duplicated the footer navigation menu in the header by adding:

    ‘header_nav’, ‘container_id’ => ‘header-nav’, ‘container_class’ => ‘nav’, ‘fallback_cb’ => ‘minimatica_nav_menu’ ) ); ?>

    to header.php

    but I would like to hide this particular menu from my home page.
    i’d like it to display on all other pages though.

    does anyone have any ideas on how to achieve this?

    #4051
    sugarhigh587
    Participant

    Hi treadlightly,

    Not sure if you’ve figured out what to do, but I actually put the menu on the Page Template (page.php). I placed it right under this section (since I wanted it under the header and above the page title):

    get_header(); ?>

    This put the menu on all my pages except the home page.

    #4055
    sabdcastles
    Participant

    you could wrap whatever you included in an if statement as such:
    if(is_front_page())
    {

    }
    Won’t that work

    #4057
    treadlightly
    Participant

    thank you guys SO much for the replies!
    i did end up using a conditional statement and it should work out just fine.
    i’d love to try the page template method too.

    thank you, again!

    #4847
    TimGouldPhotography
    Participant

    I’m struggling with this. Like the OP, I moved the menu code from footer.php to the end of header.php, to make the menu appear just under the banner header. Then I put an if…endif statement around it as suggested above, to make it only appear if this is the front page.

    It works fine without the “if” statement, but when I try the page with the code below, I get an error:

    Parse error: syntax error, unexpected ‘<' in –my website blah blah– /header.php on line 37

    (line 37 is the line beginning <nav id=)

    This is the code I have added:

    if ( is_front_page() ) {
    <nav id=”access” role=”navigation”>
    <?php wp_nav_menu( array( ‘theme_location’ => ‘primary_nav’, ‘container_id’ => ‘primary-nav’, ‘container_class’ => ‘nav’, ‘fallback_cb’ => ‘minimatica_nav_menu’ ) ); ?>
    </nav>
    }
    endif;

    What’s wrong? What I want is, if this is the home page, display the menu. Otherwise, don’t.

    #4850
    sabdcastles
    Participant

    check the
    if(condition):
    code;
    endif;
    syntaxis

    [note the colon after the “if(condition)”]

    with this syntaxis you should not use curly braces to wrap your code..

    #4851
    sabdcastles
    Participant

    You should also take good care of openning and closing php tags properly

    • This reply was modified 10 years, 2 months ago by sabdcastles.
    • This reply was modified 10 years, 2 months ago by sabdcastles.
    #4855
    TimGouldPhotography
    Participant

    Thanks for the reply, but it makes no difference.

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

Tagged: , ,

You must be logged in to reply to this topic.