[wp-testers] 3.01 wp_nav_menu broke my theme

Bruce Wampler brucewampler at gmail.com
Sun Aug 22 01:55:47 UTC 2010


  I worked around it, but the theme was doing a regexp replacement to
generate labels for a Javascript menu handler - the replace assumed
only a single instance. I know of at least one other theme that does
similar things.

I understand the reason, but there does seem some consensus on
various discussions that using the same name for ID and class is
generally not a great idea. The whole thing will only affect Theme
writers, and probably only themes with Javascript, so it is pretty
minor. Obviously it affected some themes with duplicate menus
in the header and footer.

Thanks for the informative reply.

Bruce

On 7/22/64 12:59 PM, Andrew Nacin wrote:
> On Sat, Aug 21, 2010 at 2:22 AM, Bruce Wampler<brucewampler at gmail.com>wrote:
>
>>   I just discovered a problem:  the return string from wp_nav_menu in 3.01
>> is
>> not the same as 3.0, and the difference broke my theme. For some reason,
>> 3.01 decided to supply each menu item's id as both an ID to the li and
>> as a class in the class=''. E.g., menu-item-24 below.
>>
>> <li id="menu-item-24" class="menu-item menu-item-type-post_type
>> menu-item-24"><a href="...about">About</a></li>
>>
>> Previously, the menu-item-# was only included in the id. This seems like a
>> fairly arbitrary
>> change, and I'm not even sure it is a good idea to use the same name as an
>> ID and a class.
>>
> I'm curious how this broke your theme. If you used #menu-item-24 then the
> class menu-item-24 (which didn't previously exist) didn't affect you.
>
> It wasn't arbitrary -- here's the explanation. We added the classes because
> we were incorrectly using the ID on the second instance of the same menu
> (say, in both the header and footer), which resulted in an ID using more
> than once. So now the ID only shows up on the first instance of the menu,
> and classes are on both.
>

-- 
-----------
Bruce Wampler, Ph.D.

Software developer
Creator of first spelling checker for a PC
Creator of Grammatik(tm), first true grammar checker
e-mail: bw at brucewampler.com
blog: brucewampler.wordpress.com



More information about the wp-testers mailing list