Menu help

Hello

On my main menu I have 2 links using # to scroll down my page, but when you navigate to pages outside of the front page then the links no longer work. I could just add url/#link but then that doesn’t show the nice scrolling on the front page, it basically opens a new page directly on the linked area.

So is it possible to have a menu link work a certain way on the main page and a different way on another page? or is it possible to hide those menu options outside of the main page. Not sure if this is possible but if the link could make sure you were on the proper page then scroll to the desired section that would be great.

Hello @tigman88,

I would be happy to help you, but can you please provide a link to your site first?

Kind Regards, Roman.

www.wolfpackdesign.ca

Hello @tigman88,

First part of the following CSS code will hide those two menu items and second part will show it only on home page.

#menu-item-272,
#menu-item-273 {
    display: none;
}

.home .page #menu-item-272,
.home .page #menu-item-273 {
    display: inline;
}

You can create two more menu items with url/# format and show them everywhere except home page. You can do it with the following CSS code:

.home .page #menu-item-272,
.home .page #menu-item-273 {
    display: none;
}

Replace #menu-item-272 and #menu-item-273 with proper IDs of your new menu items. You can find it by doing a right-click on a menu item, select Inspect element and find something like this:

<li id="menu-item-272"…

You can add CSS code to style.css file of your child theme, also you can use Simple Custom CSS or similar plugin for adding CSS code.

Please feel free to ask any other questions that you might have.

Kind Regards, Roman.

Hi Roman

Not sure if I’m entering something wrong but when i enter the code it has the opposite effect of what i’m looking for. It is hiding the 2 items on the front page and showing them on every other page.

So far i have just tried the initial code, not the code to add new menu items.

Okay @tigman88,

Sorry, there is extra space between .home and .page. Please remove it and code should work.

Strange, you told that it hid menu items only on home page. But it had to hide it everywhere with that error. Next time please try to clear your cache.

I hope that it will help you :slight_smile:

Kind Regards, Roman.

Works like a charm now, thanks Roman

You are welcome @tigman88!

I am glad that it works :slight_smile:

Kind Regards, Roman.