Show / hide Menu items
- cobber
- Master Bludit
- Posts: 78
- Joined: Sun Feb 28, 2016 10:15 am
- Location: Scotland
- Has thanked: 21 times
- Been thanked: 5 times
Wondering if anyone has managed to specifically select pages to appear or hide in the main navigation. Does Bludit possess this functionality to select whether a page link is visible in the menu bar or not as I can't seem to see it.
Thanks
Thanks
Hi cobber,
the best solution for this feature is to use custom fields and to modify a php file of the theme you are using.
At [Settings]-[General]-[Custom fields] add:
This will give you a new checkbox in the Option-Custom menu of your page.
Next you have edit the file navbar.php in bl-themes/YOUR_THEME/php/
Find:
Add an if statement:
Now if you check the box "Don't show page in menu." of a page, this page will not show up in the menu.
the best solution for this feature is to use custom fields and to modify a php file of the theme you are using.
At [Settings]-[General]-[Custom fields] add:
Code: Select all
{
"ShowMenu": {
"type": "bool",
"label": "Show in Menu",
"tip": "Don't show page in menu."
}
}
Next you have edit the file navbar.php in bl-themes/YOUR_THEME/php/
Find:
Code: Select all
<!-- Static pages -->
<?php foreach ($staticContent as $staticPage): ?>
<li class="nav-item">
<a class="nav-link" href="<?php echo $staticPage->permalink(); ?>"><?php echo $staticPage->title(); ?></a>
</li>
<?php endforeach ?>
Code: Select all
<!-- Static pages -->
<?php foreach ($staticContent as $staticPage):
if ( !$staticPage->custom('ShowMenu')) { ?>
<li class="nav-item">
<a class="nav-link" href="<?php echo $staticPage->permalink() ?>"><?php echo $staticPage->title() ?></a>
</li>
<?php } endforeach ?>