Jump to content

exclude items from menu


toolman

Recommended Posts

Hi,

 

I have this menu code which displays a drop down menu:

 

<ul>
<li><a href="<?php echo URL_PUBLIC; ?>">Home</a></li>
<?php 
function submenu($list, $ul){
if($ul){
echo "
<ul>";}
foreach($list->children() as $newList){
	echo '
	<li>'.$newList->link($newList->title, (in_array($newList->slug, explode('/', $newList->url)) ? ' class="current"': null));
	if ($newList->childrenCount() > 0) {
		submenu($newList, true);
	}else{echo "</li>";}
}
	if($ul){echo "

</ul></li>";}
}

submenu($this->find('/'), false);
?>
<br style="clear: left" />
</ul>

 

I am trying to exclude certain menu items based on their slug.

 

I have this code, but can't work it into the above:

 

$omit_pages = array('page1', 'page2');
if (in_array($menu->slug, $omit_pages)) {
    continue;
}

 

Does anyone have any ideas how I can work it in?

 

Thanks

 

 

Link to comment
https://forums.phpfreaks.com/topic/251152-exclude-items-from-menu/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.