如何仅在首页wordpress上隐藏菜单 [英] How to hide menu only on Home page wordpress

查看:64
本文介绍了如何仅在首页wordpress上隐藏菜单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用一页主题.我想禁用或选择不在主页上显示菜单.但是,当用户向下滚动到下一页时,菜单应该变得固定.我现在已经从主页上删除了菜单,但是我无法将菜单固定在其他页面的顶部.

请咨询.

解决方案

您也可以采用 CSS 方式.

WordPress在首页的body属性中添加了一个 home 类.您可以定位该特定属性以隐藏菜单,如下所示.

  .home .menu-class-name {显示:无;} 

这将从首页隐藏菜单,但会在其他页面上显示

注意-用您自己的菜单类替换 .menu-class-name

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.

解决方案

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

这篇关于如何仅在首页wordpress上隐藏菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆