I am using the “independent sub sub menu”.
I would like to not only highlight the active page with CSS, but also always display it in the first position.
What is the best way to do this?
<?php
// independent sub sub menu
$items = false;
// get the open item on the first level
if($root1 = $pages->findBy('isOpen', true)) {
// get the open item on the second level
if($root2 = $root1->children()->findOpen()) {
// get visible children of the second level item
$items = $root2->children()->listed();
}
}
// only show the menu if items are available
if($items and $items->isNotEmpty()):
?>
<nav>
<ul>
<?php foreach($items as $item): ?>
<li><a<?php e($item->isOpen(), ' class="active"') ?> href="<?= $item->url() ?>"><?= $item->title()->html() ?></a></li>
<?php endforeach ?>
</ul>
</nav>
<?php endif ?>