Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I wish to keep a menu item hidden on homepage & vice-versa (user roles don't matter here).

Scenario

In my Primary Menu, I have created two menu items Get Quote (menu-item-1) and Get Quote (menu-item-2)

The first menu item (menu-item-1)) scrolls down to an anchor on the homepage. The second menu item (menu-item-2) links to an internal domainname/get-quote-page/.

Now as you can understand, I wish to show the first menu (menu-item-1) on the homepage only since it's linked to an anchor present on the homepage only. The second menu item (menu-item-2) needs to remain invisible on the homepage only.

I tried with CSS

/* this is for the menu-item-1*/
.menu-hide {
display:none!important;
}
.page-id-1 .menu-hide {
display:inline-block!important;
}
/* this is for the menu-item-2 */
.page-id-1 .another-menu {
display:none!important;
}

Then I append the classes to the desired menu items.

I wish to know, is the only way to do this or is there a better way to accomplish this.

Any help will be appreciated. Thanks

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.