问题
I m using a one page theme. I would like to disable or choose not to show the menu on the home page. But when user scrolls down to the next page the menu should become fixed. I have removed the menu from the home page now, however i'm not able to get the menu to be fixed on top for the other pages.
Please advice.
回答1:
You can also go the CSS
way.
WordPress adds a class home
to the body attribute in home page. You can target that particular attribute to hide the menu as shown below.
.home .menu-class-name{
display:none;
}
This will hide the menu from home page but will show it on other pages
Note - replace .menu-class-name
with your own menu class
回答2:
you can do it some thing like the below code:
<?php
if(is_front_page())
{
//Just comment out the menu section
}
else
{
//write your code to show the menu section
}
?>
来源:https://stackoverflow.com/questions/21524782/how-to-hide-menu-only-on-home-page-wordpress