Answer the question
In order to leave comments, you need to log in
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
const url_keyword=window.location.pathname
if(url_keyword === "/"){
// скрываешь блок
}
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;
}
You need to pull out the name of the URL and, depending on it, prescribe logic
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 questionAsk a Question
731 491 924 answers to any question