In this website:
http://alexchen.info/brianfunshine/
I have a navigation menu taken from the twentyten theme. I want to make some links clickeable and some not (some don’t have to behave like a link). I have accomplished this with some CSS but it doesn’t work in all browsers.
The links are dinamically generated with:
wp_nav_menu
Any suggestions?
Create a custom menu item in the admin panel with a dummy URL, foo.com or whatever. Add it to the menu, then delete the target URL and save. The menu item will be rendered without an href attribute and will be unclickable.
Via the menu admin in WordPress you can add a custom class, say
no-link
, to the links you want to be unclickable. You may need to enable the custom class field via the display options.Here’s two ideas, based on jQuery. Note that the links will still be there for those with JavaScript disabled.
Use js to cancel the link behavior by returning false on click. This should work:
If you don’t want a link to behave like a link, then don’t make it a link – ie remove the
<a> </a>
tags.