-
treadlightlyParticipant
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?
sugarhigh587ParticipantHi 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.
sabdcastlesParticipantyou could wrap whatever you included in an if statement as such:
if(is_front_page())
{
…
}
Won’t that worktreadlightlyParticipantthank 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!
TimGouldPhotographyParticipantI’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.
sabdcastlesParticipantcheck 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..
sabdcastlesParticipantYou should also take good care of openning and closing php tags properly
- This reply was modified 12 years, 8 months ago by sabdcastles.
- This reply was modified 12 years, 8 months ago by sabdcastles.
You must be logged in to reply to this topic.