N
N
Nikita2016-05-21 16:00:27
WordPress
Nikita, 2016-05-21 16:00:27

How to remove a link to a page while on this page?

I need to make it so that links to myself should be inactive while on this page.
That is, on my website of dentistry (wordpress) there is a menu that is displayed in a cycle. It is necessary to somehow set a condition so that instead of a link to the page on which we are (for example: dental treatment), just text is displayed. What are the solutions?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Seva Sargsyan, 2016-05-21
@sevasargsyan

jQuery('.current-menu-item li a').removeAttr( 'href' );

V
Vladislav Shkaev, 2016-05-21
@proxid

Cling code example, many ways

if ($alias == trim('/', $_SERVER['REQUEST_URI'])) {
 echo "<li>Активный пункт</li>"
} else {
 echo "<li><a href=".$alias.">Ссыль</a></li>"
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question