Skip to content

Improve menu usage #77

@rise-erpelding

Description

@rise-erpelding

There are a few things about the way the menu is used in the starter that are a little confusing and could be clarified for anyone seeking to support multiple menus in their project:

  • The way that the menu is included: {% include "menu.twig" with {'items': menu.get_items} %}, menu.twig iterates through menu.items and doesn't use the items variable that is passed when the menu is included. (For all intents and purposes, menu.get_items and menu.items look to return identical arrays.)
  • The way the code is currently working, when the menu instance is created and assigned to $context['menu'] in functions.php, it's trying to grab a menu called 'primary-menu', which doesn't exist. Right now, this doesn't matter because Timber seems to grab any menu it finds, but it could cause some problems if someone needs to have more than one menu.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions