I received a question about how to hand a menu in WordPress. This is a common question (even I had asked it when I first started out) – I though I would take a minute and let you all know about it in case you come across the need to do something similar. While WordPress Menus support this type of action, it is a little bit of aworkaroundd – you will see what I mean…
Hey Paul – can you help me? I want to have a top-level menu item NOT do anything. It is really there just for show and to categorize the items underneath it. I think have have to have a page (or something there) so I can put it on the menu, but I do not want it to be clickable. Can you help me with this?
Of course, I can help you, Wendy!
First just so we are on the same page (and so everyone else understands, this is what Wendy wants to happen:
This is a menu item that when you put the mouse over the top-level item, “Types of Dogs”, the various types get listed below. Each one of these is a page (or a post) on your site. Click on any of them and you will be directed to that page.
However, in Wendy’s case, and anyone else who wants to do this, she does not want to make Types of Dogs clickable. She could create a page titled, “Types of Dogs” that when clicked, it will be shown. In this case, she only wants it to be a place holder. I ahve done this many times.
When you create the menu (Appearance / Menu) you end up with something that looks like this (the OLD way…):
Notice that the top-level entry is a page. That is why clicking on it will bring you to a page. This is NOT want we want; it has to be handled a little differently. Instead of using a Page and adding that as your tot-level item, create a Custom Link item:
For the URL, simply put in the pound sign (or hash – whatever you like to call it). Add this to you menu using the button. This will add the item to the bottom of your menu.
You will see that this is a Custom item, and not a Page like the previous item. At this point, delete the Top “Types of Dogs” Menu item (the one that is a Page) and drag-n-drop the Custom”Types of Dogs” item to the top. You will have to re-indent the sub-level pages.
Save your menu. But wait! We are not yet done. But do not take my word for it. After you save your menu, try it out! See what happens when you refresh your page and click on the Types of Dogs item. Chances are you will get an error! Let’s fix that, shall we? To do so, click on the little arrow to the right of Custom and delete anything that is in the field for URL:
Save the menu after deleting the contents of URL and you will get the results you wanted! Your Top-level menu item will not be clickable!
Now, you may say to yourself, “Why not just leave the URL blank when first creating the Custom Link for the menu?” Great question! The only reason I can give you is that in order to save the custom link, you have to have something in that field. SO, we just put a character, save it, and then go in and delete it once it is in the menu!