Adding Custom Menus to Your WordPress 3 Theme

One of the cool new features that was unveiled as part of WordPress 3 is the ability to create custom menus with a drag-and-drop interface, similar to the way widgets are added to “sidebars.” However, documentation for this new feature is still extremely sparse. After reading a handful of tutorials explaining small bits of the new feature, and performing a lot of trial-and-error testing, I finally got these new custom menus working with a new theme I was building.

The first step is to enable the custom menus within your theme. That is what I’ll try to cover in this article. In an upcoming article, I’ll discuss how to actually create the menus within WordPress and start using them.

Determine Current Page in WordPress

Lately, I’ve been doing a lot of work with WordPress themes. On one particular site, the navigation menu is built dynamically, combining pages and categories in the navigation scheme. I needed to find a way to determine which page or category was currently being viewed so I could apply a special class to the item in the navigation menu, indicating that the link is active.

After a bit of research, I found a couple of useful WordPress functions that helped me determine which page the visitor is currently viewing.

Do Your Page Titles Make Sense?

Confusing NavigationI was listening to episode #194 of the BoagWorld podcast the other day. Part of the podcast included an interview with Gerry McGovern on the concept of focusing on user tasks. One of the main points made in the interview was that you need to focus on major tasks that your visitors want to accomplish when visiting your Web site and hide or even remove the extremely minor tasks. Following is an excerpt from the transcript of that interview:

everything affects everything else and people think if I add a piece of content, if I add a web page, if I you know… It’s just another page… its not… it’s going to do something positive and it’s not going to do anything negative

You at least added one link and you added one more search result that comes true and each one of those links and each one of those search results is like another sign post that can send somebody in the wrong direction.

…everything you do has three impacts. It impacts the navigation, it impacts the search, and it impacts the manageability of the website, but also that small task and small content has every bit of chance to impact the efficiency of a top task

This got me thinking. In large institutions, it’s often difficult to effectively preach the importance of reorganizing the site structure to eliminate or downplay the minor tasks, but there is something you can do to at least help your visitors a little bit.