Shree
Shree

Reputation: 31

How to hide menu only on Home page wordpress

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.

Upvotes: 1

Views: 6337

Answers (2)

Chirag Swadia
Chirag Swadia

Reputation: 1117

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

Upvotes: 5

Debakant Mohanty
Debakant Mohanty

Reputation: 825

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
}
?>

Upvotes: 0

Related Questions