0

I understood how to create a menu from the child elements of a specific page (e.g. id=5) like this:

$pages = \Ip\Menu\Helper::getChildItems($pageId = 5);
echo ipSlot('menu', $pages);

Works so far. Just the formatting is due to the lack of Bootstrap classes enhancable.

But how can I add custom classes to the ul of this menu? Normally I do this like this:

$options = array(
    'items' => 'menu2', 
    'attributes' => array('class' => 'nav nav-stacked')
);
echo ipSlot('menu', $options);

But how can I combine these two methods?

1 Answers1

1

All in formation is in documentation - https://www.impresspages.org/docs/navigation ("ADD CUSTOM MENU ITEMS").

items variable supports menu objects, too.

In your case the final solution should look like this:

$pages = \Ip\Menu\Helper::getChildItems($pageId = 5);   

$options = array(
    'items' => $pages, 
    'attributes' => array('class' => 'nav nav-stacked')
);
echo ipSlot('menu', $options);