[wp-hackers] nav menus: theme locations vs. individual menus

Davit Barbakadze jayarjo at gmail.com
Sun Aug 1 14:19:33 UTC 2010


Thanks Andrew, it's a bit clearer now. So basically menus are just
like posts, they do not depend on themes or anything and theme
locations are like points (slots) to which menus are attached for
every particular theme, right?

Although there's still something misleading there, not quite sure
what, maybe it's naming for the functions. For example
register_nav_menus() function and it's codex page here:
http://codex.wordpress.org/Function_Reference/register_nav_menus, they
both kinda tell you that you are registering (creating) a menu, but in
fact you are not. In fact it has nothing to do with menus. You are
just registering a theme location, a slot for a menu, that probably
has yet to be created. Maybe it should be like
register_nav_menu_locations() or something.

On Sun, Aug 1, 2010 at 3:53 PM, Andrew Nacin <wp at andrewnacin.com> wrote:
> On Sun, Aug 1, 2010 at 7:37 AM, Davit Barbakadze <jayarjo at gmail.com> wrote:
>
>> Trying out this new feature finally. However there's something I don't
>> quite understand. What's the point of so called Theme Locations?
>> Initially I thought that I can create couple of theme locations, like
>> footer and header and then assign multiple individual menus to each
>> one. Now it looks like it is one to one assignment - one menu goes to
>> one theme location  (do I misinterpret something here?). But if it's
>> one to one then what's the point of having an extra level of
>> granularity?
>
>
> It's not an extra level of granularity; it's a requirement for the
> workflow. Say a theme has spots for two menus. And the user wants to create
> three menus. Maybe one isn't used, or maybe it is used as a widget. Which
> menu goes where? What if I wanted the same menu in both the header and
> footer?
>
> We realized this after a bit of testing and experimenting with how themes
> were going to use menus. Thus, we forced themes to register menu locations.
> Then the user can pair menus with the location. Each location can have zero
> or one menus, though menus can be used over and over.
>
> Related ticket would be -- http://core.trac.wordpress.org/ticket/13378. The
> ticket's description further describes the problem, and you can see how our
> solution was developed by reading through the comments and commits.
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>



-- 
Davit Barbakadze


More information about the wp-hackers mailing list