Skip to content

How do I hide a page for a menu? #702

Discussion options

You must be logged in to vote

You can easily filter pages by adding a custom page property. The property name you use can be anything, I tend to use visiblefor this.

For example to hide pages from your menus you can add a visible property. These are the steps required to set this up:

1. Add the custom page property to your config

In /joomlatools-pages/config.phpadd

return array(
    'page' => [
        'visible'   => true,  
    ],
);

This defines a custom page property called visible that will be added to each page and set to true by default.

2. Filter your pages collection for your menu

<? $items = collection('pages', ['folder' => $folder ?? '.', 'level' => $level ?? null,  'recurse' => 'true', 'filter' => ['visible'

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by johanjanssens
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants