How can I prevent a main menu item with sub items from being clickable in Wordpress?

依然范特西╮ 提交于 2019-12-04 19:43:15

One option would be to use Page Links to plugin and set the main link as '#' . I tried this and it works in my blog.

What about using the jQuery.remove to remove the element?

something like this:

function removeLinkAttrib() {
  var attrib =  jQuery(#menus).find("a").attr("Photos and Results");
  jQuery(attrib).remove;
}

I'm not sure if $(attrib).remove; will work, but you get the picture :)

(this answer is for people using Wordpress.com free sites):

You can go to Appearance > Menus, then add a custom link to the menu by clicking 'Links' in the left-hand column, and adding "#" as the URL (and whatever you want as a label). Then add this link to the menu. Open the options for the new menu item in 'Menu Structure', and then delete '#' from the URL, so the field is blank, and save changes. Now you can add sub-menus to this menu item, and there will be no link for this item on the main menu...works for me.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!