• vrs99

    (@vrs99)


    I’m using Twenty Twenty to set up an Escape Room type website for colleagues. There’s a custom way to make your way through the website so I’ve hidden all navigation menus from the interface. But two of them with a full list of all pages on the website still show up in the page source for each page. I need to get rid of those but am at a loss as to how to get that done.

    In the source the lists are preceded by the following respectively:
    <nav class=”primary-menu-wrapper” aria-label=”Horizontal” role=”navigation”>
    and
    <nav class=”mobile-menu” aria-label=”Mobile” role=”navigation”>

    I’ve searched for references to these in the theme files but it’s hard to find a solution. I’ve commented out
    – ‘function twentytwenty_menus()’ from functions.php
    – ‘if ( has_nav_menu( ‘primary’ ) || ! has_nav_menu( ‘expanded’ ) )’ from header.php
    – all contents from modal-menu.php

    It don’t do nuthin’

    It doesn’t help that searching online is hard with almost every result showing how to hide menus not delete them. If someone can point me in the right direction that would be awesome!

Viewing 6 replies - 1 through 6 (of 6 total)
  • stilman davis

    (@stilman-davis)

    First of all I hope you are working on a child theme so your changes will be saved when you update the parent theme.

    I would want to look at the header parts and eliminate all mentions of the menus if I were you. But I am an innocent in WordPress coding, so beware.

    Anonymous User 14254218

    (@anonymized-14254218)

    this:

    I hope you are working on a child theme

    and this:

    look at the header parts and eliminate all mentions of the menus

    So @stilman-davis is totally right ??

    see here: Child Themes | Theme Developer Handbook

    You would want to create a child theme and add a modified version of the parents header.php file to it. You will basically remove all lines related to has_nav_menu, wp_nav_menu and anything else related to the HTML tags you wish to remove.

    Thread Starter vrs99

    (@vrs99)

    Thanks for the response guys. I guess I’ll just have to take the butchers knife to all the files.

    stilman davis

    (@stilman-davis)

    Let us know that you have succeeded with the excision of the menu. Share your solution, please, so the thread can be marked resolved.

    Thread Starter vrs99

    (@vrs99)

    Okay, this issue is solved. I created a child theme and copied header.php and footer.php to the child theme folder on the server.

    From within WordPress I basically deleted almost everything from those 2 files between the respective header and footer tags. That got rid of everything, maybe also stuff that I might need but that’s something I’ll find out later.

    Thanks for the help!

    Glad I was of some help.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Delete (not hide) any and all navigation menus, also from page source’ is closed to new replies.