Skip to main content

Menu

docs-source

Menu class is located in project. It extends Eightshift_Libs\Menu\Menu class.

This class is used to add all custom project implementation for menus.

To add the custom menu, you must provide an array for custom menu locations as explained in the documentation from the official WordPress docs.

/**
* Return all menu positions
*
* @return array<string> Menu positions with slug => name structure.
*/
public function getMenuPositions(): array
{
return [
'header_main_nav' => \esc_html__('Main Menu', 'eightshift-boilerplate'),
];
}

BEM Menu helper

We are providing a BEM menu helper that will create a normal WordPress menu but with HTML classes specific to the BEM methodology.

To use it just call this helper in your template.

use Eightshift_Libs\Menu\Menu;

Menu::bem_menu( 'header_main_nav', 'main-navigation' );

You can also provide multiple parameters to the helper. All the details are found here.