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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.