Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Glen 36 posts 168 karma points
    Sep 13, 2016 @ 10:20
    Glen
    1

    How to hide/unhide nav menus programmatically?

    Hi,

    I'm using the latest version I can't find documentation about this problem How do I hide/unhide nav menus programmatically or using umbraco back office Any suggestion?

    Glen

  • Michaël Vanbrabandt 863 posts 3348 karma points c-trib
    Sep 13, 2016 @ 10:40
    Michaël Vanbrabandt
    0

    Hi Glen,

    can you give some more details about the nav menus? Because its not fully clear what you are mean with nav menus.

    Is it frontend related?

    /Michaël

  • Glen 36 posts 168 karma points
    Sep 14, 2016 @ 01:40
    Glen
    0

    Hi Michael,

    Yes in frontend, Sorry what I mean is this.

    enter image description here

    I have created 4 contents in the back office which is Homepage, Articlepage, Aboutuspage and Newspage my root is the Homepage, example I want to hide Articlepage but How do I access the iteration so I can hide/unhide Articlepage in the navigation menu?

  • Dennis Adolfi 1082 posts 6449 karma points MVP 6x c-trib
    Sep 14, 2016 @ 06:16
    Dennis Adolfi
    1

    Hi Glen.

    You can add a checkbox property to the Articlepage documenttype called umbracoNaviHide and set it to true for this page, then you can use .Where("Visible") to hide this page in the menu.

    <ul class="nav navbar-nacv">
        @foreach (var page in CurrentPage.AncestorOrSelf(1).Children.Where("Visible"))
        {
            <li class="nav"><a href="@page.Url">@page.Name</a></li>
        }
    </ul>
    

    See this thead for more info: https://our.umbraco.org/forum/umbraco-7/using-umbraco-7/57049-umbracoNaviHide-does-not-work

    Best of luck!

  • Glen 36 posts 168 karma points
    Sep 14, 2016 @ 07:49
    Glen
    0

    Hi Dennis,

    Now it make sense :) Thanks for the link, but I can't find the Generic Properties I did navigate to Settings>Document Types>ArticlePage What I see is. enter image description here

    Where do I find the Generic Properties? I'm using v7.5.3.

  • Dennis Adolfi 1082 posts 6449 karma points MVP 6x c-trib
    Sep 14, 2016 @ 07:52
    Dennis Adolfi
    0

    Hi Glen.

    You dont have to create the property in the Generic Properties tab, any tab will do.

    The Generic Properties tab is no longer avalible to create properties for.

  • Michaël Vanbrabandt 863 posts 3348 karma points c-trib
    Sep 14, 2016 @ 07:55
    Michaël Vanbrabandt
    101

    Hi Glen,

    Generic properties are buildin in Umbraco and are not editable.

    What I mostly do is create a new Document type without template which acts as a composition. I call this _Menu and it contains a tab called Menu and a property Hide in menu with alias umbracoNaviHide.

    Then you go to the ArticlePage document type and choose right above for Compositions and click on _Menu.

    Now ArticlePage has the tab Menu also.

    /Michaël

  • Glen 36 posts 168 karma points
    Sep 14, 2016 @ 09:30
    Glen
    0

    Hi,

    I got it the both of you are correct Thanks for the details it really help me a lot awesome! :)

    Cheers

Please Sign in or register to post replies

Write your reply to:

Draft