Skip to content

Instantly share code, notes, and snippets.

@bugsysop
Forked from bastianallgeier/menuAndSubmenu.php
Last active December 18, 2015 12:48
Show Gist options
  • Select an option

  • Save bugsysop/5785014 to your computer and use it in GitHub Desktop.

Select an option

Save bugsysop/5785014 to your computer and use it in GitHub Desktop.
<ul>
<?php foreach($pages->visible() AS $p): ?>
<li>
<a<?php echo ($p->isOpen()) ? ' class="active"' : '' ?> href="<?php echo $p->url() ?>"><?php echo html($p->title()) ?></a>
<?php if($p->children()->visible()->count()): ?>
<ul>
<?php foreach($p->children()->visible() AS $item): ?>
<li><a<?php echo ($item->isOpen()) ? ' class="active"' : '' ?> href="<?php echo $item->url() ?>"><?php echo html($item->title()) ?></a></li>
<?php endforeach ?>
</ul>
<?php endif ?>
</li>
<?php endforeach ?>
</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment