2

I have a Wordpress menu that are both being used as a normal menu with page name that links to the page. I want to echo the same registered menu, but without the page name. To be clear, I still want the anchorlink, but I do not want any text contained within the anchorlink.

<li><a href="the-page-link"></a></li>

The reason I want this is because I style the anchorlinks as small circles.

Is this possible? I tried to clear the content in css, but that does not affect the anchorlink when the page name is echoed in the HTML.

3 Answers 3

0

I figured out that I could use the jQuery empty() function like this to remove the text inside the anchorlink,

$('nav > ul > li > a').empty();
0
0

You could also do this with pure CSS like so:

nav > ul > li > a { text-indent:-9999px; outline:none; }

More information here.

0

Try to use CSS "text-indent:-9999px;" sometimes jQuery is loaded slowly and you can see the menu name and after a second it will disappear. With CSS you'll not have such a problem.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.