N
N
Nikolai Murmil2020-10-13 23:10:52
CMS
Nikolai Murmil, 2020-10-13 23:10:52

How to hide menu item on one specific page?

It is necessary that the main menu item "Home" is not displayed on the main page of the site, but is displayed on other pages of the site.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
V
Vovash, 2020-10-13
@V0vash

const url_keyword=window.location.pathname
if(url_keyword === "/"){
// скрываешь блок
}

A
Alex, 2020-10-13
@Kozack

WP puts on the body specific classes for each page. Therefore, you can hide any menu item with something like this:

body.home nav li.you-custom-class {
    display: none;
}

K
Kirill Makarov, 2020-10-14
@kirbi1996

You need to pull out the name of the URL and, depending on it, prescribe logic

L
Lord_Dantes, 2020-10-14
@Lord_Dantes

If WP, then we check the home_url of our domain for the presence of any pages, if a regular site, then on JS, check the address strictly for our domain

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question