[Resolved] Hide menu items on one page

Home Forums Support [Resolved] Hide menu items on one page

Home Forums Support Hide menu items on one page

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #1626458
    Katrin

    Hey,

    is it possible to show only one menu item out of the main menu on one specific page?

    All the other pages should show all menu items of the main menu (primary menu) but on one page I wanna reduce it to only login. Or would it be easier to some how make a new menu with that menu item for this page?

    Thanks!
    Katrin

    #1626465
    Katrin

    Oh, maybe I wanna add a menu item “register” aswell. Do I need an other solution than?

    #1626582
    David
    Staff
    Customer Support

    Hi there,

    Easiest method that will save a lot of time if you want to add/remove items is this plugin:

    https://en-gb.wordpress.org/plugins/conditional-menus/

    #1626587
    Katrin

    Hey David,

    thanks! Is that the most lightweight solution? Or would it be better using a code instead of a plugin in terms of page speed etc.?

    #1626614
    David
    Staff
    Customer Support

    You’re alternative is to add some CSS Classes to your menu items. This article explains how:

    https://docs.generatepress.com/article/using-the-wordpress-menu-builder/#custom-classes

    For example give your Login and Register links a CSS class of: register

    Now get the ID of the Page you want to show only the Register / Login items.
    You can get its Page ID from the editor URL. eg. 55.

    This CSS will hide all navigation items apart from those with a Class of register on page ID 55:

    .page-id-55 .main-navigation li:not(.register) {
        display: none;
    }
    #1626672
    Katrin

    This works perfectly, thank you so much!!

    Now I’m trying to figure out, if I can fix the page height to the exact height of the screen. I have to GenerateBlocks Containers as a content. First on should be more or less in the middle and the second one should be on the bottom of the screen.

    I tried your code from here: #1554981

    .page-id-963 .inside-article{
    		min-height: calc(100vh - 123.33px);
    }

    It doesn’t work for me. I added the page in the private info.

    Is it possible to do that with css?

    Thank you David!

    #1626698
    David
    Staff
    Customer Support

    Bit trickier than that – try this:

    .page-id-963 .entry-content {
        min-height: calc(100vh - 84px);
        display: flex;
        flex-direction: column;
    }
    .page-id-963 .entry-content div:first-child {
        flex: 1;
    }
    @media(max-width: 768px) {
        .page-id-963 .entry-content {
            min-height: calc(100vh - 54px);
        }
    }
    #1626706
    Katrin

    I added the code, but nothing changed.

    #1626715
    David
    Staff
    Customer Support

    Theres an unnecessary } just before your /*fixed page height for quote page*/ CSS. Remove that as its stopping any CSS after it from being executed.

    #1626752
    Katrin

    Sorry, for that unnecessary fault!! Now it works great 🙂 Thank you!

    I’m wondering if there is an easy way to put the first container always vertical centered. Now I’m trying to find a middle way for different screen sizes with some padding. But if that’s too much effort, just leave it!

    Thank you anyway for all your help here!

    #1626815
    Leo
    Staff
    Customer Support

    Sorry is the original topic of hiding menu items resolved?

    If so can you open a new topic for the separate questions?

    It’s easier for us to help this way.

    Thanks!

Viewing 11 posts - 1 through 11 (of 11 total)
  • You must be logged in to reply to this topic.