Topic: Specify specific pages for menu
Hi! I have another question ![]()
I am creating a main navigation bar and I would like to restrict the links to specific pages. I was thinking I could use something like this:
from _http://www.wolfcms.org/wiki/navbook:leave-out
<ul>
<li<?php echo url_match('/') ? ' id="current"': null; ?>><a href="<?php echo URL_PUBLIC; ?>">Home</a></li>
<?php foreach($this->find('/')->children() as $menu): ?>
<?php
$omit_pages = array('somepageslug', 'someotherpageslug');
if (in_array($menu->slug, $omit_pages)) {
continue;
}
?>
<li<?php echo (url_start_with($menu->url)) ? ' id="current"': null; ?>>
<?php echo $menu->link() . PHP_EOL; ?></li>
<?php endforeach; ?>
</ul>but I would like to change $omit_pages to $include_pages. Is there a way to do this with existing functions?
Thanks!
Also, shouldn't
$omit_pages = array('somepageslug', 'someotherpageslug');
if (in_array($menu->slug, $omit_pages)) {
continue;
}be
$omit_pages = array(somepageid, someotherpageid);
if (in_array($menu->id, $omit_pages)) {
continue;
}? In case the page slug changes?

