[Resolved] Remove navigation on all child categories of a parent page

Home Forums Support [Resolved] Remove navigation on all child categories of a parent page

Home Forums Support Remove navigation on all child categories of a parent page

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1347601
    Joey

    I have a website that has two parts, a magazine (https://simipress.com/home/) and a small press (https://simipress.com/books/) I want to disable the primary navigation on the small press and all its child pages.

    I know I can remove the navigation bar from different pages using this code:

    body:not(.page-id-10) .main-navigation {
        display:none;
    }

    Is there a way I can apply it to all child categories of /books without having to type in each individual page ID?

    If not, I have a workaround by doing with page headers, but it’s more work. I originally just excluded the header in the page editor, which is easy, but when I exclude primary navigation that way it also excludes my off canvas panel on mobile, which I can’t do. Just thought I would ask. Thank you.

    #1347911
    David
    Staff
    Customer Support

    Hi there,

    if they are child pages, then you should see a body class telling you the parent.

    Example:

    Books = page-id-10
    Authors = parent-pageid-10

    #1349009
    Joey

    parent-pageid was the trick. I asked wrong, instead of doing with exceptions I should have asked how to remove the navigation on every page directly, but same idea. It worked for me like this, in case anyone else is trying to figure it out:

    .page-id-10 .main-navigation,
    .parent-pageid-10 .main-navigation {
        display:none;
    }

    Thank you for all your help.

    #1349221
    David
    Staff
    Customer Support

    Glad to be of help – and thanks for sharing your solution.

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