How do I get the /page-name only ? And just check if it´s true?
I want to check if it´s true. My code isn´t working as is.
<?php if(!$children->parent() == 'page-name'): ?>
// do something
<?php endif ?>
Or maybe there is a better way? I want to show menu and submenu but hide the children from one specific page. Is there a better way?
Here is my full menu for the time:
<? foreach ($pages->visible() as $item): ?>
<li class="<?= $item->isOpen() ? "active" : "" ?>">
<a class="bold-menu" href="<?php echo $item->url() ?>"><?php echo $item->title()->html() ?>
</a>
</li>
<?php
// get all children for the current menu item
$children = $item->children()->visible();
// display the submenu if children are available
if($children->count() > 0):
?>
<?php foreach($children as $child): ?>
<li><a class="<?php e($child->isOpen(), 'active') ?> sub-menu" href="<?php echo $child->url() ?>"><?php echo $child->title()->html() ?></a></li>
<?php endforeach ?>
<?php endif ?>
<? endforeach ?>