Thoughts on the WordPress 3.0 menu system

One of WordPress 3.0’s most anticipated features is the revamped menu generation system. I’ve played around with the nightly builds and I am very impressed with both the front-end and back-end aspects of the features. It comes as sad news to hear that the development team is planning to shelve it for now in order to meet a timetable. That being the case, I have an observation to share and a way to address it, which I’d have submitted as a patch myself if only I knew how.

Right now, the menus are, de facto, tied into the new default theme, Twentyten. This is because the CSS rules governing the appearance of the menu is coded into the theme’s style.css. The menu itself is called using the function, wp_nav_menu, but that outputs the list, nested as necessary, without any inline CSS.

Herein lies a dilemma: what if you are a fledgling theme developer and you didn’t know about that particular set of facts? What if you’re a user who’s used to downloading themes from the repository and the theme you happen to like is no longer supported or updated by its author? You’ll have this set of features in the back-end, “Menus,” that doesn’t appear to do anything!

At first I thought that hooking the CSS into wp_head would work so that all themes would have menus and the required styles, until I realized something about CSS’s hierarchy: code that appears last takes priority. No amount of editing in the style.css would work unless it’s attached after wp_head.

So here’s the suggestion: a script/routine/whatever that checks for the presence of a WP3.0 Menu, which then checks for the wp_nav_menu across all theme files, which then checks for the menu selectors in all .css files in the theme directory. Reminder messages (red or yellow, whatever) appear in the admin screen depending on what’s missing:

  • “Menus are WordPress 3.0’s newest and greatest feature. You should give it a spin.”
  • “You have a Menu saved, but it won’t show up in your theme unless you use wp_nav_menu. Here’s a link to a few suggestions on how to do this.”
  • “You have a Menu used in your theme, but you have no CSS rules to make it look good! We’ve got sample blocks of code that you can copy and paste into your style.css.”

Or something along those lines, and I can already think of a few objections, the general themes of which run in almost any open-source project:

  • “Everyone will child theme off of 2010.” <-- UH, NO.
  • “Why would anyone need a warning like that?” <- Yes, open source elitists still say this shit.
  • “If you’re a theme developer, you need to keep track of these things.” <-- Exactly, and the warnings are there to help.
  • “Not enough people will benefit from this warning.” <-- This one is particularly dangerous.

Leland of Themelab also suggested in an email that the Menus box be enabled on the Theme level; that a function that turns it on be required in functions.php. This sounds like a good idea, too.

This situation elicits a little regret. Ive used WordPress since it was b2. I’ve seen its features evolve and I’ve built a great side business using it as a quick and efficient (not necessarily easy) way to deploy a front-end design. In all this time I’ve been in total remiss at learning PHP, the ins and outs of the development cycle, and the culture around WordPress. If I have, I’d have submitted this as a patch and fought for it. So before anyone tells me that I should submit it as a patch instead of shouting it from the rooftops, as of right now, I can’t quite do much else. That doesn’t mean that my idea is invalid.

2 thoughts on “Thoughts on the WordPress 3.0 menu system”

  1. I love the new menu option in WordPress 3.0. I think the CSS issue could be resolved by providing more granular control over styling in the backend using an editor that adjust the styling being outputted dynamically across whatever theme is installed.

    In the html5 css3 theme I created that my site is currently running on, I took the class found in twentyten and applied the add_theme_support( ‘nav-menus’ ); in my functions.php.

    IMHO, the WP development team simply needs to provide more styling options and leave it up to theme developers to add the appropriate hook. Maybe a little easier said than done.

Leave a Reply

Your email address will not be published. Required fields are marked *